Check whether the php list page is added to the php file.
// $ List is an array containing each piece of information, and then write the following code; foreach ($ list as $ value) {$ id = intval ($ value ['id']); // The information id in the list $ uid = intval ($ ['uid']); // ID $ str = // query database where likeid = '$ ID' and uid =' $ uid '; // whether there is a user ID and the current information ID. // This is the query condition. the specific code will not be written (⊙ ﹏ ⊙) B $ like = mysql_num_rows ($ str ); // the determined result $ like is greater than 0, indicating that it has been added to the favorites} // the output of the above result $ like can display each piece of information. the current user's favorites status is 1 or 0 // no code error
In an html file
{loop $list $a}$a[id] - $a[title] -........{/loop}
The problem is how to judge in an html file? That is to say, associate $ like with the List ID.
// Failed to write the following code in $ list in html:
{Loop $ list $ a} {if $ like> 0} has been added to {else}. {/if} $ a [id]-$ a [title]-... ..... {/loop}
Reply to discussion (solution)
Where does $ like come from Code 3?
Why not $ a [like]
Where does $ like come from Code 3?
Why not $ a [like]
The problem is that the $ like value of Code 3 is not equal to the value of code 1.
Where does $ like come from Code 3?
Why not $ a [like]
The list does not contain the like field.
$ Like is the result of the PHP file.
I just want to reference $ like in php to the html list.
It cannot be seen where $ like comes from, and it is a single value.
If it is the one found in code 1, should it be put into $ list?
For each id and uid, $ like is different.
Where is $ like assigned?
Where is $ like assigned?
Code 1 is the php file to determine whether each ID in the $ list is in the user's favorite list;
Code 2 is the html template page, and the list is output cyclically;
Ignore Code 3. that's wrong...
On the html page, I want to associate and judge the current information ID and $ value ['id'] of code 1.
For example, the output of code 1 is:
$ Value ['id']: 1 2 3 4 5
$ Like: 0 0 0 1 0 // corresponds to $ value ['id'], which means no other items except ID4 are collected.
On the html page, how can I determine the $ like ID of 1 2 3 4 5? Of course, the HTML page is $ list in the called php file.
Or you can have higher code. Hard work
Where is $ like assigned?
It seems that the key issue is that no value is assigned.