本文介绍了升级后,php脚本不再工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近从fedora core 5升级到cent os 4.4 with php 4.3

从mysql调用特定条目不再工作


如果我有一个链接display_story.php?id = 334它会知道显示

条目匹配id 334,我显示条目的代码看起来像

这个


$ Host =" localhost" ;;

$ User =" user";

$ Password =" password";

$ DBName =" database" ;;


$ Link = mysql_connect($ Host,$ User,$ Password);

$ Query =" SELECT * from table WHERE sid = $ id;

$ Result = mysql_db_query($ DBName,$ Query,$ Link);

while($ Row = mysql_fetch_array($ Result)){

print(" table width = \" 500 \"> \ n");

print("< tr> \ n");

print("< td valign = \&quo t; bottom \"> \ n");

print("< p class = \" page_title \"> $ Row [title] \ n");

print("< p> \ n");

print("< i> $ Row [hometext]< / i> \ n");

print("< / td> \ n");

print("< td> \ n" ;);

$ Topimage = $ Row [主题];

包含''top_image.php'';

print("< ; / td> \ n");

print("< / tr> \ n");

print("< / table> \ n");

print("< p> \ n");

print(" $ Row [bodytext] \ n") ;

print("< div align = right>< a href = \" javascript :history.go(-1)\"> ;返回< /

a>< / div>< / td> \ n");

}

mysql_close($链接);

?>


我的日志中的错误消息告诉我$ Qu ery =" SELECT * from table

WHERE sid = $ id;是问题


[client 204.50.205.242] PHP注意:未定义变量:id in

**********

[client 204.50.205.242] PHP警告:mysql_fetch_array():提供

参数不是有效的mysql结果资源

****** *********************第10行


i试图启用register_globals但问题仍然存在


关于我如何在php.ini中解决这个问题的任何想法,而不必去和/或
写下我所有的脚本(今天我很懒)


谢谢

i recently upgraded from fedora core 5 to cent os 4.4 with php 4.3
mysql 4.1 and apache 2.0.52, and all of the php scripts i had which
called specific entries from mysql are no longer working

if i had a link display_story.php?id=334 it would know do display the
entry which matched id 334, my code to display the entry looks like
this

<?php
$Host="localhost";
$User="user";
$Password="password";
$DBName="database";

$Link=mysql_connect($Host, $User, $Password);
$Query="SELECT * from table WHERE sid=$id;
$Result=mysql_db_query($DBName,$Query, $Link);
while($Row=mysql_fetch_array($Result)){
print("<table width=\"500\">\n");
print("<tr>\n");
print("<td valign=\"bottom\">\n");
print("<p class=\"page_title\">$Row[title]\n");
print("<p>\n");
print("<i>$Row[hometext]</i>\n");
print("</td>\n");
print("<td>\n");
$Topimage=$Row[topic];
include ''top_image.php'';
print("</td>\n");
print("</tr>\n");
print("</table>\n");
print("<p>\n");
print("$Row[bodytext]\n");
print("<div align=right><a href=\"javascript: history.go(-1)\">Back</
a></div></td>\n");
}
mysql_close($Link);
?>

the error message in my logs tell me that $Query="SELECT * from table
WHERE sid=$id; is the problem

[client 204.50.205.242] PHP Notice: Undefined variable: id in
**********
[client 204.50.205.242] PHP Warning: mysql_fetch_array(): supplied
argument is not a valid mysql result resource in
*************************** on line 10

i have tried turning on register_globals but the problem persists

any ideas on how i can fix this in php.ini without having to go and re-
write all of my scripts (i''m kind of lazy today)

thanks

推荐答案




这篇关于升级后,php脚本不再工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 06:03