Jump to content

Recommended Posts

I need to know the best way to search a long string (under Registrations) that would appear like so '<a href="link.html">ADHS</a>  <a href="link.html">AAPhC</a> <a href="link.html">ASEA</a>' etc. etc.

 

Using PHP MyAdmin's 'Create PHP Code' I tried to start with $query = mysql_query( "SELECT * FROM `horses` WHERE `registrations` LIKE \'%ADHS%\'"); as a starting point, but it does not work when put into my existing code.  I know the code works otherwise, because when I remove everything in the string but ADHS and search specifically for that, it works like a charm.  I am not sure if it just doesn't like 'LIKE'  :confused:

 

Any suggestions?  Hope I made sense!

Link to comment
https://forums.phpfreaks.com/topic/266876-noob-in-need-of-help/
Share on other sites

it does not work when put into my existing code

What exactly does that mean?  Do you receive errors, blank page, incorrect results, what?  You shouldn't be escaping the single quotes in the like clause.  You should also check for errors:

$query = mysql_query( "SELECT * FROM `horses` WHERE `registrations` LIKE '%ADHS%'") or die(mysql_error());

 

You should also post more of the pertinent code.

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.