Hello. I am trying to develop a forum in php but I am facing some problems. If someone can help me please message me to send the files and check it. By the way I am going through this tutorial:
by the way
Hello. I am trying to develop a forum in php but I am facing some problems. If someone can help me please message me to send the files and check it. By the way I am going through this tutorial:
by the way
Please add the link to the tutorial and which error messages you are getting (with the relevant code)
Here is the tutorial:
In the code below categories must show up but this error appears:The categories could not be displayed, please try again later. When I remove this line:WHERE cat_id = " . mysql_real_escape_string($_GET[‘id’]);, categories appears but(see the second code below this code.)
P.S the id inside the $_GET[‘id’] is the <a href=category.php?id at the bottom of the code below
[php]<?php
//create_cat.php
include ‘connect.php’;
include ‘header.php’;
$sql = "SELECT
cat_id,
cat_name,
cat_description
FROM
categories
WHERE
cat_id = " . mysql_real_escape_string($_GET[‘id’]);
$result = mysql_query($sql);
if(!$result)
{
echo ‘The categories could not be displayed, please try again later.’;
}
else
{
if(mysql_num_rows($result) == 0)
{
echo ‘No categories defined yet.’;
}
else
{
//prepare the table
echo ’
Category | Last topic |
---|
Do yourself a favor, throw away that tutorial. I know that tutorial is only four-years old, but mysqli and pretty sure PDO was available at that time. The author of the tutorial should had known better.
Anyways do an internet search (Google search) and search for CMS Forum using Mysqli or CMS Forum using PDO (My Recommendation). —> Or something along that line, but using mysqli or PDO as keywords. Mysql is depreciated and since you want to learn PHP, you might as well learn it right from the start.