Username:
Password:
Remember me:
Register

Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)


Search forums via Google


0 Users appreciate this thread.

...
Started by HerobrineLuka
(2013-02-12 11:42:04)
HerobrineLuka (2013-02-12 11:42:04)
<?php
//This page let create a new category
include('config.php';
if(isset($_SESSION['username']) and $_SESSION['username']==$admin)
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" />
<title>New Category - Forum</title>
</head>
<body>
<div class="header">
<a href="<?php echo $url_home; ?>"><img src="<?php echo $design; ?>/images/logo.png" alt="Forum" /></a>
</div>
<div class="content">
<?php
$nb_new_pm = mysql_fetch_array(mysql_query('select count(*) as nb_new_pm from pm where ((user1="'.$_SESSION['userid'].'" and user1read="no" or (user2="'.$_SESSION['userid'].'" and user2read="no") and id2="1"');
$nb_new_pm = $nb_new_pm['nb_new_pm'];
?>
<div class="box">
<div class="box_left">
<a href="<?php echo $url_home; ?>">Forum Index</a> &gt; New Category
</div>
<div class="box_right">
<a href="list_pm.php">Your messages(<?php echo $nb_new_pm; ?></a> - <a href="profile.php?id=<?php echo $_SESSION['userid']; ?>"><?php echo htmlentities($_SESSION['username'], ENT_QUOTES, 'UTF-8'; ?></a> (<a href="login.php">Logout</a>
</div>
<div class="clean"></div>
</div>
<?php
if(isset($_POST['name'], $_POST['description']) and $_POST['name']!=''
{
$name = $_POST['name'];
$description = $_POST['description'];
if(get_magic_quotes_gpc())
{
$name = stripslashes($name);
$description = stripslashes($description);
}
$name = mysql_real_escape_string($name);
$description = mysql_real_escape_string($description);
if(mysql_query('insert into categories (id, name, description, position) select ifnull(max(id), 0)+1, "'.$name.'", "'.$description.'", count(id)+1 from categories')
{
?>
<div class="message">The category have successfully been created.<br />
<a href="<?php echo $url_home; ?>">Go to the forum index</a></div>
<?php
}
else
{
echo 'An error occured while creating the category.';
}
}
else
{
?>
<form action="new_category.php" method="post">
<label for="name">Name</label><input type="text" name="name" id="name" /><br />
<label for="description">Description</label>html enabled)<br />
<textarea name="description" id="description" cols="70" rows="6"></textarea><br />
<input type="submit" value="Create" />
</form>
<?php
}
?>
</div>
<div class="foot"><a href="http://www.webestools.com/scripts_tutorials-code-source-26-simple-php-forum-script-php-forum-easy-simple-script-code-download-free-php-forum-mysql.html">Simple PHP Forum Script</a> - <a href="http://www.webestools.com/">Webestools</a></div>
</body>
</html>
<?php
}
else
{
echo '<h2>You must be logged as an administrator to access this page: <a href="login.php">Login</a> - <a href="signup.php">Sign Up</a></h2>';
}
?>





and it came up with this error


An error occured while creating the category.
Want to stalk me?
Join the Autonic Steam group! Members: 400+

My youtube channel! Subscriber Goal: 1102/10000
(Capt.)Orb (2013-02-12 13:07:05)
Again.did you create the table pm with the required?


Do you even understand that code?

No offense, but there's no point using a script from a tutorial if you don't understand it.

A tutorial is supposed to help you understand different codes.


Not just to do the lazy way and copy the code,no offense btw.

This post has been edited one or more times, the last time was:
2013-02-12 13:08:56

Aviation fact: The a380 is the largest commerical aircraft in service!

Go to Splashiverse! Splashiverse
HerobrineLuka (2013-02-12 13:31:40)
I got the error because something was wrong on my categories table I deleted it and remade it and it worked
Want to stalk me?
Join the Autonic Steam group! Members: 400+

My youtube channel! Subscriber Goal: 1102/10000
 

This topic is closed, so you can not post a comment.

This topic's ID: 41664

Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)




Total registered users: 8321
New registered users today: 7
Newest registered user: ElegantVulpes

©  Copyright 2026 3DSPlaza. All Rights Reserved