将WAMPSERVER升级到2.2(Apache 2.4.2; PHP 5.4.3; MySql 5.5.24)后运行php程序,总是报错,不知如何解决,求诸位指点。多谢
测试用源码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Window I</title></head><body><form id="inquery" method ="post" action="window2.php" ><h2>Window I</h2><table > <tr> <td colspan="3"><b>General Information</b></td> </tr> <tr> <td width="144"> </td> </tr> <tr> <td><p>Item Name:</p></td> <td> <?phpinclude("include/connect.php");//query string to ask the database$sqlString = "SELECT item_name FROM $table_name1"; // ask the query from the database$result = @mysql_query($sqlString,$connection) or die("Error: 003. Couldn't connect to table - Please try later"); ?><select name="item_name" value ="<?php echo $item_name; ?>"><option>--- Please Select ---</option><?php while($row = @mysql_fetch_array($result)) { ?> <option><?php echo $row['item_name'] ?></option> <?php } ?> <?php echo "\$itemname = $itemname<br><br>";?> </select> </td> </tr> <tr> <td width="144"> </td> </tr> </table><table> <tr> <td><input id="submit" class="submit" name="submit" type="submit" value="Inquery"/></td> </tr> </table></form> </body></html>
31行 $item_name 变量没有定义
38行 $itemname 变量没有定义
那是因为之前的php的notice被你屏蔽了,升级后,配置又恢复了默认吧,所以notice又开启了
你的变量没定义
如果原来正常 有可能是打开了 register globals
php.ini
改
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT