MySQL Question/base start.
#1

I know what I wanna do - but I'm not exactly sure on how to do it/start it off.


Basically, I have a table named 'records'.

Inside of my dialog, I need to fetch all records that hold the name of Firstname_Lastname (example), and list it into the dialog.


If anyone can assist, that'll be great.
Reply
#2

I am assuming that you already know how to use mysql functions and list it, so I'll tell the query to select only names with format Firstnmae_Lastname.
This query would do :
PHP код:
SELECT FROM `recordsWHERE `nameRLIKE '[A-Za-z0-9]{1}_[A-Za-z0-9]{1}'
This will select all the names with format Firstname_Lastname, the names like 'Something_' or '_something' will not be selected only names with 'something_something' will be selected.
And note that you will not use '=' operator in this query, you will use RLIKE, RLIKE is use to match regular expressions.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)