function mysql_query() queries the database. : mysql_query « MySQL Database « PHP






function mysql_query() queries the database.

 
Its syntax is: int mysql_query (string query [, int link_id])
<?
@mysql_connect("localhost", "root","") or die("Could not connect to MySQL server!");
@mysql_select_db("mydatabase") or die("Could not select company database!");
$query = "UPDATE mytable SET title = \"aaa\" WHERE id = 1";
$result = mysql_query($query);
print "Total row updated: ".mysql_affected_rows();
mysql_close();
?>
  
  








Related examples in the same category

1.Add record to my_database/my_table
2.Adding a Row to a Table
3.Deleting Data
4.Get data from mysql
5.mysql_query.php
6.Storing Information in a Database
7.Using PHP variables wherever you want inside SQL queries
8.Sign the guestbook