List:General Discussion« Previous MessageNext Message »
From:Patrick J. Militzer Date:February 7 2000 10:28pm
Subject:SQL Statement Error: 1064
View as plain text  
Hi there,

I'm getting an error: 1064 You have an error in your SQL syntax near '' at
line 11.

I can not seem to find the error.  I'm using PHP3 and mysql on Solaris 7.
The program is to load a large number of images into a database and then
print out the name of the image in the table and then read the next image.
There are images in the image directory.

Here is the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
        <TITLE>Testing Load a file</TITLE>
</HEAD>
<BODY>
<?
print ("<table border=\"1\">\n");
// create header row
print("<TR>\n");
print("<TH>Filename</TH>\n");
print("<TH>File Size</TH>\n");
print("<TH>MLS Num</TH>\n");
print("<TH>File Handle</TH>\n");
print("</TR>\n");
print("</TR>\n");
// open the directory
$myDirectory = opendir("/data/images");
	  //Connection to database
        $mysqllink = MYSQL_CONNECT("localhost","Loginname","password");
        //Getting the image files
        while($entryname = readdir($myDirectory))
        {
	     // Testing if the file is a file, excluding directories
	     if (is_file('/data/images/' . $entryname))


    		  // If it is then
              $propnum=substr($entryname,0,6);
		  $fh =fopen('/data/images/' . $entryname, "rb");
    		  $data=fread( $fh , filesize('/data/images/' . $entryname));
		  $query="INSERT INTO images(mlsnum,photo) VALUES($propnum,$data) ";
              $result=mysql_query($query, $mysqllink) or die (print
mysql_errno($mysqllink) . mysql_error($mysqllink));
		  // Print info on each file after it loaded
		  print("<TR>");
    		  print("<TD>$entryname</TD>");
    		  print("<TD ALIGN=\"right\">");
    		  print(filesize('/data/images/' . $entryname));
              print("</TD>");
              print("<TD>");
              print($mlsnum);
           	  print("</TD>");
    		  print("<TD>");
		  print($fh);
		  print("</TD>");
		  print("</TR>\n");
		  fclose($fh);
              }
		  else
		  {}
	}
// Close the connecdtion to the database
print("</Table>\n");
mysql_close();
// Close the directory
closedir($myDirectory);
?>
<P><BR><BR>
</P>
</BODY>
</HTML>

if you see anything please let me know.

Thanks

Pat

Pat Militzer
Tech Support
Metro/MLS Inc.
11430 W North Ave
Wauwatosa, WI 53226
414-778-5400 ext. 124
Fax 778-6143
email: pmilitzer@stripped
web site: wihomes.com

Thread
SQL Statement Error: 1064Patrick J. Militzer8 Feb
  • Re: SQL Statement Error: 1064Julie Meloni8 Feb
    • RE: SQL Statement Error: 1064Patrick J. Militzer8 Feb
RE: SQL Statement Error: 1064Julie Meloni8 Feb
  • RE: SQL Statement Error: 1064Patrick J. Militzer8 Feb