View Full Version : Getting Columns to display...

10-20-2011, 05:49 PM
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.


$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;
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>"


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

10-20-2011, 10:58 PM
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.