關鍵字:MySQL 查詢程序
if(get_magic_quotes_gpc()==1){
?>
注意本程序需要將PHP配置文件(PHP3為php3.ini,PHP4為php.ini)中的magic_quotes_gpc
設成Off或0,修改后請重新啟動Apache.
db = ’test’;
$user = ’test’;
$pass = ’;
// [ php/inc/str2url.php ] cvs 1.2
function str2url($path){
return eregi_replace("%2f","/",urlencode($path));
}
?>
服務器’);
mysql_select_db($db,$con) or die(’無法連接’.$db.’數據庫’);
$rst = mysql_query($sql,$con) or die($sql.’出錯’);
if($cmd==’查詢’){
$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 ’有 ’.mysql_affected_rows($con).’ 行受影響’;
}
?>
原文轉自:http://www.anti-gravitydesign.com