Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP CODE DOES NOT DELETE ROWS USING EREG 1

Status
Not open for further replies.

coldbohemia

Programmer
Jun 5, 2008
30
US
THIS LINE OF PHP CODE IS SUPPOSED TO DELETE ANY ROWS
THAT DO NOT CONTAIN AT LEAST 1 ALPHABETIC CHARACTER
THE FIELD 'GENERIC_ROW' IS A CHAR(100) FIELD

$query="delete from temptables.rfile_temp
where ereg([a-zA-Z]+, temptables.rfile_temp.generic_row) = '0' " ;

I ALSO TRIED "NOT EREG" AND THIS DOES NOTHING ALSO

THANKS IN ADVANCE







 
ereg is a PHP function, it does not work inside a query like that, because the query is executed in the database which has no knowledge of PHP fucntions or what to do with them.
To the DB that just is a long weird string that has no meaning.

Assuming you are using MYSQL, you can however use the regexp alternative, however that would now be a MYSQL question and as such falls outside the scope of this forum.

You can try forum436 for help on using regexp in MYSQL.

Or the forum for whichever database you are using.


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top