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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.