Asked  7 Months ago    Answers:  5   Viewed   22 times
SELECT * FROM people 
AND MATCH (lname,fname) AGAINST ('+massive' IN BOOLEAN MODE) 
OR (fname LIKE '%box%' OR lname LIKE '%box%') 

This query is allowing results to filter through other than those of university='2' how would I update this so it strictly only shows results where university = 2

The reason I have combined fulltext search with LIKE is because of the minimum letter count that full text search has and because I am on a shared hosting plan I am unable to modify the settings. As a result I have combined both full text and LIKE in order to accommodate



Fix your parentheses

SELECT * FROM people 
    AND (MATCH (lname,fname) AGAINST ('+massive' IN BOOLEAN MODE) 
         OR fname LIKE '%box%' 
         OR lname LIKE '%box%') 

AND has higher precedence than OR, so university = '2' was only being combined with MATCH, not with the fname/lname tests.

Tuesday, June 1, 2021
answered 7 Months ago

From the PHP Manual on mysqli_stmt::execute:

mysqli_stmt::execute -- mysqli_stmt_executeExecutes a prepared Query

Returns TRUE on success or FALSE on failure.

if ($stmt->execute()) { // exactly like this!
    $success = true;

You're doing it right... What's your dilemma?

Wednesday, March 31, 2021
answered 9 Months ago

The problem is covered on the github issues thread -

Basically, the flask-admin pip package is out of date, in regards the latest sqlalchemy pip package. In that specific area,

cls, key = identity_key(instance=obj)

sqlalchemy is now returning 3 objects, but flask-admin is only expecting 2, hence the error.

The real solution for this is to wait until a new flask-admin version is uploaded to pip, until then, you've a few options.

  1. Manually go in and edit that file
  2. As detailed in that issues thread, limit sqlalchemy to version 1.2.0b3. You can do this in your requirements.txt file, or manually with a pip upgrade install, pip install --upgrade sqlalchemy==1.2.0b3
  3. As the fix is in flask-admin's master branch in their github repository, install that version of flask-admin with the pip location of git+ Again, you do this in your requirements.txt file, or with a pip upgrade install, pip install --upgrade git+

My personal preference, and what I've done, is option 3. If you look through the code itself, it's a line the maintainers want to remove, anyway, and how they're dealing with it is better, and in general with these things, I prefer to go forward (latest version of flask-admin) rather than holding things back (rollback sqlalchemy to a previous version), and certainly better than manually editing the raw code.

Tuesday, August 3, 2021
answered 4 Months ago

Go for a union :-

  SELECT AllIDs AS MyIDs FROM ATable WHERE @Local = 'True'
  SELECT TeamIDs AS MyIDs FROM TeamTable WHERE @Local <> 'True'
Saturday, October 23, 2021
answered 1 Month ago

You need to change the collation of the table COLUMN itself.

select collation_name, *
from sys.columns
where object_id = object_id('tblname')
  and name = 'stringdata';

If you're lucky it is as easy as (example)

alter table tblname alter column stringdata varchar(20) collate Modern_Spanish_CI_AS

But if you have constraints and/or schema bound references, it can get complicated.
It can be very difficult to work with a database with mixed collations, so you may want to re-collate all the table columns.

Saturday, November 13, 2021
answered 2 Weeks ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :