Mega Code Archive

 
Categories / Php / MySQL Database
 

Sending SQL Queries to a MySQL Database using the mysql_query () function

<?php   $host="mysql153.secureserver.net";   $uname="rntsoft";   $pass="password";   $database="rntsoft";      $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."); ?>