Problem with script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all, greetings from Phoenix, Arizona!
I'm having a problem with a PHP script and the database it manages.
I'm having his error message:

Query failed: 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
't read card','1099413551')' at line 1

I don't know what is happening, usually the database works well but
sometimes this strange error appears. I'm sending you the scripts in where
I think the error could be.

Any suggestion or comment will be very appreciated.

Thanks

Renato
<?php

	global $myDB,$tbl_prefix;

	if ($_GET['new'] == "no")

	{

		$query = "INSERT INTO ".$tbl_prefix."contact (contact_name, contact_company, contact_mco, contact_address, contact_telephone, contact_email, session_id) ";

		$query .= "VALUES ('".$_POST['contacto']."','".$_POST['empresa']."','".$_POST['mco']."','".$_POST['address']."','".$_POST['telefono']."','".$_POST['email']."','".$session_id."')";

		$result = $myDB->query($query);

		$query2 = "SELECT contact_id FROM ".$tbl_prefix."contact WHERE contact_name = '".$_POST['contacto']."'";

		$result2 = $myDB->query($query2);

		while ($row = mysql_fetch_assoc($result2))

		{

			$contact_id = $row['contact_id'];
		
		}

		$query3 = "INSERT INTO ".$tbl_prefix."tmp (contact_id, order_brand, order_model, order_serialnumber, order_identification, order_description, order_date, session_id) ";

		$query3 .= "VALUES ('".$contact_id."','".$_POST['marca']."','".$_POST['modelo']."','".$_POST['nserie']."','".$_POST['identificacion']."','".$_POST['descripcion']."','".time()."','".$_GET['session_id']."')";

		$result3 = $myDB->query($query3);

		$mylocation = "rma.php?page=form.php&new=yes";

		print "<script language=\"Javascript\">\n";

		print "window.location=\"".$mylocation."\";\n";

		print "</script>\n";

	}

	elseif ($_GET['new'] == "yes")

	{

		$query = "SELECT contact_id FROM ".$tbl_prefix."contact WHERE session_id = '".$_GET['session_id']."'";

		$result = $myDB->query($query);

		while ($row = mysql_fetch_assoc($result))

		{

			$contact_id = $row['contact_id'];

		}

		$query2 = "INSERT INTO ".$tbl_prefix."tmp (contact_id, order_brand, order_model, order_serialnumber, order_description, order_date, session_id) ";

		$query2 .= "VALUES ('".$contact_id."','".$_POST['marca']."','".$_POST['modelo']."','".$_POST['nserie']."','".$_POST['descripcion']."','".time()."','".$_GET['session_id']."')";

		$result2 = $myDB->query($query2);

		$mylocation = "rma.php?page=form.php&new=yes";

		print "<script language=\"Javascript\">\n";

		print "window.location=\"".$mylocation."\";\n";

		print "</script>\n";

	}

?>
-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux