Link to home
Start Free TrialLog in
Avatar of Robert Granlund
Robert GranlundFlag for United States of America

asked on

PHP Query

I'm trying to write a query that uses RegEx but I'm not sure I know what I should be doing here.  One of the fields I am querying has numbers and words in it.  I want to only query the numbers.
		$laser_query = ee()->db->query(
		SELECT t1.entry_id AS id, t1.field_id_1091 AS title, t1.field_id_1141 AS image, t2.url_title AS url_title
		FROM exp_channel_data t1, exp_channel_titles t2 
		WHERE (t1.field_id_3731 = $cw || t1.field_id_3731 = $pulsed || t1.field_id_3731 = $pulsednp || t1.field_id_3731 = $quasi || t1.field_id_3731 = $ultrafastfp || t1.field_id_3731 = $ultrafastf)
		AND t1.field_id_3781 <= $wave_max REGEXP '/[^0-9]/'
		AND t1.field_id_3781 >= $wave_max REGEXP '/[^0-9]/');

		
		$lb = $laser_query->result_array();
		
		foreach($lb as $row){

Open in new window

Avatar of Dan Craciun
Dan Craciun
Flag of Romania image

What does "has numbers and words in it" mean.

It's like this:
123 word word
word 123 word

Or like this

1 word 234 word 45 ?

If the second option, you want the first number, a number from all the figures, the sum of the numbers, etc?
ASKER CERTIFIED SOLUTION
Avatar of Dan Craciun
Dan Craciun
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial