0

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...

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by smvec
0

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.

0

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

Edited by smvec: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.