troubleshooting Question

$result syntax error

Avatar of mhoggatt1
mhoggatt1 asked on
14 Comments2 Solutions199 ViewsLast Modified:
I am receiving an error message on line 14 of the following script.
I have included the message in a comment line above line 14.

      $include_path = "";
      require_once($include_path. 'uis.php');
      require_once($include_path. 'myconfig.php'); // Connect to the DB


// This statement works on my Windows XP machine
// but not on the Linux OS
// Here is the error message -
/* Sql error : You have an error in your SQL syntax near 'ORDER BY directory_name ASC' at line 1 */

$result = mysql_query("SELECT DISTINCT jz_directoryID, directory_name, directory_link FROM ".$myconfig->dt['jz_directory']." ORDER BY directory_name ASC") or die("Sql error : " . mysql_error());

$num_rows = mysql_num_rows($result);
echo "number of rows = $num_rows<br>";

while ($row = mysql_fetch_array($result)) {

$directory_name = mysql_result($result,$i,"directory_name");
$directory_link = mysql_result($result,$i,"directory_link");

echo "Directory name is $directory_name<br>";
echo "Directory link is $directory_link<br><br>";

Thanks for your help.
Join our community to see this answer!
Unlock 2 Answers and 14 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros