Jump to content

HDFilmMaker2112

Members
  • Posts

    547
  • Joined

  • Last visited

    Never

Posts posted by HDFilmMaker2112

  1. Semi-Urgent... site is active, not very large site though.

     

    Trying to add Sort By and and Number of Products options to my site... the below is returning:

     

    Problem with the query: SELECT * FROM products WHERE product_category='emf meters' LIMIT 0, 20 ORDER BY product_id

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY product_id' at line 1

     

    if(isset($_POST['num_products'])){
    $num_product_per_page=$_POST['num_products'];
    $num_product_per_page = stripslashes($num_product_per_page);
    $num_product_per_page = mysql_real_escape_string($num_product_per_page);
    }
    else{
    $num_products_per_page="20";
    }
    $num_products='';
    
    if(isset($_POST['sort_by'])){
    $sort_by_selected=$_POST['sort_by'];
    $sort_by_selected = stripslashes($sort_by_selected);
    $sort_by_selected = mysql_real_escape_string($sort_by_selected);
    }
    else{
    $sort_by_selected="product_id";
    }
    $sort_by='';
    
    // How many adjacent pages should be shown on each side?
    $adjacents = 3;
    
    /* 
    First get total number of rows in data table. 
    If you have a WHERE clause in your query, make sure you mirror it here.
    */
    
    $query5 = "SELECT COUNT(*) as num FROM $tbl_name WHERE product_category='$cat'";
    $total_pages = mysql_fetch_array(mysql_query($query5));
    $total_pages = $total_pages[num];
    
    /* Setup vars for query. */
    $targetpage = "store.php?cat=".$cat; 	//your file name  (the name of this file)
    $limit = 20; 								//how many items to show per page
    $page = $_GET['page'];
    if($page){
    $start = ($page - 1) * $limit; 			//first item to display on this page
    }
    else{
    $start = 0;								//if no page var is given, set start to 0
    }
    
    /* Get data. */
    $sql30 = "SELECT * FROM $tbl_name WHERE product_category='$cat' LIMIT $start, $limit ORDER BY $sort_by_selected";
    $result30 = mysql_query($sql30) or die("Problem with the query: $sql30<br>" . mysql_error());
    

  2. I need help making specs_text centered vertically compared to specs_entry:

     

    If you have javascript turned on:

    http://ghosthuntersportal.com/store.php?product=1#specifications

     

    If javascript turned off:

    http://ghosthuntersportal.com/store.php?product=1&get=specifications

     

    .specs_header{
    font-size: 16px;
    font-weight: bold;
    background-color: #660066;
    padding: 5px;
    padding-bottom: 0px;
    width: 720px;
    margin-top: 15px;
    }
    
    .specs_text_spacer{
    margin-left: 5px;
    display: inline-block;
    }
    
    .specs_wrapper{
    border-bottom: 2px;
    border-left: 0px;
    border-right: 0px;
    border-color: #660066;
    border-style: solid;
    border-collapse: collapse;
    width: 730px;
    overflow:auto;
    }
    
    .specs_text{
    font-size: 14px;
    font-weight: bold;
    float: left;
    border: 0px;
    border-color: #660066;
    border-style: solid;
    border-collapse: collapse;
    width: 245px;
    padding: 5px;
    }
    
    .specs_entry{
    font-size: 14px;
    float: left;
    border: 0px;
    border-left: 2px;
    border-color: #660066;
    border-style: solid;
    border-collapse: collapse;
    width: 460px;
    padding: 5px;
    }
    

     

    $product_specifications=str_replace("[[","<div class=\"specs_header\"><span class=\"specs_text_spacer\">", $product_specifications);
    $product_specifications=str_replace("]]","</span></div>", $product_specifications);
    $product_specifications=str_replace("[","<div class=\"specs_wrapper\"><div class=\"specs_text\"><span class=\"specs_text_spacer\">", $product_specifications);
    $product_specifications=str_replace("|","</span></div><div class=\"specs_entry\"><span class=\"specs_text_spacer\">", $product_specifications);
    $product_specifications=str_replace("]","</span></div></div>", $product_specifications);
    $product_specifications=str_replace("<>","<br />", $product_specifications);
    

     

    The issue it seems with using vertical-align: middle; is that the specs_text is not the same height as specs_entry.

  3. I'm having an issue applying a border to the specifications table on this page:

     

    If you have javascript turned on:

    http://ghosthuntersportal.com/store.php?product=1#specifications

     

    If javascript turned off:

    http://ghosthuntersportal.com/store.php?product=1&get=specifications

     

     

    .specs_header{
    font-size: 16px;
    font-weight: bold;
    background-color: #660066;
    padding: 5px;
    padding-bottom: 0px;
    width: 720px;
    margin-top: 15px;
    }
    
    .specs_text_spacer{
    margin-left: 5px;
    display: inline-block;
    }
    
    .specs_wrapper{
    border-bottom: 2px;
    border-left: 0px;
    border-right: 0px;
    border-color: #660066;
    border-style: solid;
    border-collapse: collapse;
    width: 730px;
    }
    
    .specs_text{
    font-size: 14px;
    font-weight: bold;
    float: left;
    border: 0px;
    border-color: #660066;
    border-style: solid;
    border-collapse: collapse;
    width: 245px;
    padding: 5px;
    }
    
    .specs_entry{
    font-size: 14px;
    float: left;
    border: 0px;
    border-left: 2px;
    border-color: #660066;
    border-style: solid;
    border-collapse: collapse;
    width: 460px;
    padding: 5px;
    }
    

     

     

    $product_specifications=str_replace("[[","<div class=\"specs_header\"><span class=\"specs_text_spacer\">", $product_specifications);
    $product_specifications=str_replace("]]","</span></div>", $product_specifications);
    $product_specifications=str_replace("[","<div class=\"specs_wrapper\"><div class=\"specs_text\"><span class=\"specs_text_spacer\">", $product_specifications);
    $product_specifications=str_replace("|","</span></div><div class=\"specs_entry\"><span class=\"specs_text_spacer\">", $product_specifications);
    $product_specifications=str_replace("]","</span></div></div>", $product_specifications);
    $product_specifications=str_replace("<>","<br />", $product_specifications);
    

  4. Hi, I want to echo an image depending on a value. This is the code I'm using

    <?php if ($row_cliente_RS['estadofactura_titulo']) == 'yes'     
    echo '<img src="img/pagada.jpg" width="70" height="15">';
    ?>

    ...but nothing echoes. What am I doing wrong?

    Thanks

     

    The closing ) in your if statement is in the wrong place:

     

    if ($row_cliente_RS['estadofactura_titulo'] == 'yes')
    

     

    and you should wrap the content for the if statement in {} brackets:

     

    <?php 
    if ($row_cliente_RS['estadofactura_titulo']== 'yes'){     
    echo '<img src="img/pagada.jpg" width="70" height="15">';
    }
    ?>
    

  5. Alright:

     

    php -f /home/zyquo/public_html/ghosthuntersportal.com/cj_run.php

     

    works... I was hoping to require the ?key=a though so it would block manual access without knowing the value of key.

  6. Hmm Okay,

     

     

    Who is your hosting provider?

     

     

    I would ask them for some advice. Different systems require configuration in many different ways.

     

     

    George

     

    I actually have been, they're been trying to help me through it, but I haven't been able to have luck with it.

  7. I'm trying to generate a cron job to run the below script, but can't get it to work for the life of me.

     

    #!/usr/local/bin/php -q
    <?php
    if($_GET['key']=="a"){
    
    // Connect to server and select databse.
    mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB");
    
    
    $sql="SELECT * FROM $tbl_name3 WHERE review_show='n'";
    $result=mysql_query($sql);
    $num_results=mysql_num_rows($result);
    if($num_results > 0){
    if($num_results==1){
    $message="You have ".$num_results." review unapproved.";
    }
    else{
    $message="You have ".$num_results." reviews unapproved.";
    }
    mail('webmaster@ghosthuntersportal.com','GHP Reviews', $message, 'From: sales@ghosthuntersportal.com');
    }
    
    $sql2="SELECT * FROM $tbl_name4 WHERE rma_issued='n'";
    $result2=mysql_query($sql2);
    $num_results2=mysql_num_rows($result2);
    if($num_results2 > 0){
    if($num_results2==1){
    $message="You have ".$num_results2." RMA Number Requested.";
    }
    else{
    $message="You have ".$num_results2." RMA Numbers Requested.";
    }
    mail('webmaster@ghosthuntersportal.com','GHP RMA Number Requests', $message, 'From: sales@ghosthuntersportal.com');
    }
    echo "Emails Sent.";
    }
    ?>
    

     

     

    Cron Job Command:

    php -f /home/zyquo/public_html/ghosthuntersportal.com/cj_run.php?key=a
    

     

    I set the time to run every minute, just to try to get this to work... And in the end I get no emails in my inbox.

  8. Aside: you should really use clear, meaningful variable names.  Things like $sql101010 may seem clever or cool, but it hurts readability overall, which, in turn, reduces the chance that people will want to help you.  Variable names should give some context to what you're doing.

     

    If that's actually supposed to be the 101,010'th sql query you have in that script, you're doing it wrong.

     

    I just use differentiating variables to keep things separate. Notepad++ pretty keeps every thing easy to read for me. sql1, sql2, sql3, sql4, sql5, ect. at a quick glance look the same to me. So at a minimum I do sql1, sql20, sql300, ect. to make each subsequent variable longer, or make it different some other way.

     

    Anyway, I'm now getting into the list after the months, but I'm not getting the $rma_id or $rma_number to generate the links properly.

  9. Did you actually set your session for $_SESSION['username'];

     

    Should be something like this, on the page the log-in form is submitted to:

     

    $_SESSION['username']=$_POST['username'];
    

     

     

    Then you can  create a log-out page:

     

    session_start();
    session_unset();
    session_destroy();
    header("Location: /path/to/page/you/want/to/send/your/user/after/log-out");
    

    Save that as logout.php and link to it, when somebody clicks the link it will unset $_SESSION['username']; and require typing in the log-in information again.

  10. Sorry, it's

    <?php
    $rma_year_issued=(int)$_GET['year'];
    ?>

    instead of

    <?php
    $rma_year_issued=int($_GET['year']);
    ?>

     

    Ken

     

    Alright, changed that I'm still getting a blank page. When I went into the Page Source Code View, it shows the links it's just missing the month number and name, so the link isn't visible on the page.

     

    I added:

     

    extract($row111010);
    

     

    Above:

     

    $rma_months_issued2 = $months[$row111010['rma_month_issued']];
    

     

    That got the month numbers in the links, but still no luck with the text to make the links visible.

    Alright, fixed that; it was with: $rma_months_issued2, should have been $rma_month_issued2.

     

    Now I get the months listed, but when I click on one, it now goes to a blank page.

     

    EDIT: Spelled Calender wrong in the month links.

  11. Sorry, it's

    <?php
    $rma_year_issued=(int)$_GET['year'];
    ?>

    instead of

    <?php
    $rma_year_issued=int($_GET['year']);
    ?>

     

    Ken

     

    Alright, changed that I'm still getting a blank page. When I went into the Page Source Code View, it shows the links it's just missing the month number and name, so the link isn't visible on the page.

     

    I added:

     

    extract($row111010);
    

     

    Above:

     

    $rma_months_issued2 = $months[$row111010['rma_month_issued']];
    

     

    That got the month numbers in the links, but still no luck with the text to make the links visible.

  12. Copied that... get the following:

     

    Fatal error: Call to undefined function int() in /home/zyquo/public_html/ghosthuntersportal.com/acp_admincp.php on line 282

     

    $rma_year_issued=int($_GET['year']);

     

    I changed it to is_int(); and I get a blank page at ?rma=calender&year=2011

  13. The below works for ?rma=non-returned and &year=$year, however once it's get down to month it doesn't work. Everything seems to be in the proper brackets, but it's still not working. It goes to a blank page when month=$month is added to the URL. The URL looks like this : ?rma=calander&year=2011&month=5

    elseif($_GET['rma']=="calender"){
    $sql101010="SELECT DISTINCT rma_year_issued FROM $tbl_name4 WHERE rma_issued='y' ORDER BY rma_year_issued";
    $result101010=mysql_query($sql101010);
    while($row101010=mysql_fetch_array($result101010)){
    extract($row101010);
    $content.='<a href="./acp_admincp.php?rma=calender&year='.$rma_year_issued.'">'.$rma_year_issued.'</a>
    <br />';
    }
    
    if(isset($_GET['year'])){
    $content="";
    $logout.=' | <a href="./acp_admincp.php?rma=calender">Back to RMA Calender</a>';
    $rma_year_issued=$_GET['year'];
    $sql111010="SELECT DISTINCT rma_month_issued FROM $tbl_name4 WHERE rma_year_issued='$rma_year_issued' ORDER BY rma_month_issued";
    $result111010=mysql_query($sql111010);
    while($row111010=mysql_fetch_array($result111010)){
    extract($row111010);
    if($rma_month_issued=="1"){$rma_month_issued2="January";}
    if($rma_month_issued=="2"){$rma_month_issued2="February";}
    if($rma_month_issued=="3"){$rma_month_issued2="March";}
    if($rma_month_issued=="4"){$rma_month_issued2="April";}
    if($rma_month_issued=="5"){$rma_month_issued2="May";}
    if($rma_month_issued=="6"){$rma_month_issued2="June";}
    if($rma_month_issued=="7"){$rma_month_issued2="July";}
    if($rma_month_issued=="8"){$rma_month_issued2="August";}
    if($rma_month_issued=="9"){$rma_month_issued2="September";}
    if($rma_month_issued=="10"){$rma_month_issued2="October";}
    if($rma_month_issued=="11"){$rma_month_issued2="November";}
    if($rma_month_issued=="12"){$rma_month_issued2="December";}
    $content.='<a href="./acp_admincp.php?rma=calander&year='.$rma_year_issued.'&month='.$rma_month_issued.'">'.$rma_month_issued2.'</a>
    <br />';
    }
    if(isset($_GET['month'])){
    $content="";
    $logout.=' | <a href="./acp_admincp.php?rma=calender&year='.$rma_year_issued.'">Back to RMA Calender Year</a>';
    $rma_month_issued=$_GET['month'];
    $sql211010="SELECT * FROM $tbl_name4 WHERE rma_year_issued='$rma_year_issued' AND rma_month_issued='$rma_month_issued' ORDER BY rma_date_issued";
    $result211010=mysql_query($sql211010);
    while($row211010=mysql_fetch_array($result211010)){
    $content.='<a href="./acp_admincp.php?rma=calander&year='.$rma_year_issued.'&month='.$rma_month_issued.'&id='.$rma_id.'">'.$rma_number.'</a>
    <br />';
    }
    }
    }
    }
    

     

    The issue maybe the AND in the SQL query... however I need to be sure that the data pulled is of that specific month and that specific year. Not one or the other.

  14. elseif($_GET['rma']=="issue"){
    session_start();
    $rma_id=$_GET['id'];
    $_SESSION['rma_id']=$rma_id;
    $rma_issued=$_POST['rma_issued'];
    if($rma_issued=="y"){
    $length = 2;
    $characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    $string= microtime(true);
    for ($p = 0; $p < $length; $p++) {
    $string .= $characters[mt_rand(0, strlen($characters))];
    }
    for ($p = 0; $p < $length; $p++) {
    $string2 .= $characters[mt_rand(0, strlen($characters))];
    }
    $string="".$string2."".$string;
    $string=explode(".",$string);
    $string=$string[0].$string[1];
    $rma_number=$string;
    date_default_timezone_set('US/Eastern');
    $rma_date_issued = date("F j, Y, g:i A T");
    $rma_month_issued = date("m");
    $rma_year_issued = date("Y");
    
    $sql2000000="UPDATE $tbl_name4 SET rma_number='$rma_number', rma_issued='$rma_issued', rma_date_issued='$rma_date_issued', rma_month_issued='$rma_month_issued', rma_year_issued='$rma_year_issued', returned='n' WHERE rma_id = $rma_id";
    mysql_query($sql2000000);
    header("Location: ./acp_admincp.php?rma=issued");
    }
    

     

    The above isn't inserting anything into the DB... not even the Date information.

  15. elseif($_GET['rma']=="calander"){
    $sql101010="SELECT DISTINCT rma_year_issued FROM $tbl_name4 ORDER BY rma_year_issued";
    $result101010=mysql_query($sql101010);
    while($row101010=mysql_fetch_array($result101010)){
    extract($row101010);
    $content.='<a href="./acp_admincp.php?rma=calander&year='.$rma_year_issued.'">'.$rma_year_issued.'</a>
    <br />';
    }
    
    if(isset($_GET['year'])){
    $content="";
    $logout.=' | <a href="./acp_admincp.php?rma=calander">Back to RMA Calander</a>';
    $rma_year_issued=$_GET['year'];
    $sql111010="SELECT DISTINCT rma_month_issued FROM $tbl_name4 WHERE rma_year_issued='$rma_year_issued' ORDER BY rma_month_issued";
    $result111010=mysql_query($sql111010);
    while($row111010=mysql_fetch_array($result111010)){
    extract($row111010);
    if($rma_month_issued=="1"){$rma_month_issued2="January";}
    if($rma_month_issued=="2"){$rma_month_issued2="February";}
    if($rma_month_issued=="3"){$rma_month_issued2="March";}
    if($rma_month_issued=="4"){$rma_month_issued2="April";}
    if($rma_month_issued=="5"){$rma_month_issued2="May";}
    if($rma_month_issued=="6"){$rma_month_issued2="June";}
    if($rma_month_issued=="7"){$rma_month_issued2="July";}
    if($rma_month_issued=="8"){$rma_month_issued2="August";}
    if($rma_month_issued=="9"){$rma_month_issued2="September";}
    if($rma_month_issued=="10"){$rma_month_issued2="October";}
    if($rma_month_issued=="11"){$rma_month_issued2="November";}
    if($rma_month_issued=="12"){$rma_month_issued2="December";}
    $content.='<a href="./acp_admincp.php?rma=calander&year='.$rma_year_issued.'&month='.$rma_month_issued.'">'.$rma_month_issued2.'</a>
    <br />';
    }
    }
    }
    

  16. elseif($_GET['rma']=="calander"){
    $sql101010="SELECT EXTRACT(YEAR FROM rma_date_issued) FROM $tbl_name4 ORDER BY rma_date_issued";
    $result101010=mysql_query($sql101010);
    while($row101010=mysql_fetch_array($result101010)){
    extract($row101010);
    $rma_year_issued=$rma_date_issued;
    $content.='<a href="./acp_admincp.php?rma=calander&year='.$rma_year_issued.'">'.$rma_year_issued.'</a>
    <br />';
    }
    if(isset($_GET['year'])){
    $logout.=' | <a href="./acp_admincp.php?rma=calander">Back to RMA Calander</a>';
    $rma_year_issued=$_GET['year'];
    $content="";
    $content.=$rma_year_issued;
    }
    }
    

     

    Now returns a blank page.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.