troubleshooting Question

Refering to query fields by their column names when outputting data.

Avatar of easttncs
easttncs asked on
3 Comments1 Solution263 ViewsLast Modified:
When displaying the output of a query. I would like to use the actual names of the fields for readability instead of $row[0] etc. I have been unable to do this. I have the following quiery.

$sql1 =      "SELECT COUNT(available_qty) AS BOP_Stock FROM product_snapshot WHERE thumbnail_ID = " . $_POST['thumbnail'] . " AND snapshot_date >= '" . $_POST['snapshot_date'] . "' AND snapshot_date < '" . $end_date . "'";

And the following display line....

<?php while ($row = mysql_fetch_row($getBOP_Stock)) { echo "$row[BOP_Stock]"; }?>

I have tried several variations including the quotes and excluding the quotes to no avail.

What am I missing.

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros