搜索
首页后端开发php教程 帮忙看个php程序里用的SQL内联语句解决办法

帮忙看个php程序里用的SQL内联语句
以下是php程序代码,但调用不出任何内容,也无报错信息
$pid = $_GET['pid'];
// pid不为空,则调用记录
if (!empty($pid)) {
$sql = "select pd.pid, pd.providerid, pd.item, pd.update, pd.price, pd.minOrder, pd.imglink, pv.ID, pv.company from price_db as pd ".
"inner join providers as pv ".
"on (pd.providerid = pv.ID) where pd.pid=$pid";
require_once('../../conn.php');
echo $sql;
$result = mysqli_query($conn,$sql) or die("$sql
" . mysql_error()); //SQL语句在这里执行
$row = mysqli_fetch_array($result);
$item = $row[item];
$update = $row[update];
$price = $row[price];
$minOrder = $row[minOrder];
$imglink = $row[imglink];

以下是echo $sql的语句
select pd.pid, pd.providerid, pd.item, pd.update, pd.price, pd.minOrder, pd.imglink, pv.ID, pv.company from price_db as pd inner join providers as pv on (pd.providerid = pv.ID) where pd.pid=4
mysql_error()也无报错,已确定问题就在红色所示的sql内联语句中,请大家帮忙看看

------解决方案--------------------
将你的sql语句拿到mysql 终端下执行一下看看是什么反应...
------解决方案--------------------
$result = mysqli_query($conn,$sql) or die("$sql
" . mysql_error());
这儿你弄错了。
echo mysqli_error($conn);
------解决方案--------------------
没有错误,也可能使没有符合条件的结果
------解决方案--------------------
首先你那这个sql select pd.pid, pd.providerid, pd.item, pd.update, pd.price, pd.minOrder, pd.imglink, pv.ID, pv.company from price_db as pd inner join providers as pv on (pd.providerid = pv.ID) where pd.pid=4 去数据库执行 有无结果?
有结果那就是后面的出错,无结果那就是空
------解决方案--------------------
检查$pid所对应的mysql表字段的字符类型,如果是char,则需加 '
------解决方案--------------------

探讨
以下是php程序代码,但调用不出任何内容,也无报错信息
$pid = $_GET['pid'];
// pid不为空,则调用记录
if (!empty($pid)) {
$sql = "select pd.pid, pd.providerid, pd.item, pd.update, pd.price, pd.minOrder, pd.imglink, pv.ID, pv.company ……
声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
Fujifilm X-M5 price expectations rise as leaked selfie display adds complexity to the formerly affordable camera lineFujifilm X-M5 price expectations rise as leaked selfie display adds complexity to the formerly affordable camera lineSep 07, 2024 am 09:34 AM

Fujifilm fans were recently very excited at the prospect of the X-T50, since it presented a relaunch of the budget-oriented Fujifilm X-T30 II that had become quite popular in the sub-$1,000 APS-C category. Unfortunately, as the Fujifilm X-T50's launc

FiiO CP13 cassette player launches with transparent retro lookFiiO CP13 cassette player launches with transparent retro lookJun 16, 2024 am 09:52 AM

TheFiiOCP13cassetteplayerwasannouncedinJanuary.Now,FiiOisexpandingitsportfoliowithtwonewmodels-onewitharedfrontandonewithatransparentfront.Thelatternotonlyperfectlymatchestheretrocharmoftheangulardesign,butalso

Klipsch unveils Flexus Core 300 flagship soundbar with 8K support, 12 speakers and room correctionKlipsch unveils Flexus Core 300 flagship soundbar with 8K support, 12 speakers and room correctionSep 05, 2024 am 10:16 AM

The Klipsch Flexus Core 300 is the top model in the series and is positioned above the already available Flexus Core 200 in the company's soundbar line-up. According to Klipsch, this is the first soundbar in the world whose sound can be adapted to th

Light Phone 3 launches with 50% discount, monochrome OLED and minimalist designLight Phone 3 launches with 50% discount, monochrome OLED and minimalist designJun 13, 2024 pm 10:18 PM

WhiletheLightPhone2from2018wasstillequippedwithaneconomicale-inkdisplay,theLightPhone3usesanOLEDdisplaythatcanonlydisplaygrayscale.Thereasonfortheswitchtothe3.92-inchOLEDpanelwithitsresolutionof1,240x1,080isth

Win7任务管理器pid怎么显示出来 小编教你怎么显示出来Win7任务管理器pid怎么显示出来 小编教你怎么显示出来Jan 11, 2024 pm 07:00 PM

很多朋友可能对于pid标识符还比较陌生,可以在任务管理器里进行查看。但是有些用户打开任务管理器时找不到PID标识符,其实如果用户想查看进程PID标识符的话,需通过对“任务管理器”相关设置就可以看到了,下面小编就以win7系统为例查看进程PID标识符的方法。PID标志符是windows操作系统对运行的程序的自动分配的一个独一无二的顺序编号,进程中止后PID被系统回收,可能会被继续分配给新运行的程序,当用户需要查看进程的时候都会通过任务管理器进行查看,那么要如何查看进程PID标识符呢?下面就跟大家分

Deal | Tesla Model 3 Long Range AWD regains full $7,500 tax incentive, drops to below $40,000Deal | Tesla Model 3 Long Range AWD regains full $7,500 tax incentive, drops to below $40,000Jun 19, 2024 am 09:55 AM

Shortly after Tesla launched the Model 3 Highland refresh towards the end of last year, the US federal EV tax incentive rules changed, cutting the potential discount in half for eligible buyers because of Tesla's use of Chinese LFP cells in the new M

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code<form name="myform"

Realme Pad 2 Lite: Affordable tablet launches with quad speakers, 90 Hz display and 15h battery lifeRealme Pad 2 Lite: Affordable tablet launches with quad speakers, 90 Hz display and 15h battery lifeSep 14, 2024 am 06:28 AM

More than a year after the launch of the Realme Pad 2 the manufacturer presents the more affordable Realme Pad 2 Lite. The new model is slightly smaller, as the display shrinks from 11.5 inches to 10.95 inches, with the IPS panel achieving a resoluti

See all articles

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
3 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳图形设置
3 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您听不到任何人,如何修复音频
3 周前By尊渡假赌尊渡假赌尊渡假赌

热工具

MinGW - 适用于 Windows 的极简 GNU

MinGW - 适用于 Windows 的极简 GNU

这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

SublimeText3 英文版

SublimeText3 英文版

推荐:为Win版本,支持代码提示!

EditPlus 中文破解版

EditPlus 中文破解版

体积小,语法高亮,不支持代码提示功能

VSCode Windows 64位 下载

VSCode Windows 64位 下载

微软推出的免费、功能强大的一款IDE编辑器

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

功能强大的PHP集成开发环境