Your missing a ' before the area code.

-----Original Message-----
From: jason wesley upton [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 2:43 PM
To: [EMAIL PROTECTED]
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



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to