php code
hi forum.
i'm thinking of where did it went wrong.. code doesn't add a new record to a local mysql database.
coming from an input page ...
pls see:
<head><title>add</title></head>
<body>
<?php
echo $_POST["item"]; //i put this on for testing if i got the correct item
$item = addslashes($item);
@ $db = mysql_pconnect("localhost", "test");
mysql_select_db("mydb");
$sql="Insert into Item values('".$item."')";
$query= mysql_query($sql);
if(!$query){
echo mysql_affected_rows()."entry not inserted.";
} else {
echo mysql_affected_rows()."entry inserted.";
}
?>
</body>
</html>
pls help
|