Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!empty($_GET['id'])){
- //DB details
- $host="localhost";
- $db_user ="root";
- $db_password="";
- $db_name="exampledatabase";
- //Create connection and select DB
- $connection= @new mysqli($host, $db_user, $db_password, $db_name);
- if ($connection->connect_error) {
- die("Unable to connect database: " . $connection->connect_error);
- }
- //get content from database
- $query = $connection->query("SELECT * FROM cms_content WHERE id = {$_GET['id']}");
- if($query->num_rows > 0){
- $cmsData = $query->fetch_assoc();
- echo '<h4>'.$cmsData['title'].'</h4>';
- echo '<p>'.$cmsData['content'].'</p>';
- echo '<p>'.$cmsData['price'].'</p>';
- echo '<p>'.$cmsData['id'].'</p>';
- }else{
- echo 'Content not found....';
- }
- }else{
- echo 'Content not found....';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement