I have a bibliographical database, where I put also my books. They are in 3 locations (A,B,C).
And I have 3 php pages where the mysql table is recalled.
The problems are books present in more than one location. I’d like to get the cover of the matching book in that given location. I mean in A I’d like have the cover of mybookA with the cover A.
With the following code I have different cover for different location (as expected), but not in the expected mode: I have coverB, and not coverA for mybookA.
This is the code:
while ($row = mysqli_fetch_array($result)) {
$imagelink = "$row[imagelink]";
$rep_ulteriore_luogo = "$row[rep_ulteriore_luogo]";
$rep_ulteriore_img = "$row[rep_ulteriore_img]";
if (!empty($imagelink) && (empty($rep_ulteriore_luogo) OR ($rep_ulteriore_luogo == $rep_main))) {
echo "
<p>$rep_ulteriore_luogo</p>
<p><b>$rep_main</b></p>
<p class=\"td\"><img src=\"$url_copertine/$imagelink\" onclick=\"onClick(this)\" alt='copertina' style='width: 150px' /></p>";
}
elseif (!empty($rep_ulteriore_img) && ($rep_main == $rep_ulteriore_luogo)) {
echo "<p>$rep_ulteriore_luogo</p>\n
<p><b>$rep_main</b></p>
<p>$rep_ulteriore_img</p>";
echo "<p class=\"td\">";
echo "<img src=\"$url_copertine/$rep_ulteriore_img\" onclick=\"onClick(this)\" alt='copertina' style='width: 150px' />";
In each of the three php pages I define $rep_main
A for location A, B for location B, C for location C.
$imagelink
is the main cover.