Good day,
Am trying to find a solution to the search result issue am facing…if I search for a particular state it will return all the rows in the database which some of the result is different from the state I search, even different countries…I want it to return only what I search for…if I search by artist_username it will return all rows in the database too…
below is the code am running…am trying to generate the result randomly
include_once $_SERVER['DOCUMENT_ROOT'] . '/inc/DB.inc.php';
$sql= "SELECT artist_username
,artist_bizname
,artist_city_area
,artist_state
,artist_country
,members_signup.profile_photo
FROM artists INNER JOIN members_signup ON artists.artist_username = members_signup.user_name
WHERE artists_id >= (SELECT FLOOR( MAX(artists_id) * RAND()) FROM `artists`
WHERE MATCH(artist_bizname) AGAINST(:phrase) OR
MATCH(artist_city_area) AGAINST(:phrase) OR
MATCH(artist_state) AGAINST(:phrase) OR
MATCH(artist_country) AGAINST(:phrase) OR
MATCH(artist_username) AGAINST(:phrase)) LIMIT 25";
$s = $pdo->prepare($sql);
$s->bindValue(":phrase", $_SESSION['srhVal']);
$s->execute();
$noFound=$s->rowCount();
foreach ($s as $row){
$userD[] = array( 'artist_username' => $row['artist_username'],
'artist_bizname' =>$row['artist_bizname'],
'artist_city_area' =>$row['artist_city_area'],
'artist_country' =>$row['artist_country'],
'profile_photo' =>$row['profile_photo'],
'artist_state' =>$row['artist_state']); }
kindly help with code or idea to solve the issue