Jump to content

[SOLVED] Using PHP to Create pages


iarp

Recommended Posts

Hey,

 

I finally figured out how to make pages easily editable by storing all the info in a database. Now I'm trying to figure out how to make it so an admin could make a new page. I don't need the coding, if someone could point me in a general direction of where i'd find out how that would be awesome.

 

I don't understand how wordpress and them work when you make a new page... yet it's not physically there. Unless the pages can be accessed by ?p=### then how does one change ?p### to /page-name

Link to comment
https://forums.phpfreaks.com/topic/103603-solved-using-php-to-create-pages/
Share on other sites

simple example:

index.php?page=test

<?php
   $sql = "SELECT `page_content` FROM `pages` WHERE `page_name` = '".$_GET['page']."' LIMIT 1;";
   $res = mysql_query($sql);
   if (mysql_num_rows($res)) {
      $row = mysql_fetch_assoc($res);
      echo $row['page_content'];
   }else echo 'No page found';
?>

 

Beware of SQL-Injections.

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.