i'm trying this away:
<?php
$link = "'index.php?id=echo ['post_id']; "
?>
<?php
while ($row = mysql_fetch_array($result)) {
echo "<span class='survey-name'><a href='$link'>". $row['title'] ."</span>";
?>
but when i click the link it just refresh the page, instead of redirects to the variable element (), which is added in DB mysql and exposed at home, but clicking on the link like that would direct to the page of details of this specific element that is already working, just not targeting properly.
function get_posts($id = null, $cat_id = null){
$posts = array();
$query = "SELECT `posts`.`id` AS `post_id` , `categories`.`id` AS `category_id`, `title`,`endereco`,`cidade`,`email`,`telefone`,`categories`.`name` FROM `posts` INNER JOIN `categories` ON `categories`.`id` = `posts`.`cat_id` " ;
if(isset($id)){
$id = (int)$id;
$query .= " WHERE `posts`.`id` = {$id} ";
}
if(isset($cat_id)){
$cat_id = (int)$cat_id;
$query .= " WHERE `cat_id` = {$cat_id} ";
}
$query .= "ORDER BY `post_id` DESC";
$query = mysql_query($query);
while($row = mysql_fetch_assoc($query)){
$posts[] = $row;
}
return $posts;
}
</div>