Sending SQL Queries to a MySQL Database using the mysql_query () function
<?php
$host="mysql153.secureserver.net";
$uname="java2s";
$pass="password";
$database="java2s";
$connection= mysql_connect ($host, $uname, $pass) or die ("Database connection failed!");
$result=mysql_select_db ($database) or die ("Database could not be selected");
$query = "drop table if exists mytable";
$result = mysql_query ($query) or die ("Query failed.");
?>
Related examples in the same category