For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > June 2006 > Inserting Data into MySQL database









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Inserting Data into MySQL database
Girish Agarwal

2006-06-17, 8:04 am

Hi All,
I have a table in mySQL database 5.0 the structure of which is as
follows
ssno INT 9,
lname VARCHAR(15) NOT NULL,
fname VARCHAR(15) NOT NULL,

I am inserting the values using
$query = "insert into student (ssno,lname,fname) VALUES
('".$student['ssno']."','".$student['lname']."','".$student['fname']."')";
This Query is working Fine but the only Problem I have is that if the
lname and fname values are NULL then how come it does not return an
error but instead adds the record into the database. Is it because I
am not passing the values properly. Please Help

Thanks,
Girish
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com