Jump to content

code to insert values in mysql table?


shams

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.