gpt4 book ai didi

php - 错误: showing data in two different places php mysql

转载 作者:行者123 更新时间:2023-11-29 07:51:06 25 4
gpt4 key购买 nike

我的网页中有 2 个部分: enter image description here

我试图显示数据库中的不同数据:

<?php
$id=$_GET['vari'];
include 'conexion.php';
$con=conexion();
$sql="select * from cliente where idcli='".$id."'";
$res=mysql_query($sql,$con);
$fila=mysql_fetch_array($res);
mysql_close($con);
?>

<?php



$idusu = $_SESSION['idusuario'];
$sqlcot="select c.idcotiza, c.fechacotiza, c.proyecto, u.nomusuario, c.status from cotizacion c, usuario u where c.idusuario = u.idusuario and c.idcli= ".$idusu."'";
$rescot=mysql_query($sqlcot,$cone);
if($sqlcot === FALSE) {
die(mysql_error()); // TODO: better error handling
echo mysql_error();
}

//meter en tabla
echo "<html><tr><td>Folio</td><td>Fecha</td><td>Proyecto</td><td>Vendedor</td><td>Status</td></tr>";
while ($dato=mysql_fetch_array($rescot))
{
echo "<tr>";
echo "<td>".$dato['c.idcotiza']."</td>";
echo "<td>".$dato['c.fechacotiza']."</td>";
echo "<td>".$dato['c.proyecto']."</td>";
echo "<td>".$dato['u.nomusuario']."</td>";
echo "<td>".$dato['c.status']."</td>";
echo "</tr>";
}
echo "</table>";

?>

第一个代码有效!但第二个不起作用...

它向我显示的消息是:

`Notice: Undefined variable: cone in C:\xampp\htdocs\...php on line 378 //but cone is defined

Warning: mysql_query() expects parameter 2 to be resource, null given in C:\xampp\htdocs\....php on line 378
FolioFechaProyectoVendedorStatus
Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in C:\xampp\htdocs\P...l.php on line 386`

php 代码位于我的页面中的两个不同位置

有什么想法吗?

最佳答案

你所有的问题都是从这一行开始

$rescot=mysql_query($sqlcot,$cone);

确保定义了 $cone 变量。

关于php - 错误: showing data in two different places php mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26410224/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com