On Sun, Aug 10, 2003 at 05:25:05PM -0700, James Johnson wrote: > > 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.
Note that ISBN numbers are a maximum of 13 characters, not 15. Ten digits, three dashes. If you really want to save space, the last digit is just a check digit and can always be determined through a formula on the other digits, so as long as you verify every ISBN before you INSERT it, you can save another digit. Heck, if you wanted to, you could store the ISBN as components. A TINYINT for the country/region, a MEDIUMINT for each of publisher and publication, and a SET for the last digit. Instead of 13 bytes per ISBN, you could shrink it to slightly more than 4 bytes. Of course, unless you're dealing with millions of books, or functions that require queries-by-publisher, it probably isn't worth the effort. >Can someone tell me why > this SQL query isn't working? The advice already given is exactly what I'd submit, so I won't bother repeating it. The only thing I'll add is ... in addition to having your PHP script print the $query to the browser, you might want to have it print mysql_error() to see if the db reported anything nasty. I usually go with constructs like: $q = "SELECT ... WHERE ..."; if (!$r = mysql_query($q)) { $err="db failure: " . mysql_error(); } if (!$err) { if (!$row = mysql_fetch_array($r)) { $err="query failure: " . mysql_error(); } } if (!$err) { // do something useful with $row[] } else { print "ERROR: <tt>" . $err . "</tt>\n"; } It's especially useful if you have a bunch of things that all depend on the successful completion of previous commands, be they related to MySQL or anything else. -- Paul Chvostek <[EMAIL PROTECTED]> it.canada http://www.it.ca/ Free PHP web hosting! http://www.it.ca/web/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]