Buy Sell Discuss UK Domain Names at AcornDomains.co.uk

Today's Drop Dates are: 07-11-2011 or 14-11-2011   All times are GMT. The time now is 07:24:52 PM.
Domain Name Sales Domain Software Calculate UK Domain Drop Dates Domain Registration NameDrive Domain Parking Subscribe to our Domains For Sale newsletter
Go Back   Domain Forum Acorn Domains Buy Sell Auction UK Domains > Website Design and Promotion > Website Design > Scripts and Coding
Connect with Facebook

Scripts and Coding PHP, MySQL, scripts

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 05-02-2009, 02:55:02 PM     #1 (permalink)

 
woopwoop's Avatar
 
Join Date: Jan 2007
Posts: 1,483
woopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond repute

php mysql select query question

Is it possible to select a row with name = "bob's chocolates" when the variable you have is "bobs-chocolates"

my issue isn't the hyphen (which I can do the preg_replace() )
but is the ' which has already been stripped and I don't know where to insert it to get a 100% match ?

I know that when I'm selecting all names that begin with the same letter I use LIKE:

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

Is there a similar query that will negate apostrophes or other characters?
woopwoop is offline  
Old 05-02-2009, 03:12:54 PM     #2 (permalink)

 
woopwoop's Avatar
 
Join Date: Jan 2007
Posts: 1,483
woopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond repute

Think I've figured it out:

SELECT name WHERE replace(name,'''','') = 'bobs chocolates'
woopwoop is offline  
Old 05-02-2009, 10:50:18 PM     #3 (permalink)

 
Skinner's Avatar
 
Join Date: Jul 2008
Location: Manchester
Posts: 2,501
Skinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond repute

You would be better looking into Full Text searches bud than running replaces

MySQL :: MySQL 5.1 Reference Manual :: 11.8 Full-Text Search Functions
__________________
Browse:
Skinner is offline  
Old 05-02-2009, 11:45:58 PM     #4 (permalink)

 
woopwoop's Avatar
 
Join Date: Jan 2007
Posts: 1,483
woopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond repute

skinner you're like a walking php phrasebook. I'll take a look at the link. Thanks.
woopwoop is offline  
Old 06-02-2009, 12:19:10 AM     #5 (permalink)

 
Skinner's Avatar
 
Join Date: Jul 2008
Location: Manchester
Posts: 2,501
Skinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond repute

Pay special attention to things like Soundex

You'll pick all these things up

Just wait until your left broken and deflated because you missed a " or ' or ; or } or ) somewhere in the code and you stare at it for 3 days and are unable to see it, you'll soon realise that remembering stuff like this is easy :P
__________________
Browse:
Skinner is offline  
Old 06-02-2009, 01:50:39 AM     #6 (permalink)

 
woopwoop's Avatar
 
Join Date: Jan 2007
Posts: 1,483
woopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond reputewoopwoop has a reputation beyond repute

I'm usually pretty quick at the ,{; problems

Probably because my projects are often small and I check small code changes religiously - so I can rollback the last change.

I'm really excited about my current project though - the one that you've helping me out a bit on. Will probably post it on Acorn for appraisal and ideas in the next day or 2.
woopwoop is offline  
Old 06-02-2009, 02:03:49 AM     #7 (permalink)

 
Skinner's Avatar
 
Join Date: Jul 2008
Location: Manchester
Posts: 2,501
Skinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond repute

I try to include global debug variables.

randomly insert

if($debug==1){ ehco "debug X routine, value: $var";}

Then at the top of my script I have $debug=0;

That way when something goes wrong I can see where it went wrong very quickly, but other people don't want stuff like that in their code they want lean fast code so I have to take all the debug stuff out before I deliver it, then when I get 1000 lines of code back for updates I'm screwed if they have modded it as well :P

The last project I'm working on that I may post on here, is the one I'm usin for the 'For Sale' links in my sig which the core program I posted http://www.acorndomains.co.uk/genera...page-vs-2.html you can see the debug code there.

That took me a few hours to put together
__________________
Browse:
Skinner is offline  
Closed Thread



Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Domain Name Community Replies Last Post
php query woopwoop Scripts and Coding 2 28-12-2008 06:39:35 PM
Quick PHP Question GreyWing Scripts and Coding 4 30-10-2008 03:09:53 PM




All times are GMT. The time now is 07:24:52 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.0 RC 2
All content on Acorn Domains is member generated and is not moderated before posting. All content is viewed and used by you at your own risk and AD does not warrant the accuracy or reliability of any of the information. The views expressed are those of the individual contributors and not necessarily those of AD. Please contact us to report any issues or send a PM to "Admin".