Jump to content

SQL not working


The Little Guy

Recommended Posts

Prima facie, nothing appears wrong, syntactically.

 

You need to give more diagnostic information.  Try checking for error codes returned after attempting to execute this query.  Are you sure $pass contains what you want it to contain and is being parsed correctly?  What is your table structure?  Etc, etc, etc.

Link to comment
Share on other sites

Here is the Table I am using

I changed the name of the word column to wrd (it didn't do anything).

I changed the name of the table from common_words to cwords

 

This code runs error free, but doesn't return results.

The first one is the table structure, and the second is the SQL query in action.

If you compaire the two, I used Aaron, for the SQL (img 2), and Aaron is in the database (img 1).

 

[attachment deleted by admin]

Link to comment
Share on other sites

Okay, that is weird.  The only thing that comes to mind is that there might be some trailing whitespace in the 'wrd' column.  I.e., maybe instead of "Aaron" it's actually "Aaron  " or "Aaron\n" or something so MySQL won't match with the equal sign.  You could try some other query like "...WHERE wrd RLIKE 'Aaron'" or "...wrd LIKE 'Aaron%'".  Depending on how you inserted your dictionary into the database, that might be a possibility.

 

(I'm not familiar with PHPMySQLAdmin, so I don't know what caveats/trouble might be related to that.)

Link to comment
Share on other sites

Using the % will kill efficiency though, if your table is large.  Particularly if you have it at the start.  If you exploded with \n, it's possible you have a dos format file, and so you have a hidden \r in every string in your database.  You can try using some of the string length and substring functions in mysql to investigate further.

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.