gpt4 book ai didi

php - 未获取数据

转载 作者:行者123 更新时间:2023-11-29 08:39:21 25 4
gpt4 key购买 nike

我正在使用此代码从数据库中获取数据,我可以正确获取 $data 但我无法在此变量 $seldata 中正确获取数据,这是为什么所以

<?php
include_once("includes/connection.php");
include_once("includes/session.php");
//echo $_SESSION['uid'];
$sql="SELECT * FROM employee WHERE eid = '{$_GET['id']}'";
$result=mysql_query($sql);
$data=mysql_fetch_array($result);
echo "data".$data;
$sel_valsql="select * FROM selected_candidate WHERE eid = '{$_GET['id']}'";
$sresult=mysql_query($sel_valsql);
$seldata=mysql_fetch_array($sresult);
echo "seledata".$seldata;
?>

最佳答案

<?php
include_once("includes/connection.php");
include_once("includes/session.php");
//echo $_SESSION['uid'];
$sql="SELECT * FROM employee WHERE eid = '".$_GET['id']."'";
$result=mysql_query($sql);
$data=mysql_fetch_array($result);
echo "data".$data;
$sel_valsql="select * FROM selected_candidate WHERE eid = '".$_GET['id']."'";
$sresult=mysql_query($sel_valsql);
$seldata=mysql_fetch_array($sresult);
echo "seledata".$seldata;
?>

注意:mysql_fetch_array() 返回结果数组,因此您需要执行 print_r($seldata) 才能查看结果。

关于php - 未获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14291478/

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