Look, I brought the cycle out of the database, now I need to link to the full article. I made an additional page for the full news, called news.php, and pasted a link to the name, here is the block code itself:

<?php $result=mysqlquery("SELECT name,image,classfilt,heightimg FROM mackmybase"); $n=mysql_num_rows($result); while ($row = mysql_fetch_assoc($result)) { echo <<< HEREDOC <a href="/news.php"> <ul id="tiles"> <li class="$row[classfilt]"><img src="$row[image]" height="$row[heightimg]" width="200"> <p>$row[name]</p> </li> </ul> </a> HEREDOC; }; function mysqlquery($query){ // для удобной отладки $result= mysql_query($query); if (!$result) die("Неверный запрос: ".mysql_error()."\n".$query); return $result; }; ?> 

Need to do something in the link? Tell me.

  • code format. - Smash

1 answer 1

Maybe even get news from the database id and transfer it to the news.php script

 <a href="/news.php?id=$row['id']"> 

And in the news.php script, take this id and get the full text of the news.

  • Yes, yes, that's exactly right. in news.php should be $ _GET ['id'] - sinedsem