php - How to access to the individual results when I get all results from search query -
could please me how access individual results fetched in array mysql database? running code below, results satisfy search criteria results without blank space in 1 array, example $username variable collects usernames in 1 line without spaces satisfy specific search criteria. how can split these results in individual results? tried string functions not work. thank in advance!
$sqlcommand = "(select * users country '%$searchquery%' or city '%$searchquery%' or town '%$searchquery%')"; $query = mysqli_query($cn, $sqlcommand) or die(mysqli_error($cn)); $count = mysqli_num_rows($query); if($count > 1){ $search_output .= "<hr />$count results <strong>$searchquery</strong><hr />$sqlcommand<hr />"; while($row = mysqli_fetch_array($query, mysqli_assoc)){ $url = $row["url"]; $url.='   '; $url1 = strtok($url," "); $id = $row["id"]; $f_name = $row["f_name"]; $l_name = $row["l_name"]; $user = $f_name; $user.= " "; $user.= $l_name; $username = $row["username"]; $username.=' <br>'; // nl2br( $url, true); $search_output .= '<a href="user.php?u=$username">'. $user . ' </a><br />'; }
Comments
Post a Comment