[thelist] PHP MYSQL INSERT PROBLEM
Joshua Hmielowski
jhmielowski at comcast.net
Wed Oct 15 09:29:45 CDT 2003
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";
}
More information about the thelist
mailing list