0

I have a table name steady, I want to get all the rows that has Monday, in an imploded value in days column, what I tried however is not working it is giving the response,

MY CODE - What I have tried

$sew = " SELECT t.* FROM steady t  WHERE FIND_IN_SET(Monday, t.days) > 0";
$eeo = mysqli_query($con, $sew);
while($fre = mysqli_fetch_array($eeo)){
$product_id = $fre['product_id'];

var_dump ($product_id); //NO VARDUMP DATA SHOWS HERE.


}   

RESPONSE AFTER TRYING IT OUT

mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\b\d\steadysubscribersajax.php on line 163

DATABASE TABLE IMAGE enter image description here

Dharman
  • 26,923
  • 21
  • 73
  • 125
Shasha
  • 995
  • 6
  • 24
  • https://stackoverflow.com/questions/2973202/mysql-fetch-array-mysql-fetch-assoc-mysql-fetch-row-expects-parameter-1-to – Sergio Ivanuzzo Dec 08 '17 at 23:21
  • Note: The object-oriented interface to `mysqli` is significantly less verbose, making code easier to read and audit, and is not easily confused with the obsolete `mysql_query` interface. Before you get too invested in the procedural style it’s worth switching over. Example: `$db = new mysqli(…)` and `$db->prepare("…")` The procedural interface is an artifact from the PHP 4 era when `mysqli` API was introduced and should not be used in new code. – tadman Dec 08 '17 at 23:25
  • string literals are enclosed in single quotes (if Monday isn't meant to be a string literal, and not an identifier, then ... `FIND_IN_SET('Monday', ...`. Also, check the return from the query execution... if the return is FALSE, then an error occurred, the actual error that was returned by the server can be retrieved with http://php.net/manual/en/mysqli.error.php – spencer7593 Dec 08 '17 at 23:51

1 Answers1

2

Incorrect query, try to use one of this:

SELECT * FROM steady WHERE days = "Monday"

SELECT * FROM steady WHERE days IN ("Monday", "Thuesday")
Dharman
  • 26,923
  • 21
  • 73
  • 125
David
  • 1,141
  • 2
  • 17
  • 32