PHP/MySQL Database/mysql db query

Материал из Web эксперт
Перейти к: навигация, поиск

Insert data to mysql table

 
<?php
   $linkID = @mysql_connect("localhost","root","") or die("Could not connect to MySQL server");
   $query = "INSERT INTO mytable set id="1", title="pants", myvalue="4"";
   $result = mysql_db_query("mydatabase", $query);
   mysql_close();
?>



mysql_db_query.php

 
<?php
   $linkID = @mysql_connect("localhost","root","") or die("Could not connect to MySQL server");
   $query = "INSERT INTO mytable set id="0", title="pants", myvalue="4"";
   $result = mysql_db_query("mydatabase", $query);
   mysql_close();
?>