Re: Inserting Data into MySQL database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Donnerstag, 15. Juni 2006 22:42 schrieb Girish Agarwal:
> 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']."')";

$query = "INSERT INTO student (ssno,lname,fname) VALUES (12345,'','');"

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

You pass emtpy strings. ('') Try this

$query = "INSERT INTO student (ssno,lname,fname) VALUES (12345,NULL,NULL);"


Best Regards,

Oliver

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux