I have created a database "name" and i m trying to insert values in database by php coding...
but the value is not inserting the output comes that "-1 data insert";
i m very confused that y -1 is coming n y not values is inserted...
i m using WAMP5 for testing the code.
Please help me on this issue...
database name "name"
table name is "name";
and the structure of table is as follow:
Field Type Collation Attributes Null Default Extra Action
name varchar(30) latin1_swedish_ci No anonymous
CODING IS AS FOLLOW:
<?php
/**
* @author anilsharda
* @copyright 2007
*/
?>
<html>
<body>
<form action="add.php" method="PODT">
<table width=40% bgcolor="red">
<tr>
<td width=40% bgcolor="white"><b>Name :</b></td>
<td bgcolor="white"><input type="text" name="name" size="30"></td>
<tr><td colspan=2 align="center"><input type="submit" value="SUBMIT" name="s1"></td></tr>
</tr>
</table>
<?php
$name=$_POST['name'];
$db=mysql_pconnect('localhost','root','anilsharda') or die("unable to connect"
;
mysql_select_db('name',$db);
$result=mysql_query("insert into name value('.$name.'),$db"
;
if (!$result) {echo mysql_affected_rows($db)."data insert";}
?>
Anil sharda