[thelist] PHP MYSQL INSERT PROBLEM

James jveillo at bellsouth.net
Wed Oct 15 10:11:38 CDT 2003


"Line 1" isn't in the PHP script but rather it is line 1 of the SQL
statement that the SQL server sees.

My guess is that the line that the SQL server is concerned with here is in
the $query syntax.

Do something like this to find out where the problem is:
$result = mysql_query($query) or die("Yep! Here it is on line whatever");

James


----- Original Message -----
From: "Joshua Hmielowski" <jhmielowski at comcast.net>
To: "The List" <thelist at lists.evolt.org>
Sent: Wednesday, October 15, 2003 9:29 AM
Subject: [thelist] PHP MYSQL INSERT PROBLEM


I am using php and mysql and I am having trouble with this script.
I keep getting an error which does not exactly make sense with this
script.

connected ok You have an error in your SQL syntax near '' at line 1

as you can see the SQL is no where near line one and I have had this
exact sql insert statement running and
printing to the screen exactly what it was supposed to. so it should be
fine.
the 'connected ok' is an echo I put in after it hits the connection
script.
the form is not shown here but I had this working before as well but my
connect script was not correct.

please look at my select_db, $qeury and my _connect script to see if it
is ok.
Thank you for your help, I have had this problem for 3 days now with no
better output.
Josh

<?
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_productbase = "localhost";
$database_productbase = "productbase";
$username_productbase = "josh";
$password_productbase = "######";
$productbase = mysql_pconnect($hostname_productbase,
$username_productbase, $password_productbase) or die(mysql_error());
echo "connected ok";
echo $query;
?>
<?
if(isset($_POST['insert']) && ($_POST['insert'] == 'form1')){
$id= $_POST['id'];
$vender = $_POST['vender'];
$thumb = $_POST['thumbpath'];
$large = $_POST['largepath'];

mysql_select_db($database_productbase, $productbase);
$query = "INSERT INTO ceramictiles (id, vender#, thumbpath, largepath)
VALUES ('$id','$vender', '$thumb', '$large')";
$result = mysql_query($query) or die(mysql_error());
echo $result;
echo $query;
}
else{
echo "not hitting the query";
}

--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !



More information about the thelist mailing list