Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 12th, 2004, 09:58 AM
Registered User
 
Join Date: Sep 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Searching trough a database

Can anyone tell me wheter the LIKE statement in selecting database info from a db, is Case Sensitive?

If so: is there a way around that? (for instance i have lower case entrys and someone searches using uppper case?)

Second question.

I want to display links to a site but when there is no link avaialable there will be a message stating: "no link at this point"
I want these links also available as a hyperlink but how can i check wheter the link field contains a url or just a string saying there is no url available.
because this probably won't work:
<a href="no link at this point">no link at this point</a> ;)

Thanx in advance

Rogier


 
Old September 15th, 2004, 05:28 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

No, it isn't case sensitive. The easiest way to figure this out on your own is to write a lowercase test query that searches results that you know are in uppercase.

If there isn't a link to display, you shouldn't wrap it in link tags, that's just confusing. If the link is stored in a database, instead of storing the text "no link at this point" it would be better to just make the field NULL and test the value for NULL. Then no storage space is being wasted in the database.

Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
 
Old September 25th, 2004, 09:17 AM
Registered User
 
Join Date: Sep 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanx a lot for your reply.

I indeed found out about the case sensitivity(could have done it myself).

And the idea of letting the link tag be NULL if it is empty is also a good idea. (i will include an if statement which will replace the NULL by the string "no link at this point yet").

The problem is that i've already filled my db with over 200 entry's and i was not planning on changing them manually. but of course i could also do this with a simple script.

Thanx a lot!

rogier






Similar Threads
Thread Thread Starter Forum Replies Last Post
searching a database mark jonas MySQL 13 January 19th, 2007 10:01 AM
Searching through a database d5t ASP.NET 1.0 and 1.1 Basics 6 October 27th, 2006 07:10 AM
Accessing sql server database trough vbs file vc1 VBScript 6 February 18th, 2005 09:54 AM
Searching the database...HELP! Zedman BOOK: Beginning ASP 3.0 6 September 30th, 2004 09:52 AM
searching a database shabazzk Classic ASP Databases 2 March 10th, 2004 06:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.