Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2011
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Getting Columns to display...

    I am trying to get columns to display, i don't see the error in my query and you please take a look at my cod and the error i am getting. thank you. Please keep in mind that this is all in a while loop.



    PHP Code:
    $strQuery "SELECT partner_id_buyer "
    " FROM lead_partners_pages "
    " GROUP BY partner_id_buyer "
    " ORDER BY partner_id_buyer ";
    $result mysql_query($strQuery) or die(mysql_error());
    $ors mysql_fetch_array($result)) 


    $selectcols "SELECT * FROM auto_pings  "//selects all  columns from table
    $tempcols mysql_query($selectcols) or die(mysql_error());
    $returnedcols mysql_fetch_array($tempcols);
    $tempsymbol mysql_query("SHOW COLUMNS FROM auto_pings ");
    $symbol mysql_fetch_array($tempsymbol);

    $pingtotal $ors[partner_id_buyer];
    $pingtotal .= '_ping_success';
    if (
    in_array($pingtotal$symbol)) {
    $pingtotal20 $pingtotal;
    }
    else{
    echo 
    "Ouch something bad happend!<br/>".$pingtotal;
    }

    $strQuery333 "SELECT SUM($pingtotal20) AS totalPings "
    " FROM auto_pings "
    " WHERE $pingtotal20 = 1 "
    " AND MONTH(date_day)=MONTH(NOW())";
    $result333 mysql_query($strQuery333) or die(mysql_error());
    $ors333 mysql_fetch_array($result333);

    echo  
    "<div class=\"FLeft Ping\">Ping:" $ors333['totalPings']. "</div>" 

    Error

    Ouch something bad happend!
    _ping_successYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AS totalPings FROM auto_pings WHERE = 1 AND MONTH(date_day)=MONTH(NOW())' at line 1
    Last edited by Atrhick; 10-20-2011 at 05:02 PM.

  • #2
    New Coder
    Join Date
    Sep 2011
    Location
    Omaha, NE
    Posts
    49
    Thanks
    1
    Thanked 6 Times in 5 Posts
    If I'm not mistaken, you need to select the item by stating the name of the column you want displayed... but maybe I'm misunderstanding what you are trying to do.
    Web Design Omaha Ne
    Hold yourself responsible for a higher standard than anybody expects of you. Never excuse yourself.
    - Henry Ward Beecher


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •