MySQL Forums
Forum List  »  PHP

Numbers Vs. Characters in MySQL Database
Posted by: Matthew Bent
Date: June 21, 2011 04:46AM

Hi,

I have a productid field in a MySQL database. When I use a number, say 1, the below code works fine:

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

When I use a character, say a, this line of code gets the error message:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/.....html/product.php on line 15

The reason I am changing productid from numbers to characters is for search engines. The URL will be www.site.co.uk/productname rather than www.site.co.uk/123

Hope this is a simple problem to fix,

Matt.

Options: ReplyQuote


Subject
Written By
Posted
Numbers Vs. Characters in MySQL Database
June 21, 2011 04:46AM


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.