Click here to Skip to main content
15,918,108 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to get the article_title based on article name


For example in my article table,one article name have 4 article titles.How can i get that 4 article titles and how to display on to the browser.
Posted
Updated 25-Apr-12 20:51pm
v2
Comments
Mohibur Rashid 26-Apr-12 1:26am    
Come on Deepthi, try understand, for past few days we are trying to say is try to something by yourself. we cant tell you how your table look like and how they are organized. its also not possible to answer question like this. do something first then ask what problem you are facing
DeepthiTanguturi 26-Apr-12 2:52am    
Actually on that i was confused.That's y i typed like that.Sorry for that

1 solution

You will use the following syntax;
PHP
mysql_connect("database_server", "username", "password");
mysql_select_db("database_name");

$sql = "SELECT article_title FROM table_name WHERE article_name = 'article_name';
$result = mysql_query($sql);
$count = mysql_num_rows($result);
if($count != 0){
    while($row = mysql_fetch_assoc($result)){
        echo $row['article_title']."\n";
        next($row);
    }
}
else{
    echo "Sorry, you do not have any articles under that article name";
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900