Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: mySQL/PHP error

  1. #1

    Default mySQL/PHP error

    Ok, ive made the script to add to the rares DB, managed to do it myself but upon 'Add to the DB' i get this error:
    Unknown mysql command etc. error blah.

    The code is
    PHP Code:
    <?
    $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> &gt; <a href="http://www.habbo-wide.net/sitedb/rares.php" target="_self">Rares</a>
          &gt; </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, please note as ssoon as its fixed, link will not work and it will be pw protected.

  2. #2
    Join Date
    Feb 2006
    Location
    Coventry
    Posts
    2,096
    Tokens
    0

    Latest Awards:

    Default

    Means your sql is wrong =]

  3. #3

    Default

    I know, but the thing is i dont know which bit.

  4. #4
    Join Date
    Feb 2006
    Location
    Coventry
    Posts
    2,096
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by ItchysPaws
    I know, but the thing is i dont know which bit.
    tell me the tables you want and ill make you a sql code "/

  5. #5
    Join Date
    Nov 2005
    Posts
    807
    Tokens
    1,335

    Latest Awards:

    Default

    Why use mySQL for such as simple task "/ might as well just write it to a flat file db.. its alot easier..

  6. #6

    Default

    I've made all the tables , its just it wont write to them for some reason?

  7. #7

    Default

    Sorry this is a double post but I really need help guys

  8. #8
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    It might actaully help if you tell us the FULL error.

  9. #9

    Default

    You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc, pict, value, submitted, notes, date) VALUES('test', 'test

  10. #10
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Check your SQL then.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •