PHP Udate MySQL command

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

 



I am trying to get an update command to work in PHP.  I am able to update 
records going directly to phpmyadmin command line. I have even let it 
produce the php code to insert, but have not been able to get it to work.

I have it stripped down to one command hoping to get it to work then 
replicate entire forms for clients to use direct.I get no error codes, I 
only get my message "It did not enter into DB";

Anyone see where I am going wrong?

Gary

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
test<input name="test" type="text" />
<input name="submit" type="submit" value="submit" />
</form>

<?php


$batchconnetion = mysql_connect(host, 'un', 'pw', 'db')//sanatized for board
or die('Error connecting with MySQL Database');

$test=$_POST['test'];

//$sql="update contact set type = \'$test\' where item_id = \'164\'"; //this 
is the code created by phpmyadmin

 $sql = "INSERT INTO contact  comments, VALUES = $test WHERE contact_id = 
33";

mysql_query($sql,$batchconnetion);

$result = mysql_query($sql,$batchconnetion);

if($result == true) {
       echo "Successfully Inserted Records";
   } else {
       echo "It did not enter into DB";
}

mysql_close($batchconnetion);

?>


</body>
</html> 



__________ Information from ESET Smart Security, version of virus signature database 5171 (20100604) __________

The message was checked by ESET Smart Security.

http://www.eset.com





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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux