RE: [PHP-DB] SQL: Limit 1 usage?
| From: | Nick Hajek | Date: | Thu, 30 Jan 2003 20:48:40 +0000 |
| Subject: | RE: [PHP-DB] SQL: Limit 1 usage? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-25270@lists.php.net to get a copy of this message | ||
Your missing a ' before the area code.
-----Original Message-----
From: jason wesley upton [mailto:upton@bayou.com]
Sent: Thursday, January 30, 2003 2:43 PM
To: php-db@lists.php.net
Subject: [PHP-DB] SQL: Limit 1 usage?
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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php