UbH Posted April 8, 2008 Share Posted April 8, 2008 Hi everyone, I am trying to create a single main.php page that has 5 dynamic navigation links that will pull content from MySQL and instead of creating 5 different static pages with content. Problem is I learn from example and cant seem to find any simple code out on the web that will show me how to execute dynamic URLs that pull content from MySQL into my main.php page. Seem search engines are flooded with SEO awareness and turning dynamic urls into static urls instead of providing me with a tutorial on how to make dynamic URLs. Anyone know of a good tutorial or could point me to a snip of code that can show me how to preforms this? Thanks. UbH Link to comment https://forums.phpfreaks.com/topic/100206-solved-php-mysql-dynamic-urls/ Share on other sites More sharing options...
soycharliente Posted April 8, 2008 Share Posted April 8, 2008 Example database structure: pages -------- id text Basic example of how to setup page: <html> <body> <a href="index.php?id=1">Home</a> <a href="index.php?id=2">About</a> <a href="index.php?id=3">Contact</a> <?php $page = $_GET['id']; $sql = "SELECT * FROM `pages` WHERE `id`='$page'"; $result = mysql_query($sql) OR DIE (mysql_error()); if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); echo "<p>{$row['text']}</p>"; } else { header("Location four04.php"); exit; } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/100206-solved-php-mysql-dynamic-urls/#findComment-512376 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.