SQL: Limit 1 usage?

From: Date: Thu, 30 Jan 2003 20:42:47 +0000
Subject: SQL: Limit 1 usage?
Groups: php.db 
Request: Send a blank email to php-db+get-25268@lists.php.net to get a copy of this message
Currently I have a script that contains this piece of code: $sql = "SELECT MIN(network) AS 'network' FROM accessnums WHERE areacode='$_POST[areacode]' and city='$_POST[cityselected]'"; This works fine and accomplishes what I need. Some requirements changed today and I now need to get more than just "network". In MySQL command line I tried this: SELECT * FROM accessnums WHERE areacode="504" and city="New Orleans" ORDER BY network LIMIT 1; This gives me the exact response I require. However, when plugging it into my php code: $sql = "SELECT * FROM accessnums WHERE areacode=$_POST[areacode]' and city='$_POST[cityselected]' ORDER BY network LIMIT 1"; It can't execute the query. Any suggestions? Jason Wesley Upton - Web Design / Development - Application Development ===================================================== Bayou Internet.........888.30.BAYOU............http://www.bayou.com ===================================================== Tel: 318.338.2033 ICQ: 155895142 AIM: jasonwesleyupton Fax: 318.323.5053

« previous php.db (#25268) next »