MySQL Forums
Forum List  »  Newbie

wildcard question
Posted by: Chris Kay
Date: March 23, 2005 08:31PM

New to mysql. I want to select certain data in a table ive created. The table is called example and has names and ages in it. I want to extract the data with all the people who are in there Twenties. I got some code from a website and rearanged it to suit my needs to get into the database.


$result = mysql_query("SELECT * FROM example WHERE age='2%'")
or die(mysql_error());


// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row
echo $row['name']." - ".$row['age']. "<br />";
}

Like this i cannot see any data. When i change the wildcard in the query to an actual number like 1, it shows the result of the person who is 21.

Why would this happen and how do i go about fixing this proble???


thanks

soianyc

Options: ReplyQuote


Subject
Written By
Posted
wildcard question
March 23, 2005 08:31PM
March 23, 2005 09:38PM
March 23, 2005 09:39PM
March 24, 2005 03:11PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.