标签:undefined-index mysql php pdo
我是PHP世界的新手,在这里我需要一些帮助.
我正在尝试从数据库中提取数据,我正在使用PDO来做到这一点.
我有以下未成功的PHP代码,抛出错误通知:
$pairingsistem='1';
$pecahan='1';
if($pairingsistem == "1"){
$skrg=time();
$tablaz = $pdo->query("SELECT * FROM tb_gh where saldo > 0 and status='pending' order by id ASC limit 0,1");
while ($registroz = $tablaz ->fetchAll(PDO::FETCH_ASSOC)){
//use $results
$kurirz=$registroz["username"]; //line 47 starts here
$biayaz=$registroz["saldo"];
$idnyaz=$registroz["id"];
$bankeem=$registroz["bank"];
$norekeem=$registroz["norek"];
$bitcoineem=$registroz["bitcoin"];
$pmeem=$registroz["perfectmoney"];
$fasapayeem=$registroz["fasapay"];
$namaeem=$registroz["nama"];
$phoneeem=$registroz["phone"];
$emaileem=$registroz["email"];
$paketzeem=$biayaz*$pecahan;
$surabaya=$paketzeem/$pecahan;
//shortline
Notice: Undefined index: username in
/home/u427750052/public_html/automatch.inc.php on line 47Notice: Undefined index: saldo in
/home/u427750052/public_html/automatch.inc.php on line 48Notice: Undefined index: id in
/home/u427750052/public_html/automatch.inc.php on line 49Notice: Undefined index: bank in
/home/u427750052/public_html/automatch.inc.php on line 50Notice: Undefined index: norek in
/home/u427750052/public_html/automatch.inc.php on line 51Notice: Undefined index: bitcoin in
/home/u427750052/public_html/automatch.inc.php on line 52Notice: Undefined index: perfectmoney in
/home/u427750052/public_html/automatch.inc.php on line 53Notice: Undefined index: fasapay in
/home/u427750052/public_html/automatch.inc.php on line 54Notice: Undefined index: nama in
/home/u427750052/public_html/automatch.inc.php on line 55Notice: Undefined index: phone in
/home/u427750052/public_html/automatch.inc.php on line 56Notice: Undefined index: email in
/home/u427750052/public_html/automatch.inc.php on line 57
这一直是警告.尽管到目前为止,我仍在我所能掌握的范围之内解决了一切.
解决方法:
您的一会儿和fetchAll将您带到这里.您要么需要循环执行fetch或fetchall,然后遍历返回的结果.
所以:
while ($registroz = $tablaz ->fetch(PDO::FETCH_ASSOC)){
要么
$registroz = $tablaz ->fetchAll(PDO::FETCH_ASSOC);
foreach($registroz as $row) {
但是由于您只返回1行,因此不需要循环或访存.
$registroz = $tablaz ->fetch(PDO::FETCH_ASSOC);
应该可以.
标签:undefined-index,mysql,php,pdo 来源: https://codeday.me/bug/20191111/2017510.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。