Unstoppable Domains

Help

Spaceship Spaceship
Watch

Marty Rogers

Account Closed
Impact
3
Hi,

Just wondering if anybody can help me, im doing a simple search feature on my new website and i have a column called type and i have entered MySpace Codes and MyCrib Codes in these for some of my row entries, i want visitors to be able to search just the myspace codes entries, i don't want any mycrib code entries to come up when searching.

I had this originally for my search:

SELECT * FROM codes WHERE name LIKE '%$name%'

Then tried changing it too:

$query = "SELECT * FROM codes WHERE type = 'MySpace Codes' AND name LIKE '%$name%'"

I also tried adding WHERE after AND but still no luck. Can anyone help me with this?

:)
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
We'd probably have to see your database table structure to tell you...
 
0
•••
Type and/or name could be reserved keywords. That might be your problem.
/me tries to find the reserved keywords page.

edit: http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html
So they aren't reserved.

Is it showing an error or saying anything that could give us a clue on what's wrong?
 
0
•••
Last edited:
0
•••
If you try:

$query = "SELECT * FROM `codes` WHERE `type`='MySpace Codes' AND `name` LIKE '%$name%'"

does it make any difference?
 
0
•••
I just changed it to that, but it's still doing the same thing - saying it can't find any results =S eek. It's getting annoying now :[ lol.
 
0
•••
Like I said earlier, we really need to see your DB table structure. Some copy and pasted error messages wouldn't hurt, either...
 
0
•••
Ok, I'll have another (unsure!) stab at:

$query = "SELECT * FROM `codes` WHERE `type`='MySpace%20Codes' AND `name` LIKE '%$name%'"

But as mentioned by TwistMyArm, seeing the DB table structure would help. Or simply change the type to an integer, e.g. 1 = MySpace Codes, 2 = MyCrib Codes and search for WHERE `type`='1' etc

Hope this helps,

Craig
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back