Solved

Need assistamce with "Use of undefined constant ProductID - assumed 'ProductID'"

Posted on 2015-01-10
4
74 Views
Last Modified: 2015-01-11
I have only one field "ProductID" in a temporary table.  The field is unique.  I am attempting to extract the ProductID with a select statement and I am receiving a error:

"Use of undefined constant ProductID - assumed 'ProductID'"

The ProductID will be included in a URL string to open individual product pages and scrape data.


$query1 = $conn->query('SELECT ProductID FROM urldownload');

while ($row1 = $query1->fetch(PDO::FETCH_ASSOC))
{

echo $row1[ProductID]."<BR>";


}		

Open in new window

0
Comment
Question by:lawrence_dev
4 Comments
 
LVL 30

Accepted Solution

by:
Marco Gasi earned 500 total points
Comment Utility
You have to use quotes;
echo $row1["ProductID"]."<BR>";
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
^^^ What Marco said, use quotes.
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
0
 

Author Closing Comment

by:lawrence_dev
Comment Utility
Thanks Marco!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now