MYSQLI and REGEXP

[email protected]
Newsgroups php.general
Message-ID <CACOt7mHO8PngoAu6mKhSXQNodacD=UbpQcTW2VLC-f==X0mjew@mail.gmail.com>
Hi, sorry for the 2nd query today.

https://dev.mysql.com/doc/refman/8.0/en/regexp.html

I'm looking at the REGEXP screens and am a bit puzzled.

Basically all the examples shown are very similar to preg_match in PHP.
long bit of text, find short bit of text - if its included etc..

However, I cannot see an example of how this is effective / used in a
SELECT of a MYSQLI database/table.  it's only rexgexp'ing against
straight strings..


ive got a current SQL - which uses JOINS.

$sql = "SELECT Users.Username, Entities.*, Teams.* FROM Teams
LEFT JOIN Users
ON Users.PlayerID = Teams.PlayerID
LEFT JOIN Entities
ON Entities.PlayerID = Teams.PlayerID
 WHERE Teams.TeamID='$teamnumber';";

This works pretty well. except i'm wanting to add a regexp into it.
Basically  a regexp where Teams.playerID does NOT begin with "*"
(shifted-8)

similar to:
if(! preg_match("/\*/",$team[playerID])
{ get all the records in the joined table  }

I'll also copy the SQl in another table where playerID DOES match * (shift-8)

In both situations the PlayerID starts with * (or doesn't start with *)

1) get the team ID (primary start number)
2) get all PlayerID's with NO stars at the start of their player-Id
3) Do the joining and get the resulting data

Do the same 3 steps except I'm selecting players WITH a * at the start
of their player Id's - i'll select from a different table name.

-- 

Gordon.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.