MySQL common query Program

Source: Internet
Author: User

If (get_magic_quotes_gpc () = 1 ){
?>
<Html>
<Head> <title> MySQL (the best combination with PHP) Universal Query Program </title> <Body>
Note that the configuration file php (as the mainstream development language) (php (as the mainstream development language) 3 is php (as the mainstream development language) 3.ini, php (as the mainstream development language) 4 is php (as the mainstream development language ). magic_quotes_gpc in ini)
Set it to Off or 0. After modification, restart apache (the most popular WEB server platform on Unix ).
</Body>
</Html>
<?
Exit ();
}

Set_magic_quotes_runtime (0 );

$ Host = localhost;
$ Db = test;
$ User = test;
$ Pass =;

// [Php (as the mainstream development language)/inc/str2url. php (as the mainstream development language)] cvs 1.2
Function str2url ($ path ){
Return eregi_replace ("/", "/", urlencode ($ path ));
}
?>

<Html>
<Head> <title> MySQL (the best combination with PHP) Universal Query Program </title> <Body>

<Form action = "<? Echo str2url ($ php (as the mainstream development language) _ SELF);?> "Method =" post ">
Enter the SQL statement: <br>
<Textarea name = "SQL" cols = "100" rows = "5"> <? Echo $ SQL;?> </Textarea> <br>
<Input type = "submit" name = "cmd" value = "query">
<Input type = "submit" name = "cmd" value = "">
</Form>

<?
If ($ cmd ){
$ Con = MySQL (the best combination with PHP) _ pconnect ($ host, $ user, $ pass) or die (unable to connect to. $ host. Server );
MySQL (best combination with PHP) _ select_db ($ db, $ con) or die (unable to connect. $ db. database );
$ Rst = MySQL (the best combination with PHP) _ query ($ SQL, $ con) or die ($ SQL. Error );
If ($ cmd = query ){
$ Num_fields = MySQL (the best combination with PHP) _ num_fields ($ rst );
Echo Echo <table border = "1" cellpadding = "0" cellspacing = "0">;
Echo <caption align = "center">. $ SQL. </option>;
Echo <tr>;
For ($ I = 0; $ I <$ num_fields; $ I ++) echo <th> & nbsp ;. mySQL (best combination with PHP) _ field_name ($ rst, $ I ). </th>;
Echo </tr>;
While ($ row = MySQL (the best combination with PHP) _ fetch_row ($ rst )){
Echo <tr>;
For ($ I = 0; $ I <$ num_fields; $ I ++) echo <td> & nbsp;. $ row [$ I]. </td>;
Echo </tr>;
}
Echo </table>;
MySQL (the best combination with PHP) _ free_result ($ rst );
}
Else echo has. MySQL (the best combination with PHP) _ affected_rows ($ con). The row is affected;
}
?>

</Body>
</Html>




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.