LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   php code (https://www.linuxquestions.org/questions/linux-software-2/php-code-132305/)

lynger 01-07-2004 02:21 AM

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


All times are GMT -5. The time now is 12:16 AM.