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
https://forums.phpfreaks.com/topic/196218-using-like-help-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.