Current location: Hot Scripts Forums » Other Discussions » Database » select query issue


select query issue

Reply
  #1 (permalink)  
Old 09-15-09, 08:01 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
select query issue

Hi there.. I got this query in my website.. but I think I made a program fault somewhere...
Is there something wrong in the way I wrote it? Because even when I'm 100% sure there
should be a match nothing shows up in the query..


PHP Code:

if($type == ""){

    
$type "[[:alpha:]]";                                                        
}

if(
$plaats == ""){
    
$plaats "[[:alpha:]]";                                                        
}
                                                                                                    
$trainingenindezecat mysql_query("SELECT * FROM trainingen WHERE                                                             
(soort='
$categorieid') AND  
(plaats REGEXP '
$plaats') AND                                                             
(datum BETWEEN '
$fromdate' AND '$todate') AND 
(type REGEXP '
$type') AND 
(kosten BETWEEN '
$prijsvan' AND '$prijstot')                                                         
ORDER BY type, titel"
) or die(mysql_error()); 
Reply With Quote
  #2 (permalink)  
Old 09-15-09, 09:17 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
I'm not terribly familiar with POSIX regular expressions, but try this:
PHP Code:

'^[a-z0-9]+$' 

... rather than:
PHP Code:

'[[:alpha:]]' 

Also, echo your SQL string to make sure it really contains the expected values.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
mySQL Newbie with nightmare select query (MAX ISSUE) lalapo PHP 4 05-05-06 11:46 AM
code problem throws error matt001 ASP.NET 0 10-23-05 03:30 AM
MySQL SELECT query result dividing ICE Flame PHP 1 06-06-04 02:50 PM
Declared Functions skipper23 PHP 4 12-17-03 10:06 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM


All times are GMT -5. The time now is 05:08 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.