Help with the SQL inline statement solution used in a PHP program

Source: Internet
Author: User
Help with a SQL inline statement in a PHP program
The following is the PHP program code, but the call does not have any content, there is no error message
$pid = $_get[' pid '];
PID is not empty, the call record
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 ()); The SQL statement executes here
$row = Mysqli_fetch_array ($result);
$item = $row [item];
$update = $row [UPDATE];
$price = $row [Price];
$minOrder = $row [Minorder];
$imglink = $row [Imglink];

The following is the Echo $sql statement
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 () No error, determined that the problem is in red in the SQL inline statement shown, please help to see

------Solution--------------------
Take your SQL statement and take a look at the MySQL terminal to see what the reaction is ...
------Solution--------------------
$result = Mysqli_query ($conn, $sql) or Die ("$sql
" . Mysql_error ());
You are mistaken here.
echo Mysqli_error ($conn);
------Solution--------------------
There are no errors, and there may be no results that meet the criteria
------Solution--------------------
First you that this SQL select Pd.pid, Pd.providerid, Pd.item, Pd.update, Pd.price, Pd.minorder, Pd.imglink, Pv.id, Pv.company from Pric e_db as PD inner join providers as PV on (Pd.providerid = pv.id) where pd.pid=4 go to database execution have no results?
There's a result, that's what's wrong, it's empty.
------Solution--------------------
Check the character type of the MySQL table field corresponding to the $pid, and if it is char, add '
------Solution--------------------
discuss
The following is the PHP program code, but the call does not have any content, there is no error message
$pid = $_get[' pid '];
PID is not empty, the call record
if (!empty ($pid)) {
$sql = "Select Pd.pid, Pd.providerid, Pd.item, Pd.update, Pd.price, Pd.minorder, Pd.imglink, Pv.id, Pv.company ...
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.