Jump to content

mysql query - max used as search criteria hangs the server, not MAX the command


skattabrain

Recommended Posts

long time lurker, first time post. this is weird and i appreciate any help or insight on this one.

 

i query my 'parts' database for part numbers ... works great, pretty simple stuff. however, if i use 'max' in my select statement as a search criteria (not as a command) it hangs my server. also, "mx" hangs it as well, and the letter "h" ... i'm sure there are more, but I'm just slot as to what's going on here.

 

here is my query ...

 

$searchthis = $_GET['pn']."%";
$sql = "SELECT * FROM parts, inventory WHERE PartNumber LIKE '".$searchthis."' and inventory.partID = parts.partID";

 

if use ?pn=CV12 as the variable, works fine ... returns the results.

 

if i use ?pn=MAX or ?pn=MX ... it just hangs and makes the server unresponsive.

 

it's a brand new redhat server.

 

funny thing is, on my windows dev box i have apache/mysql set up and this query causes no problems. i'm lost on this ... am i enclosing the criteria correctly? if i echo $sql into the page, the query looks normal -

 

SELECT * FROM parts, inventory WHERE PartNumber LIKE 'CV12%' and inventory.partID = parts.partID

 

any ideas? is the server set up wrong? i'm lost on this one.

What happens when you run the query manually, such as in phpmyadmin?

 

Also are you sure the hang happens during query execution?  Try adding "exit(0);" immediately before the query and run the script, then move it immediately after the query and run the script again.

 

Is your database identical (including indexes) on your dev box and on the live server?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.