Forum Moderators: coopster
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';") or die(mysql_error()); while($row = mysql_fetch_array($result)) { ' at line 2
The code block is as follows:
$sql = "SELECT * FROM (SELECT `company`, `license`, `contact`, `address1`, `address2`, `phone`, `fax`, `email`, `website` FROM `rcawcom_db`.`contractors`
ORDER BY `company`;\")
or die(mysql_error()); while(\$row = mysql_fetch_array(\$result)) { if (empty(\$row[website])) echo \"<font face='Arial' size='2' color='#000063'> <b>\$row[company]</b><br> </font>\"; else echo \"<a href=\\\"\$row[website]\\\" target=\\\"_blank\\\"><font face='Arial' size='2' color='#000063'><b>\$row[company]</b</a></font><br>\"; }) subq";
Any help is appreciated
Thanks
I would recommend setting up your query first in a variable and then execute the query and check for errors. You do not need the semicolon when constructing a query to be passed to MySQL via the PHP APIs so you should remove it. Then, you need to get your second quotation mark in at the close of your query statement. Finally, you execute the statement with the mysql_query [php.net] function.
$sql = "SELECT * FROM (SELECT `company`, `license`, `contact`, `address1`, `address2`, `phone`, `fax`, `email`, `website` FROM `rcawcom_db`.`contractors` ORDER BY `company`) AS t2";
$resultset = mysql_query($sql) or die(mysql_error());