MySQL Forums
Forum List  »  PHP

Re: Numbers Vs. Characters in MySQL Database
Posted by: Barry Galbraith
Date: June 21, 2011 06:17AM

What type of data does your productid field hold?

If it's a varchar then you'll need to have quotes around the value to indicate that it is a string.
Also you should escape the $_GET data to help prevent a SQL injection attack.
I haven't done this. That's a job for you.

$prod_info = mysql_fetch_array(mysql_query("SELECT * FROM products WHERE productid = '".$_GET['product']."'"));

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
Re: Numbers Vs. Characters in MySQL Database
June 21, 2011 06:17AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.