shedokan Posted November 29, 2007 Share Posted November 29, 2007 what is the best way to create an article page? I want to get the article id with $_GET thanks. Link to comment https://forums.phpfreaks.com/topic/79341-solved-what-is-the-best-way-to-create-an-article-page/ Share on other sites More sharing options...
marcus Posted November 29, 2007 Share Posted November 29, 2007 # using a mysql db $page = mysql_real_escape_string($_GET['page']); if(!$page){ // index page }else { $sql = "SELECT * FROM `pages` WHERE `url`='{$page}'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "Page does not exist!\n"; }else { $row = mysql_fetch_assoc($res); echo $row['title'] . "<br>" . $row['author'] . "<br><br>" . $row['text']; } } # using flat files $page = stripslashes($_GET['page']); if(!$page){ include "/home/you/public_html/includes/index.inc"; }else { if(file_exists("/home/you/public_html/includes/" . $page . ".inc")){ include "/home/you/public_html/includes/" . $page . ".inc"; }else { include "/home/you/public_html/includes/404.inc"; } } Link to comment https://forums.phpfreaks.com/topic/79341-solved-what-is-the-best-way-to-create-an-article-page/#findComment-401628 Share on other sites More sharing options...
shedokan Posted November 29, 2007 Author Share Posted November 29, 2007 isn't it better to use txt files? and what do you think is better? if mysql wouldn't it be too big for the database to handle? Link to comment https://forums.phpfreaks.com/topic/79341-solved-what-is-the-best-way-to-create-an-article-page/#findComment-401632 Share on other sites More sharing options...
marcus Posted November 29, 2007 Share Posted November 29, 2007 Yeah, I would prefer using include files and such. That way you don't have to go through the struggle of updating a page by going into a database, and yep, the strain would be at a higher max if you used the mySQL way. Link to comment https://forums.phpfreaks.com/topic/79341-solved-what-is-the-best-way-to-create-an-article-page/#findComment-401633 Share on other sites More sharing options...
shedokan Posted November 29, 2007 Author Share Posted November 29, 2007 ok thanks. do you know a good file handing with php guide? Link to comment https://forums.phpfreaks.com/topic/79341-solved-what-is-the-best-way-to-create-an-article-page/#findComment-401647 Share on other sites More sharing options...
marcus Posted November 29, 2007 Share Posted November 29, 2007 There are numerous tutorials out there. Your best chance is Google. Link to comment https://forums.phpfreaks.com/topic/79341-solved-what-is-the-best-way-to-create-an-article-page/#findComment-401654 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.