MySQL field data type for ISBN numbers

From: Date: Sun, 10 Aug 2003 23:04:18 +0000
Subject: MySQL field data type for ISBN numbers
Groups: php.general 
Request: Send a blank email to php-general+get-159071@lists.php.net to get a copy of this message
Hi, Don't know if this is an OT or not. I have a MySQL database for books. The ISBN field is set as varchar(15) and I've put a test ISBN number in of 1-1111-111-11. Can someone tell me why this SQL query isn't working? $ISBN = $_GET['isbn']; $query = "SELECT * FROM book_details WHERE ISBN = '$ISBN'"; Since the field is a varchar, should wrapping the variable (1-1111-111-11) in single quotes work? If I change the data in the table to 'abcd' and run this query $ISBN = 'abcd'; $query = "SELECT * FROM book_details WHERE ISBN = '$ISBN'"; It works. PHP Version 4.3.2 mysql-4.0.14b Thanks, James

« previous php.general (#159071) next »