Jump to content

Using Like %...% [help please]


facebookappguru

Recommended Posts

ok, finding this pretty hard  :(

 

i have a database of famous birthdays which i bought. its layout is like this :

 

INSERT INTO `birthdays` (`ID`, `birthday`, `Name`) VALUES

(1, '1449-01-01', 'Lorenzo de''Medici, (The Magnificent) of Florence'),

(2, '1481-01-01', 'Huldrych Zwingli, Swiss Protestant reformer'),

(3, '1735-01-01', 'Paul Revere, US patriot and The British are coming'),

 

Problem is, the way i want to search the database is by searching on the date you were born, eg 12th may,

 

so i tried

 

$sql = "SELECT * FROM `birthdays` WHERE `birthday` LIKE \'%05-12%\' LIMIT 0, 10 ";

 

$result = mysql_query($sql) or die(mysql_error());

 

while($row = mysql_fetch_array($result)){

 

  echo 'you share your birthday with ' .$row["name"]. '';

 

 

But then nothing shows, Help please :(

Link to comment
Share on other sites

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.