Discussion » Bastard Php / Mysql Stuff

This is a read-only copy. The forum ran on iamcal.com from 2000 until its database was lost in 2016, and this topic was rebuilt from copies saved by the Internet Archive's Wayback Machine. Some replies may be missing.
Posted by Grim..., 15:56, 9th December 2002:
 
Right.

$result = mysql_query( "SELECT * FROM tblinfo WHERE strArticle='$search'" );

Gets all the rows from my database where strArticle = $search.

So why doesn't:

$result = mysql_query( "SELECT * FROM tblinfo WHERE strArticle=*.'$search'.*" );

return all the rows that include the $search string? How do I put a wildcard character into that? I have tried everything I can think of and nothing works =[

Or am I going about it the wrong way? Is there an 'includes' rather than 'equals' operator?
Posted by ilovebeerme, 15:58, 9th December 2002:
 
you know computers
Posted by Grim..., 16:03, 9th December 2002:
 
Not well enough, unfortunatly...
Posted by Emperor, 16:10, 9th December 2002:
 
You are close but you need LIKE '%$search%' see:

www.mysql.com/doc/en/String_comparison_f...

This might also be of interest:

www.mysql.com/doc/en/Fulltext_Search.htm...
Posted by Grim..., 16:25, 9th December 2002:
 
Cheers.
Posted by Grim..., 16:38, 9th December 2002:
 
The full text search suggest that:

$result = mysql_query( "SELECT * FROM tblinfo WHERE MATCH strArticle AGAINST ('$search')" );

should do the trick, but it doesn't =[
Posted by Emperor, 16:43, 9th December 2002:
 
I've not used MATCH AGAINST before (I stumbled across it while looking for the manual page on LIKE) but I will certainly be looking at it in the future ;) Good luck with it and let us know how it goes.

I should also correct myself a little as you need quotes here:

LIKE "%$search%"
Posted by Emperor, 16:48, 9th December 2002:
 
Jusr reading through the fulltext search entry it can only be used on certain field types and you need to either run FULLTEXT when you CREATE the table or you need to ALTER an existing one. Check both those as they could cause you problems.

Hopefully the LIKE solution should be sufficient for your needs ;)
Posted by Grim..., 16:48, 9th December 2002:
 
For those interested, here is that solution in full:

$result = mysql_query( "SELECT * FROM tblinfo WHERE strArticle LIKE '%$search%'" );

Thanks, Emperor.
Posted by Grim..., 16:49, 9th December 2002:
 
Who are you, by the way?
Posted by ilovebeerme, 16:53, 9th December 2002:
 
Just your friendly neighbourhood spiderman
Posted by Emperor, 17:02, 9th December 2002:
 
Me or ilovebeerme?
Posted by Emperor, 17:06, 9th December 2002:
 
He is your friendly neighbourhood spiderman or so I hear (and is a close friend of iluvsmerkingtabsme?).
Posted by cal, 17:10, 9th December 2002:
 
if you're using phpMyAdmin then making FULLTEXT indexes is pretty easy
Posted by Grim..., 17:12, 9th December 2002:
 
You, Emp - This is the first time you've posted, or so I belive...
Posted by Emperor, 17:43, 9th December 2002:
 
Yes it is - I was passing through and having a nose around and spotted your post so called in ;)

I'm from the OzoneAsylum/Gurus Network where I know DarkGarden/Peter (I'm not sure what name he goes by here) and stuff (I'm not too hot on talking about me ;) ).

I have been looking at Puse and other things - I scooped up a few links and added them to a links database we are working and created a iamcal node too:

development.gurusnetwork.com/links/373/d...

which is nice.
Posted by cal, 17:50, 9th December 2002:
 
peter is peter here, but hasn't posted since 4th March 2002
Posted by Emperor, 17:52, 9th December 2002:
 
He is slack ;) He has been pretty quiet at the Asylum too.
Posted by Emperor, 18:07, 9th December 2002:
 
We were discussing you (cal) on ICQ (all good stuff of course) and so (although I've passed through your site rooting out information on various things) I thought it was time to have a rummage around here and a peer into all the corners and such like.
Posted by Emperor, 19:56, 9th December 2002:
 
As an aisde I also dropped this into an FAQ here:

faq.ozoneasylum.com/991/

and so any further information that arises on this will be dropped in there 9at the moment it pretty much says the same as my reply ;) ).
Posted by cal, 20:24, 9th December 2002:
 
a useful resource :)

as are the mysql (www.mysql.com) and php (uk.php.net) manuals
Posted by November Eclectica, 21:41, 9th December 2002:
 
Welcome Emperor.
Posted by reitsma, 22:07, 9th December 2002:
 
welcome emprah - quite a suprise to see you here.

...yet it is no suprise that from the very first post, you're being useful.

:o)
Posted by cal, 22:50, 9th December 2002:
 
are you an ozones person reitsma?
Posted by Emperor, 01:05, 10th December 2002:
 
Novemeber: ~waves~

cal: Thanks - the FAQ is a Wiki so all registered inmates can add and edit entries (its an interesting project). Gotta love the manuals :)

reitsma: Nice to see a familiar face :D I always believe i hitting the ground running. And cal he isn't just an ozones person he is at least 3 (having been bunchapixels and thirdperson in the past) ;)
Posted by Victor Menendez, 08:43, 10th December 2002:
 
Hail Emperor!
Posted by carbonite, 17:04, 10th December 2002:
 
oooo I found an interesting t-shirt that you guys and gals might enjoy....

www.thinkgeek.com/tshirts/coder/595d/

I chuckled at that when I saw it, my Information Systems and Database Design lecturer however didn't after seeing the results of our in-class test the other day......oh dear =D


-Greg-
Posted by Grim..., 17:09, 10th December 2002:
 
If you are bored then the GrimForum is coming along nicely - maybe you'd like to take a look:
www.hsmx.com/grimforum/
Posted by Grim..., 17:18, 10th December 2002:
 
Peter probably went elsewhere after he saw how mean Cal was to Suzie...

www.iamcal.com/topic.php?id=1123#post707...
Posted by cal, 20:20, 10th December 2002:
 
part of a fun ongoing series of arguments between me and our ex-chat-host :/
Posted by reitsma, 22:21, 10th December 2002:
 
cal - emperor speaks the truth.

the id's that i had there were:

bunchapixels (my first identity)
bunchapissedoffpixels (when i had to flame someone)
thirdperson (alterego, when i was sick of buncha)

...and finally:
reitsma (the one i use all the time now.)

that was where i met peter, was introduced to pixelflo, heard about you, met stephen, went to miscminutiae, and clicked from there to iamcal.com

...and that's my story.
Posted by cal, 15:39, 11th December 2002:
 
ahh. that must have been quite a while ago now - you've been around here for quite a while...
Posted by reitsma, 06:15, 12th December 2002:
 
yes yes, i have.
Posted by Emperor, 03:36, 13th December 2002:
 
I believe Peter is doing fun things in the real world - big place somewhere 'out there' (but not where the truth is). I told him I was taking his name in vain (pos. vein ;) ) and he seemed fine with that - which is disappointing.

Grim: interesting are you coding that from the grond up - big effort but pos. worth it in the end.

carbonite: Love the T-shirts there are some days..........