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 2 of 2 FirstFirst 12
Results 11 to 19 of 19
  1. #11
    Join Date
    Apr 2007
    Location
    england
    Posts
    536
    Tokens
    0

    Default

    Thanks, but I don't understand how I can get the comment ID?


    Selling DJ/Habbo layout, more info here.


  2. #12
    Join Date
    Apr 2007
    Location
    england
    Posts
    536
    Tokens
    0

    Default

    I can't edit, please merge.

    select comment from comments where id = '$id'
    If my database table was petitio, would I replace comment or comments with petition? I'm pretty sure i'd replace comments but I want to double check.

    And, I would really appreciate if someone could tell me how to get the ID, as this is the only thing holding me back now.
    Last edited by adamFTW; 12-12-2007 at 02:29 AM.


    Selling DJ/Habbo layout, more info here.


  3. #13
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    Add a new field to your database, make it a primary key and auto-increment.

    Then do

    PHP Code:
    <?php
    $get_id 
    mysql_fetch_array(mysql_query("select id from comments"));
    $id $get_id[id];
    ?>
    And im presuming your using a while loop to display comments, so it should be in that..
    Coming and going...
    Highers are getting the better of me

  4. #14
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Of course it is possible. Not very clean code, not on my PHPDesigner computer.

    PHP Code:
    <?php
    include "config.php";
     
    $get_query mysql_query("SELECT * FROM table ORDER BY id DESC");
    while(
    $row mysql_fetch_array($get_query)) {
     
    $field $row["field"];
    $id $row["id"];
     
    echo 
    "$field - <a href=\"edit.php?id=$id\">Edit</a>";
     
    }
    ?>
    Then edit.php:


    PHP Code:
    <?php
    include "config.php";
     
    $id $_GET["id"]; // Be sure to use a good clean function to do it with. If you have one uncomment the next line
    # $id = Clean($_GET["id"]);
     
    if($_GET["action"] == "edit") {
     
    $field $_POST["field"];
    # $field = clean($_POST["field"]);
     
    mysql_query("UPDATE table SET field='$field' WHERE id='$id'") or die(mysql_error());
     
    echo 
    "Record updated!";
     
    exit;
    }
     
    $get mysql_query("SELECT * FROM table WHERE id='$id' LIMIT 0,1");
    $row mysql_fetch_array($get);
     
    ?>
    <form action="?action=edit&id=<?php echo $_GET["id"]; ?>" method="post">
    <table>
     
    <tr><td>Field:</td> <td><input type="text" name="field" value="<?php echo $row["field"]; ?>"></tr>
    <tr><td> </td> <td><input type"submit" name="submit" value="Edit"></td>
     
    </table>
    </form>

  5. #15
    Join Date
    Aug 2006
    Location
    Manchester, UK
    Posts
    2,016
    Tokens
    141
    Habbo
    florx

    Latest Awards:

    Default

    Whats special about your PHPDesigner computer?

    Good luck with the editing

  6. #16
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by FlorX View Post
    Whats special about your PHPDesigner computer?

    Good luck with the editing
    It has phpDesigner 2008 Enterprise edition, and it cleans and formats my code..

  7. #17
    Join Date
    Apr 2007
    Location
    england
    Posts
    536
    Tokens
    0

    Default

    Quote Originally Posted by MrCraig View Post
    Add a new field to your database, make it a primary key and auto-increment.

    Then do

    PHP Code:
    <?php
    $get_id 
    mysql_fetch_array(mysql_query("select id from comments"));
    $id $get_id[id];
    ?>
    And im presuming your using a while loop to display comments, so it should be in that..
    How do I make it auto increment?

    AND, what would the link code be?
    Last edited by adamFTW; 12-12-2007 at 09:29 PM.


    Selling DJ/Habbo layout, more info here.


  8. #18
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Read my post.. :p

  9. #19
    Join Date
    Apr 2007
    Location
    england
    Posts
    536
    Tokens
    0

    Default

    I have, read my new thread pls.


    Selling DJ/Habbo layout, more info here.


Page 2 of 2 FirstFirst 12

Posting Permissions

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