mysql - Having trouble with php and ajax search function -
i still quite new php/ajax/mysql. in anycase, i'm creating search function returning data i'm looking for.
in brief, have mysql database set up. php website has search function. i'm trying add link mysql database search rather showing results.
in search.php, echo line working fine $string .= not returning anything. i'm trying same echo link mysql php record. missing simple?
//echo $query; $result = mysqli_query($link, $query); $string = ''; if($result) { if(mysqli_affected_rows($link)!=0) { while($row = mysqli_fetch_array($result,mysqli_assoc)) { echo '<p> <b>'.$row['title'].'</b> '.$row['post_id'].'</p>'; $string .= "<p><a href='set-detail.php?recordid=".$row->post_id."'>".$row->title."</a></p>"; } } else { echo 'no results :"'.$_get['keyword'].'"'; }
$row array, not object, have use $row['title'] or mysqli_fetch_object() instead of mysqli_fetch_array().
in fact you're using correct syntax in echo not in $string.
of course, $string needs outputed somewhere...
Comments
Post a Comment