shams Posted April 16, 2006 Share Posted April 16, 2006 hi,This is the code to insert the valuse to mysql but doesn't work:<html><body><?php$db = mysql_connect("localhost", "root", "******");mysql_select_db("mydb",$db);$query="INSERT INTO student4 VALUES (NULL, "zubair", "second", 500)";$rt=mysql_query($query);echo mysql_error();if($rt){echo " Command is successful ";}else {echo " Command is not successful ";}?></html></body>and this is the student4 table:| id | name | class | mark |+----+---------+-------+------+| 1 | shakeel | first | 500 |+----+---------+-------+------+1 row in set (0.05 sec)any help please? Link to comment https://forums.phpfreaks.com/topic/7518-code-to-insert-values-in-mysql-table/ Share on other sites More sharing options...
shortj75 Posted April 16, 2006 Share Posted April 16, 2006 try this [code]$query="INSERT INTO student4(id,name,class,mark)VALUES ('NULL', 'zubair', 'second', '500')";$rt=mysql_query($query);[/code] Link to comment https://forums.phpfreaks.com/topic/7518-code-to-insert-values-in-mysql-table/#findComment-27397 Share on other sites More sharing options...
shams Posted April 16, 2006 Author Share Posted April 16, 2006 hi shortj75,thanks for your hint, your posted code works, then i tried this one, this was also successfull:$query="INSERT INTO student4 VALUES ('NULL', 'nabeel', 'fifth', '900'),('NULL', 'khalid', 'sixth', '1000')"; Link to comment https://forums.phpfreaks.com/topic/7518-code-to-insert-values-in-mysql-table/#findComment-27469 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.