ItchysPaws
25-04-2006, 02:57 PM
Ok, ive made the script to add to the rares DB, managed to do it myself :D but upon 'Add to the DB' i get this error:
Unknown mysql command etc. error blah.
The code is
<?
$host = "localhost";
$user = "habbowi_rares";
$pass = "rares";
$db = "habbowi_rares";
mysql_connect( $host, $user, $pass ) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
if($_POST['submit'])
{
//checks to see if the form was submitted.
$name = $_POST['name'];
$desc = $_POST['desc'];
$pict = $_POST['pict'];
$value = $_POST['value'];
$submitted = $_POST['submitted'];
$notes = $_POST['notes'];
$date = date("F jS, Y");
if($name < 0|$entry==NULL)
{
//a feild was left blank!
echo "The Name field was left out, please fill in.";
}
else
{
//No feilds were left blank, we continue..
$query = mysql_query("INSERT INTO rares (name, desc, pict, value, submitted, notes,
date) VALUES('$name', '$desc', '$pict', '$value', '$submitted', '$notes', '$date')") or die(mysql_error());
echo "The DB has successfully been updated.";
}
}
else
// the form was not submitted now we show it.
{
?>
<html>
<head>
<title>Habbo-wide.net - Site Management</title>
<style type="text/css">
BODY {
<!--
body {
SCROLLBAR-ARROW-COLOR: #7F552B;
SCROLLBAR-BASE-COLOR: #ECC547;
SCROLLBAR-FACE-COLOR: #ECC547;
SCROLLBAR-HIGHLIGHT-COLOR: #FFF3B7;
SCROLLBAR-SHADOW-COLOR: #B17038;
SCROLLBAR-3DLIGHT-COLOR: #FFF3B7;
SCROLLBAR-TRACK-COLOR: #C9BDCC;
SCROLLBAR-DARKSHADOW-COLOR: #B17038;
}
-->
</style>
</head>
<body link="#991815" vlink="#991815" alink="#991815" bgcolor="#ECC547" text="#7F552B">
<font face="Verdana" size="1">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%">
<p align="left"><font face="Verdana" size="1"><b><a href="http://www.habbo-wide.net/sitedb" target="_self">Site
Databases</a> > <a href="http://www.habbo-wide.net/sitedb/rares.php" target="_self">Rares</a>
> </b>Adding</font></td>
</tr>
<tr>
<td width="100%">
<p align="center"><font type="Verdana" size="1" face="Verdana"><b>Adding a
Rare</b></font>
</td>
</tr>
</table> </font> <form method="POST">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="11%" align="right">
<p align="right">
<font face="Verdana" size="1">
Name:</font></td>
<td width="89%">
<font face="Verdana" size="1">
<input type="text" size="57" maxlength="25"
name="name"></font></td>
</tr>
<tr>
<td width="11%" align="right">
<font face="Verdana" size="1">
Description:</font></td>
<td width="89%"><font face="Verdana" size="1"><input type="text" size="57" maxlength="25"
name="desc" ></font></td>
</tr>
<tr>
<td width="11%" align="right">
<font face="Verdana" size="1">
Picture:</font></td>
<td width="89%"><font face="Verdana" size="1"><input type="text" size="57" maxlength="25"
name="pict"></font></td>
</tr>
<tr>
<td width="11%" align="right">
<font face="Verdana" size="1">
Rare Value:</font></td>
<td width="89%"><font face="Verdana" size="1"><input type="text" size="3" maxlength="25"
name="value"> CS</font></td>
</tr>
<tr>
<td width="11%" align="right">
<font face="Verdana" size="1">
Submitted by:</font></td>
<td width="89%">
<font face="Verdana" size="1">
<textarea rows="2" name="submitted" cols="48"></textarea></font></td>
</tr>
<font face="Verdana" size="1">
<tr>
<td width="100%" align="right" colspan="2">
<p align="center"><font face="Verdana" size="1">The ID is automactically
assigned upon 'Add to the DB'</font></td>
</font>
</tr>
<font face="Verdana" size="1">
<tr>
<td width="100%" align="right" colspan="2"></td>
</tr>
</font>
<tr>
<td width="100%" align="right" colspan="2">
<p align="center"><b><font face="Verdana" size="2">Staff
Notes; </font></b><font face="Verdana" size="1">Staff dates
must be written in the following format, 3-letter month (Jan,
Feb, Mar), 2-digit day (01-09,10-31), and 4 digit year (2006),
correct date would be 'Apr 24, 2006'</font></td>
</tr>
<font face="Verdana" size="1">
<tr>
<td width="100%" align="right" colspan="2">
<p align="left"><font face="Verdana" size="1"><textarea rows="9" name="notes" cols="80"></textarea></font></td>
</tr>
<tr>
<td width="11%" align="right"></td>
<td width="89%">
<p align="center"><font face="Verdana" size="1"><input name="submit" type="submit" value="Add to the DB">
</td>
</tr>
</table>
</form> </body>
</html>
<?
}
?>
You can see it in action as there isnt an output page atm, to see the error, go to www.habbo-wide.net/rares.php (http://www.habbo-wide.net/rares.php), please note as ssoon as its fixed, link will not work and it will be pw protected.
Unknown mysql command etc. error blah.
The code is
<?
$host = "localhost";
$user = "habbowi_rares";
$pass = "rares";
$db = "habbowi_rares";
mysql_connect( $host, $user, $pass ) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
if($_POST['submit'])
{
//checks to see if the form was submitted.
$name = $_POST['name'];
$desc = $_POST['desc'];
$pict = $_POST['pict'];
$value = $_POST['value'];
$submitted = $_POST['submitted'];
$notes = $_POST['notes'];
$date = date("F jS, Y");
if($name < 0|$entry==NULL)
{
//a feild was left blank!
echo "The Name field was left out, please fill in.";
}
else
{
//No feilds were left blank, we continue..
$query = mysql_query("INSERT INTO rares (name, desc, pict, value, submitted, notes,
date) VALUES('$name', '$desc', '$pict', '$value', '$submitted', '$notes', '$date')") or die(mysql_error());
echo "The DB has successfully been updated.";
}
}
else
// the form was not submitted now we show it.
{
?>
<html>
<head>
<title>Habbo-wide.net - Site Management</title>
<style type="text/css">
BODY {
<!--
body {
SCROLLBAR-ARROW-COLOR: #7F552B;
SCROLLBAR-BASE-COLOR: #ECC547;
SCROLLBAR-FACE-COLOR: #ECC547;
SCROLLBAR-HIGHLIGHT-COLOR: #FFF3B7;
SCROLLBAR-SHADOW-COLOR: #B17038;
SCROLLBAR-3DLIGHT-COLOR: #FFF3B7;
SCROLLBAR-TRACK-COLOR: #C9BDCC;
SCROLLBAR-DARKSHADOW-COLOR: #B17038;
}
-->
</style>
</head>
<body link="#991815" vlink="#991815" alink="#991815" bgcolor="#ECC547" text="#7F552B">
<font face="Verdana" size="1">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%">
<p align="left"><font face="Verdana" size="1"><b><a href="http://www.habbo-wide.net/sitedb" target="_self">Site
Databases</a> > <a href="http://www.habbo-wide.net/sitedb/rares.php" target="_self">Rares</a>
> </b>Adding</font></td>
</tr>
<tr>
<td width="100%">
<p align="center"><font type="Verdana" size="1" face="Verdana"><b>Adding a
Rare</b></font>
</td>
</tr>
</table> </font> <form method="POST">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="11%" align="right">
<p align="right">
<font face="Verdana" size="1">
Name:</font></td>
<td width="89%">
<font face="Verdana" size="1">
<input type="text" size="57" maxlength="25"
name="name"></font></td>
</tr>
<tr>
<td width="11%" align="right">
<font face="Verdana" size="1">
Description:</font></td>
<td width="89%"><font face="Verdana" size="1"><input type="text" size="57" maxlength="25"
name="desc" ></font></td>
</tr>
<tr>
<td width="11%" align="right">
<font face="Verdana" size="1">
Picture:</font></td>
<td width="89%"><font face="Verdana" size="1"><input type="text" size="57" maxlength="25"
name="pict"></font></td>
</tr>
<tr>
<td width="11%" align="right">
<font face="Verdana" size="1">
Rare Value:</font></td>
<td width="89%"><font face="Verdana" size="1"><input type="text" size="3" maxlength="25"
name="value"> CS</font></td>
</tr>
<tr>
<td width="11%" align="right">
<font face="Verdana" size="1">
Submitted by:</font></td>
<td width="89%">
<font face="Verdana" size="1">
<textarea rows="2" name="submitted" cols="48"></textarea></font></td>
</tr>
<font face="Verdana" size="1">
<tr>
<td width="100%" align="right" colspan="2">
<p align="center"><font face="Verdana" size="1">The ID is automactically
assigned upon 'Add to the DB'</font></td>
</font>
</tr>
<font face="Verdana" size="1">
<tr>
<td width="100%" align="right" colspan="2"></td>
</tr>
</font>
<tr>
<td width="100%" align="right" colspan="2">
<p align="center"><b><font face="Verdana" size="2">Staff
Notes; </font></b><font face="Verdana" size="1">Staff dates
must be written in the following format, 3-letter month (Jan,
Feb, Mar), 2-digit day (01-09,10-31), and 4 digit year (2006),
correct date would be 'Apr 24, 2006'</font></td>
</tr>
<font face="Verdana" size="1">
<tr>
<td width="100%" align="right" colspan="2">
<p align="left"><font face="Verdana" size="1"><textarea rows="9" name="notes" cols="80"></textarea></font></td>
</tr>
<tr>
<td width="11%" align="right"></td>
<td width="89%">
<p align="center"><font face="Verdana" size="1"><input name="submit" type="submit" value="Add to the DB">
</td>
</tr>
</table>
</form> </body>
</html>
<?
}
?>
You can see it in action as there isnt an output page atm, to see the error, go to www.habbo-wide.net/rares.php (http://www.habbo-wide.net/rares.php), please note as ssoon as its fixed, link will not work and it will be pw protected.