Re: MySQL field data type for ISBN numbers

From: Date: Mon, 11 Aug 2003 00:53:46 +0000
Subject: Re: MySQL field data type for ISBN numbers
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-159084@lists.php.net to get a copy of this message
functions you should consider: trim urlencode/urldecode rawurlencode/rawurlencode try "echo '{$_GET['isbn']}'" (or $query) on the result page to see what you are truly getting. I bet the browser is encoding the variable in the GET string, even though it doesn't appear that way to you. Or, is the action of the FORM GET, or is it POST? if (!isset($_GET['isbn'])) { echo "no isbn"; } should verify that (if you can see the data in the URI string, it is GET...if not, POST) Quoting James Johnson <james@smb-studios.com>: > 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 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ======================================= Michael Geier CDM Sports, Inc. Systems Administration email: operations@cdmsports.com phone: 314.692.3540 ----------------------------------------------- This email sent using CDM Sports Webmail v3.1 [ http://webmail.cdmsports.com ]

« previous php.general (#159084) next »