MySQL universal query program implemented in php_PHP tutorial

WBOY
Release: 2016-07-21 15:56:37
Original
730 people have browsed it

if(get_magic_quotes_gpc()==1){
?>

MySQL Universal Query Program

Note that this program needs to set magic_quotes_gpc
in the PHP configuration file (php3.ini for PHP3, php.ini for PHP4) to Off or 0. Please 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));
}
?>

MySQL Universal Query Program


Please enter the SQL statement:






if($cmd){
$con = mysql_pconnect($host,$user,$pass) or die('Unable Connect to '.$host.'server');
mysql_select_db($db,$con) or die('Unable to connect to '.$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)){
> for($i=0;$i<$num_fields;$i++) echo '';
echo ' ';
}
echo '
'.$sql.'< /option>';
echo '
'.mysql_field_name($rst,$i ).'
'.$row[$i].'
';
mysql_free_result($rst);
}
else echo 'There are '.mysql_affected_rows($con).' rows affected ';
}
?>



http://www.bkjia.com/PHPjc/318050.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/318050.htmlTechArticleif(get_magic_quotes_gpc()==1){ ? html headtitleMySQL universal query program/title/head body Pay attention to this program You need to set magic_quotes_gpc in the PHP configuration file (PHP3 is php3.ini, PHP4 is php.ini)...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!