One more thing. I changed the column in my database from "day" to "regular_days" and added another column named "random_days"
Then, with this line it should work to retrieve data from both and combine it into one array....right?
$count = $db->query("SELECT regular_days AND random_days FROM users WHERE regular_days= '?' OR random_days= '?'",array($days))->count();
But it doesnt
Any ideas?
I did this now (well not me...but someone I know). It works!
But can you tell me if this will interfere with any User Spice stuff?
$count = $db->query("SELECT * FROM users WHERE regular_days = ? OR random_days = ?",array($days, $days))->count();
That friend also says its much safer to do something like this:
$sql = 'SELECT regular_days random_days FROM users WHERE regular_days = :days OR random_days = :days';
$statement = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
$statement->execute(array(':days' => 'Monday'));
$number_of_rows = $statement->fetchColumn();
Because with the statement we made earlier it is very easy to "kill the database"...he says.
Is that true?
Then, with this line it should work to retrieve data from both and combine it into one array....right?
$count = $db->query("SELECT regular_days AND random_days FROM users WHERE regular_days= '?' OR random_days= '?'",array($days))->count();
But it doesnt
Any ideas?
I did this now (well not me...but someone I know). It works!
But can you tell me if this will interfere with any User Spice stuff?
$count = $db->query("SELECT * FROM users WHERE regular_days = ? OR random_days = ?",array($days, $days))->count();
That friend also says its much safer to do something like this:
$sql = 'SELECT regular_days random_days FROM users WHERE regular_days = :days OR random_days = :days';
$statement = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
$statement->execute(array(':days' => 'Monday'));
$number_of_rows = $statement->fetchColumn();
Because with the statement we made earlier it is very easy to "kill the database"...he says.
Is that true?