> -----Original Message----- > From: David Blomstrom [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 10, 2004 4:08 PM > To: [EMAIL PROTECTED] > Subject: SQL Syntax Problem > > $sql = 'SELECT > F.IDArea, > C.IDArea, C.Name, C.Pop, C.Nationality, > C.NationalityPlural, C.NationalityAdjective FROM cia_people > C, famarea2 F WHERE (C.Nationality is not null) AND (F.IDArea > = \'eur\') ORDER BY $_POST[\'order\'], > $_POST[\'direction\']'; $res = mysql_query($sql) or > die('Failed to run ' . > $sql . ' - ' . mysql_error());
If you change the single quotes on the outside of the SQL statement to double quotes, PHP will parse variables inside the string. Try $sql = "SELECT F.IDArea, C.IDArea, C.Name, C.Pop, C.Nationality, C.NationalityPlural, C.NationalityAdjective " . "FROM cia_people C, famarea2 F " . "WHERE (C.Nationality is not null) AND (F.IDArea = 'eur') " . "ORDER BY {$_POST['order']}, {$_POST['direction']}"; Notice that you need to put the variables in curly braces when you have arrays being parsed. -- Pat Adams Applications Programmer SYSCO Food Services of Dallas, L.P. (469) 384-6009 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]