Merry Lonely Christmas PHP implementation of the common query program MySQL

Source: Internet
Author: User
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 ' '; for ($i =0; $i < $num _fields; $i + +) echo ' ; Echo ' '; while ($row =mysql_fetch_row ($rst)) {echo ' '; for ($i =0; $i < $num _fields; $i + +) echo ' '; Echo ' '; } Echo '
. $sql. ';
Echo '
. Mysql_field_name ($rst, $i). "
'. $row [$i]. '
';
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.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.