The following SQL inline statements used in a php program are the php program code, but no content is called and no error message is reported. $ pid $ _ GET [pid]; if the pid is not empty, the call record if (! Empty ($ pid) {$ SQL & quot; selectpd. pid, pd. providerid, pd. item, pd. update, pd. price, pd. mi helps you see SQL inline statements used in a php program
The following is the php program code, but no content is called and no error message is reported.
$ Pid = $ _ GET ['pid'];
// If the 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 is executed here
$ Row = mysqli_fetch_array ($ result );
$ Item = $ row [item];
$ Update = $ row [update];
$ Price = $ row [price];
$ MinOrder = $ row [minOrder];
$ Imglink = $ row [imglink];
The following are echo $ SQL statements.
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
No error is reported for mysql_error (). If the problem is fixed, the SQL inline statement shown in red is displayed. please take a look.
------ Solution --------------------
Take your SQL statement to the mysql terminal and execute it to see what the response is...
------ Solution --------------------
$ Result = mysqli_query ($ conn, $ SQL) or die ("$ SQL
". Mysql_error ());
You have made a mistake here.
Echo mysqli_error ($ conn );
------ Solution --------------------
No errors may cause no matching results.
------ Solution --------------------
First, you can select the SQL 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 do I have any results when I go to the database?
If there is a result, it is the following error. if there is no result, it is null.
------ Solution --------------------
Check the character type of the mysql table field corresponding to $ pid. if it is char, add'
------ Solution --------------------
Discussion
The following is the php program code, but no content is called and no error message is reported.
$ Pid = $ _ GET ['pid'];
// If the 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 ......