Jump to content

Problem with CMS, again


Bojan86

Recommended Posts

I'm going crazy over this bulls*it!  :facewall: :facewall: :facewall: Now, tutorials.php doesn't works... It shows some of data, but not all of it (category, views, content...) Please, help me! Here's code!

<?php

//Getting the file db.php which includes our database settings.
define( 'DB_PATH'  , "./" );
require DB_PATH."db.php";


//Setting up a variable to request the category which is in the URL
$request_cat = isset($_REQUEST['category']) ? $_REQUEST['category'] : '';


//Displaying an actual tutorial
if (isset($_GET['id'])) {

// Updating the views, and grabbing a tutorial based on what id it has.
$update = mysql_query("UPDATE $mysql_table SET views = views + 1
WHERE id='{$_GET['id']}'");
$result = mysql_query("SELECT * FROM $mysql_table
WHERE id='{$_GET['id']}'");
while($row = mysql_fetch_array($result)){

  // Template for the tutorial
  echo "
  <table width='400' border='0' cellspacing='0' cellpadding='0'>
<tr>
  <td width='400'>
<table width='400' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td><table width='400' border='0' cellspacing='0' cellpadding='0'>
    <tr>
      <td width='275'><div align='left'><strong>
<a href='tutorials.php?category=".$row['category']."&id=".$row['id']."
'>".$row['title']."</a>
</strong></div></td>
      <td width='125'><div align='right'>
[ Views: ".$row['views']." ]</div></td>
    </tr>
      </table></td>
    </tr>
<tr>
<td><div align='left'>Description: ".$row['description']."</div></td>
    </tr>
<tr>
<td><div align='left'>".$row['content']."</div></td>
    </tr>
<tr>
<td><div align='left'>
    <table width='400' border='0' cellspacing='0' cellpadding='0'>
      <tr>
      <td width='150'><div align='left'>Added: ".$row['date']."</div>
</td>
  <td><div align='right'>Author:
<a href='mailto:".$row['email']."'
>".$row['author']."</a> </div></td>
      </tr>
    </table>
      </div></td>
    </tr>
<tr>
  <td><div align='left'>Category:
<a href='tutorials.php?category=".$row['category']."
>".$row['category']."</a> </div></td>
    </tr>
  </table></td>
    </tr>
  </table>
  "; // End of template of tutorial
} // End of grabbing data
  exit(); // Stopping anything below from interfearing with this sectiom
} // End of Displaying an actual tutorial


//Displaying tutorials in a cateogry.
if (isset($_GET['category']) && $_GET['category'] == $request_cat) {

//Grabbing information from the database.
$result = mysql_query("SELECT * from $mysql_table
where category = '{$_GET['category']}' ORDER BY ID DESC");
while($row = mysql_fetch_array($result)) {

  //Template for the tutorials in a category.
  echo "
  <table width='400'  border='0' cellspacing='0' cellpadding='0'>
<tr>
  <td width='100' align='center' valign='middle'><div align='center'>
<a href='tutorials.php?category=".$row['category']."&id=".$row['id']."'>
<img src='".$row['avatar']."' alt='".$row['title']."'  title='".$row['title']."'
width='90' height='60' border='0'></a>
</div></td>
  <td width='300'>
<table width='100%'  border='0' cellspacing='0' cellpadding='0'>
    <tr>
<td>
<div align='center'><strong>".$row['title']."</strong></div></td>
    </tr>
    <tr>
<td>
<div align='left'>Description: ".$row['description']."</div></td>
    </tr>
    <tr>
<td>
<table width='100%'  border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><div align='left'>Added: ".$row['date']."</div></td>
    <td><div align='left'>Category:
<a href='tutorials.php?category=".$row['category']."
>".$row['category']."</a></div></td>
    </tr>
    </table></td>
    </tr>
    <tr>
<td><table width='100%'  border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td width='175'><div align='left'>Author:
<a href='mailto:".$row['email']."'>".$row['author']."</a></div></td>
    <td width='100'><div align='left'>Views: ".$row['views']."</div></td>
      </tr>
    </table></td>
    </tr>
  </table></td>
    </tr>
  </table><br>
  "; // End of Template for the tutorials in a category.
} // End of grabbing information from database.
} // End of Displaying tutorials in a cateogry.


// Main Tutorial page.  This is where all your categories will be listed.
if (!isset($_GET['category'])) {

//This makes a list of all the cateogries that are in the database!  No need to make the links yourself!
$result = mysql_query("SELECT DISTINCT category from $mysql_table ");
while($row = mysql_fetch_array($result)) {

  // Showing all the categories
  echo "
  <a href='tutorials.php?category=".$row['category']."'
>".$row['category']."</a><br>
  "; // End of showing all the categories
} // End of grabbing unique categories in database
}// End of main tutorial page

?>

Link to comment
Share on other sites

tutorial.php has errors. Change lines 61 - 62 to

<a href='tutorials.php?category=".$row['category']."'>".$row['category']."</a> </div></td>

 

Change 105 - 106 to

<a href='tutorials.php?category=".$row['category']."'>".$row['category']."</a></div></td>

Link to comment
Share on other sites

I'm sorry if I bored you with this s*it... Believe me, I would be more than happy if I don't have to do this... Anyway, now it shows category, I will delete views from code and mysql, so it won't be a problem anymore, but it still doesn't show content, and it's most important... So please, help me... I'm so close to shift+del everything...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.