I used a multi-table query, but there was this sentence. Warning:mysql_fetch_array (): supplied argument is not a valid MySQL result resource
Reply to discussion (solution)
This error indicates that your query command has an error
The invitations come out handy and the instructions
Table: Tb_members field: Mid, Shopname is the store name, Shoptype is the category
Table: tb_ranking fields: RID, Mid, Hits is CTR, date is time
$val are the categories that come from the home page
Ranked by weekly Ctr by store name
$sql = mysql_query ("Selsec tb_members.shopname,tb_members.mid, tb_ranking.* from Tb_ranking INNER joins Tb_members on Tb_m Embers.mid=tb_ranking.rid and Tb_members.shoptype= ' $val ' and Week (tb_ranking.date) =week (now ()) ORDER by sum (tb_ ranking.hits) DEST ");
Can you write like that? Never seen it.
It's generally written.
$sql = mysql_query ("Selsec tb_members.shopname,tb_members.mid, tb_ranking.* from Tb_ranking INNER joins Tb_members on Tb_m Embers.mid=tb_ranking.rid WHERE tb_members.shoptype= ' $val ' and Week (tb_ranking.date) =week (now ()) ORDER by sum (tb_ ranking.hits) DEST ");
It's still not working. I didn't use this multi-table query.
Is there any other way to sort the store name by a week's Ctr?
That's it.
You mysql_query ($sql) or Die (Mysql_error ());
Post an error message
Warning:mysql_fetch_array (): supplied argument is not a valid MySQL result resource in D:\AppSer v\www\shihui\shoplist.php on lines
No content
The following is my Code
!--? php
$sql = mysql_query ("Selsec Tb_members.shopname,tb_members.mid, tb_ranking.* from tb_ranking INNER JOIN tb_members on Tb_members.mid=tb_ Ranking.rid WHERE tb_members.shoptype= ' $val ' and Week (tb_ranking.date) =week (now ()) ORDER by sum (tb_ranking.hits) DEST " );
$value =mysql_fetch_array ($sql);/* Here is the place on line 83 */
if ($value ==false) {
echo "no content";
}else{
do{
?>
Shop name:
"href=" shop.php?id=!--? php echo $value [mid]; ?--">
!--? php
echo $value [shopname];
?
Description:
!--? php
echo substr ($value [present],0,255);
?>
!--? php
}
while ($value =mysql_fetch_array ($sql));
}
?>
$sql = mysql_query ("Selsec tb_members.shopname,tb_members.mid, tb_ranking.* from Tb_ranking INNER joins Tb_members on Tb_m Embers.mid=tb_ranking.rid WHERE tb_members.shoptype= ' $val ' and Week (tb_ranking.date) =week (now ()) ORDER by sum (tb_ ranking.hits) DEST ");
It should be: DESC
Selsec Tb_members.shopname,tb_members.mid, tb_ranking.* from Tb_ranking INNER joins Tb_members on TB_MEMBERS.MID=TB _ranking.rid WHERE tb_members.shoptype= ' $val ' and Week (tb_ranking.date) =week (now ()) ORDER by sum (tb_ Ranking.hits) DEST
Do you have an error in executing your SQL?
First check if your SQL statement is correct, MySQL execution order is correct, first query, then mysql_fetch_array ()
Desc is still the same after the change
This is the first time I have used these multiple-table query statements
No GROUP BY, can I use sum? Suggest to put out
$sql = mysql_query ("Selsec tb_members.shopname,tb_members.mid, tb_ranking.* from Tb_ranking INNER joins Tb_members on Tb_m Embers.mid=tb_ranking.rid WHERE tb_members.shoptype= ' $val ' and Week (tb_ranking.date) =week (now ()) ORDER by sum (tb_ ranking.hits) DEST ") or Die (Mysql_error ());
After the error message
Error message you have a error in your SQL syntax; Check the manual that corresponds to your MySQL server version for the right syntax to use near ' selsec Tb_members.shopnam E,tb_members.mid, tb_ranking.* from tb_ranking INNER JO ' in line 1
$sql = mysql_query ("Selsec tb_members.shopname,tb_members.mid, tb_ranking.* from Tb_ranking INNER joins Tb_members on Tb_m Embers.mid=tb_ranking.rid WHERE tb_members.shoptype= ' $val ' and Week (tb_ranking.date) =week (now ()) ORDER by sum (tb_ Ranking.hits) The Select in DEST ") was wrongly written
Error message
No Database selected
That's a lot of questions.
No Database selected
This means that there is no database selected, that is, there is no mysql_select_db (' database name ') or error.
I am on this page first query a single table can be changed to query multiple tables not