bunty20077
11-25-2011, 06:34 AM
This is my Code which just take names from customer and place it in databases.What i am seeing is that the code working fine,Showing echo message also but in database i created 2 field 1 auto incremented id and other for name.the id is generated but the name field remains blank..please help me.
PHP Code:
<?php
$link = mysql_connect("localhost","root","");
if (! $link) {
die('cannot connect: ' .mysql_error() ) ;
}
$db_selected = mysql_select_db ("adform",$link );
if(!$db_selected){
die('cannot use :' .mysql_error() ) ;
}
$value = $_POST['firstname'];
$sql ="INSERT INTO demo (firstname) VALUES ('$value')" ;
if(!mysql_query($sql) ) {
die ('Error :' . mysql_error());
}
echo "record added to database ";
mysql_close ($link);
?>
PHP Code:
<?php
$link = mysql_connect("localhost","root","");
if (! $link) {
die('cannot connect: ' .mysql_error() ) ;
}
$db_selected = mysql_select_db ("adform",$link );
if(!$db_selected){
die('cannot use :' .mysql_error() ) ;
}
$value = $_POST['firstname'];
$sql ="INSERT INTO demo (firstname) VALUES ('$value')" ;
if(!mysql_query($sql) ) {
die ('Error :' . mysql_error());
}
echo "record added to database ";
mysql_close ($link);
?>