if (GET_MAGIC_QUOTES_GPC () ==1) {
?>
<title>MySQL General Query Program</title>
Note that this program requires a PHP configuration file (PHP3 of PHP3.INI,PHP4 to PHP.ini) MAGIC_QUOTES_GPC
Set to OFF or 0, restart Apache after modification.
Exit ();
}
Set_magic_quotes_runtime (0);
$host = ' localhost ';
$db = ' Test ';
$user = ' Test ';
$pass = ";
[php/inc/str2url.php] CVS 1.2
function Str2url ($path) {
Return Eregi_replace ("%2f", "/", UrlEncode ($path));
}
?>
<title>MySQL General Query Program</title>
if ($cmd) {
$con = Mysql_pconnect ($host, $user, $pass) or die (' Unable to connect '. $host. ' Server ');
mysql_select_db ($db, $con) or die (' Unable to connect '. $db. ' database ');
$rst = mysql_query ($sql, $con) or Die ($sql. ' Error ');
if ($cmd = = ' query ') {
$num _fields = Mysql_num_fields ($rst);
Echo ';
Echo '
'; Echo '
. $sql. ';
Echo '
'; for ($i =0; $i < $num _fields; $i + +) echo '
. Mysql_field_name ($rst, $i). " | ; Echo '
'; while ($row =mysql_fetch_row ($rst)) {echo '
'; for ($i =0; $i < $num _fields; $i + +) echo '
'. $row [$i]. ' | '; Echo '
'; } Echo '
';
Mysql_free_result ($rst);
}
else echo ' have '. Mysql_affected_rows ($con). ' Line affected ';
}
?>
The above describes the merry Lonely Christmas PHP implementation of the general MySQL query program, including Merry Lonely Christmas content, I hope the PHP tutorial interested in a friend helpful.