the only thing i could think or is check the length of the varchar , is that value actually stored properly in the database ?
> Hi Daniel, > > Here's what is echoed back. It looks valid to me. > > SELECT * FROM book_details WHERE ISBN = '1-1111-1111-1' > > James > -----Original Message----- > From: Daniel Kasak [mailto:[EMAIL PROTECTED] > Sent: Sunday, August 10, 2003 5:40 PM > To: James Johnson; [EMAIL PROTECTED] > Subject: Re: MySQL field data type for ISBN numbers > > > James Johnson wrote: > >>Hi, >> >>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 >> >> >> >> > Try 'echo'ing $query to your browser and then copying the query from > your browser into the mysql client and see if it works. > I suspect there may be something wrong with the data after the $ISBN = > $_GET['isbn'] bit, and echoing the query might make it more obvious > what the problem is. > > -- > Daniel Kasak > IT Developer > * NUS Consulting Group* > Level 18, 168 Walker Street > North Sydney, NSW, Australia 2060 > T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 > email: [EMAIL PROTECTED] > website: http://www.nusconsulting.com > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]