未定义变量:第115行C:\xampp\htdocs\shed\select.php中的列表
它工作得很好。。但是当我打开页面时。。它总是在第115行的C:\xampp\htdocs\shed\select.php中给我这个消息未定义的变量:list 当我提交页面时,它总是给我正确的数据。。但始终向我显示未定义的变量$list未定义变量:第115行C:\xampp\htdocs\shed\select.php中的列表,php,mysql,html,php-5.3,Php,Mysql,Html,Php 5.3,它工作得很好。。但是当我打开页面时。。它总是在第115行的C:\xampp\htdocs\shed\select.php中给我这个消息未定义的变量:list 当我提交页面时,它总是给我正确的数据。。但始终向我显示未定义的变量$list <?php include("db.php"); if(isset($_POST['submit'])) { $aa= mysql_real_escape_string($_POST['loco_name']); $bb
<?php
include("db.php");
if(isset($_POST['submit']))
{
$aa= mysql_real_escape_string($_POST['loco_name']);
$bb=mysql_real_escape_string ($_POST['section']);
$result=mysql_query("select * from loco_detail Where loco_name= '$aa' AND section= '$bb' ") or die (mysql_error());
$Count = mysql_num_rows($result); // count the output amount
if ($Count > 0)
{
while($row = mysql_fetch_array($result))
{
$name = $row["loco_name"];
$section = $row["section"];
$schedule = $row["schedule"];
$repair = $row["repair"];
$action = $row["action"];
$date = strftime("%b %d, %Y", strtotime($row["date"]));
$list .="
<table id=\"table\" border=\"1\" cellpadding=\"2\" cellspacing=\"2\">
<tr>
<td id=\"row\"> $name </td>
<td id=\"row\"> $schedule </td>
<td id=\"row\"> $repair </td>
<td id=\"row\"> $action </td>
<td id=\"row\"> $date </td>
</tr>
</table>
";
}
} else {
$list = "You have no products listed in your store yet";
}
}
?>
在调用字符串连接的$list
前面有一个句点
错误消息表示您正在尝试使用尚未“声明”的变量。然而,这些都是毫无意义的修复,只会导致您编写更多的冗余代码
您可以在php.ini中禁用这些功能,方法是:将错误报告更改为E\u ALL&~E\u NOTICE
或添加error\u报告(E\u ALL&~E\u NOTICE)代码>到页面顶部
在一个坚果壳中,您试图添加到一个从未声明过的名为$list
的现有变量
字符串连接的示例:
您可以在此处阅读更多内容:
基本上,为了解决您的问题,请将您的if语句更改为以下内容
if($Count>0){
$list='';
而($row=mysql\u fetch\u数组($result)){
$name=$row[“本地名称”];
$section=$row[“section”];
$schedule=$row[“schedule”];
$repair=$row[“repair”];
$action=$row[“action”];
$date=strftime(“%b%d,%Y”,strotime($row[“date”]);
ob_start();
?>
$list
前面有一个句点,用于调用字符串连接
错误消息表示您正在尝试使用一个尚未“声明”的变量。然而,修复这些变量毫无意义,只会导致您编写更多冗余代码
您可以在php.ini中禁用这些功能,方法是将:error_reporting更改为E_ALL&~E_NOTICE
或在页面顶部添加error_reporting(E_ALL&~E_NOTICE);
在一个坚果壳中,您试图添加到一个从未声明过的名为$list
的现有变量
字符串连接的示例:
您可以在此处阅读更多内容:
基本上,为了解决您的问题,请将您的if语句更改为以下内容
if($Count>0){
$list='';
而($row=mysql\u fetch\u数组($result)){
$name=$row[“本地名称”];
$section=$row[“section”];
$schedule=$row[“schedule”];
$repair=$row[“repair”];
$action=$row[“action”];
$date=strftime(“%b%d,%Y”,strotime($row[“date”]);
ob_start();
?>
$list
前面有一个句点,用于调用字符串连接
错误消息表示您正在尝试使用一个尚未“声明”的变量。然而,修复这些变量毫无意义,只会导致您编写更多冗余代码
您可以在php.ini中禁用这些功能,方法是将:error_reporting更改为E_ALL&~E_NOTICE
或在页面顶部添加error_reporting(E_ALL&~E_NOTICE);
在一个坚果壳中,您试图添加到一个从未声明过的名为$list
的现有变量
字符串连接的示例:
您可以在此处阅读更多内容:
基本上,为了解决您的问题,请将您的if语句更改为以下内容
if($Count>0){
$list='';
而($row=mysql\u fetch\u数组($result)){
$name=$row[“本地名称”];
$section=$row[“section”];
$schedule=$row[“schedule”];
$repair=$row[“repair”];
$action=$row[“action”];
$date=strftime(“%b%d,%Y”,strotime($row[“date”]);
ob_start();
?>
$list
前面有一个句点,用于调用字符串连接
错误消息表示您正在尝试使用一个尚未“声明”的变量。然而,修复这些变量毫无意义,只会导致您编写更多冗余代码
您可以在php.ini中禁用这些功能,方法是将:error_reporting更改为E_ALL&~E_NOTICE
或在页面顶部添加error_reporting(E_ALL&~E_NOTICE);
在一个坚果壳中,您试图添加到一个从未声明过的名为$list
的现有变量
字符串连接的示例:
您可以在此处阅读更多内容:
基本上,为了解决您的问题,请将您的if语句更改为以下内容
if($Count>0){
$list='';
而($row=mysql\u fetch\u数组($result)){
$name=$row[“本地名称”];
$section=$row[“section”];
$schedule=$row[“schedule”];
$repair=$row[“repair”];
$action=$row[“action”];
$date=strftime(“%b%d,%Y”,strotime($row[“date”]);
ob_start();
?>
这两者的区别是什么?我已经做了更改,但仍然存在错误…如果我删除“$list=”的话,只给出一个数据字段,而不是给出所有数据这基本上是一个不值得注意的错误-它所说的是你没有声明一个变量,你能在我的电脑上…检查它吗…我想你很清楚我的问题这两者的区别是什么?我已经做了更改,但仍然错误在这里…如果我删除,只给出一个数据字段,而不是给出所有数据“$list.=”这基本上是一个不值得注意的错误-它所说的是你没有声明一个变量,你能在我的电脑上…检查一下吗..我想你很清楚我的问题这两者的区别是什么?我有
<body>
<center>
<fieldset>
<legend>Select</legend>
<table>
<form method="post">
<tr><td>Loco Number:</td><td><input type="text" name="loco_name"/></td></tr>
<tr><td>Section:</td><td><select name="section">
<option value="Mechanical">Mechanical</option>
<option value="Electrical">Electrical</option>
</select></td></tr>
<tr><td><input type="submit" name="submit" value="Submit"></td></tr>
</form>
</table>
</fieldset>
</center>
<div >
<?php echo $list; ?>
</div>
</body>
$string = "Hello "; // Declared
$string .= "World";
$string .= "!";
echo $string;
// Outputs "Hello World!"
if ($Count > 0) {
$list = '';
while($row = mysql_fetch_array($result)) {
$name = $row["loco_name"];
$section = $row["section"];
$schedule = $row["schedule"];
$repair = $row["repair"];
$action = $row["action"];
$date = strftime("%b %d, %Y", strtotime($row["date"]));
ob_start();
?>
<table id="table" border="1" cellpadding="2" cellspacing="2">
<tr>
<td class="row"><?=$name?></td>
<td class="row"><?=$schedule?></td>
<td class="row"><?=$repair?></td>
<td class="row"><?=$action?></td>
<td class="row"><?=$date?></td>
</tr>
</table>
<?
$list .= ob_get_clean();
// rest of code here
}
}