hi... im trying to insert a row into the database...

but the query is not run successfully..

$sql = "INSERT INTO temp_db (fname,mname,lname,dob,gender,email,country,phno,mobile,userid,password,mti,rtime)
	VALUES ('$fname','$mname','$lname','$dob','$gen','$mail','$country','$phno','$mob','$uid','$pass','$mt','$rtime')";

$res = mysql_query($sql) or die("cud not add record");
echo mysql_error();

this is the code..... im gettin the error from the Die part of the query..

need help....

CREATE TABLE IF NOT EXISTS `temp_db` (
  `fname` varchar(30) NOT NULL,
  `mname` varchar(30) NOT NULL,
  `lname` varchar(30) NOT NULL,
  `dob` date NOT NULL,
  `gender` varchar(10) NOT NULL,
  `email` varchar(40) NOT NULL,
  `country` varchar(30) NOT NULL,
  `phno` int(20) NOT NULL,
  `mobile` int(20) NOT NULL,
  `userid` varchar(30) NOT NULL,
  `password` varchar(30) NOT NULL,
  `mti` varchar(40) NOT NULL,
  `rtime` date NOT NULL,
  PRIMARY KEY (`userid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

this is the table im using...

help Plz...

Replace

$res = mysql_query($sql) or die("cud not add record");

with

$res = mysql_query($sql) or die(mysql_error());

and paste the error message too.

dude.. i found out the prob,i was facing...

i missed a field while inserting...

pritaeas thanks for replying...
sure need ur help, iin upcoming days.. coz hav lots of prob im facing here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.