am Stack with this update program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • underscore
    New Member
    • Jul 2007
    • 30

    am Stack with this update program

    To all TSDN

    am here again to ask your assistance about this problem in updating my project. I have a project ROOM RESERVATION and in my 'setuproom.php' theres a table display of all room names with the image of room stored in mysql blob data types. my problem are
    1. when i click a room name in my setuproom.php to edit a certain row it would bring me to the edit.php which the code below which make me mad coz nohting happens or change.
    2. i cant show also the image of my room which i stored in the imgDatafield.

    thnx for your support.

    i got this code from other TSDN member.

    [code=php]
    <html>
    <body>
    <?php
    include'connect .php';
    mysql_select_db ('database');

    //if(isset($_POST["$id"])) $id = $_POST["$id"];
    //echo $id;
    if (isset($_POST['submit']))
    {

    $room = $_POST['room_name'];
    $rate = $_POST['rom_rate'];
    //$img = $_POST['imgData'];

    $sql = "UPDATE 'room' SET 'room_name'= '$room','rom_ra te'='$rate' WHERE 'idno'='$id'";
    $result = mysql_query($sq l);
    echo $room;
    echo "Thank you! Information updated.\n";
    }
    elseif (isset($id))
    {
    $sql = "SELECT * FROM room WHERE idno=$id";
    $result = mysql_query($sq l);

    $myrow = mysql_fetch_arr ay($result);

    $room = $myrow['room_name'];
    $rate = $myrow['rom_rate'];
    //$img = $myrow['3'];

    //$submit = 'submit';
    }
    ?>
    <form method="post" action="<?php echo $PHP_SELF?>">
    <input type=hidden name="id" value="<?php echo $myrow["id"] ?>">

    Room Name:<input type="Text" name="room" value="<?php echo $room ?>"><br>
    Room Rate:<input type="Text" name="rate" value="<?php echo $rate ?>"><br>
    Image: <input type="Text" name="img" value="<?php echo $img ?>"><br>
    Position:<input type="Text" name="position" value="<?php echo $position ?>"><br>
    <input type="Submit" name="submit" value="Enter information">
    </form>
    </body>
    </html>
    [/code]
    Last edited by Atli; Oct 13 '07, 01:54 AM. Reason: Added [code] tags.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    Please use CODE tags when posting source code:

    &#91;CODE=ph p]
    PHP code goes here.
    &#91;/CODE]

    Moderator

    Comment

    • underscore
      New Member
      • Jul 2007
      • 30

      #3
      image view

      Originally posted by Atli
      Hi.

      Please use CODE tags when posting source code:

      [CODE=php]
      PHP code goes here.
      [/CODE]

      Moderator
      hello Atli glad to hear you again...

      sory for i foreget the code tags.
      any way i can edit already my page but my problem is i cant display the image i have stored pls advice me.
      Last edited by underscore; Oct 13 '07, 03:04 AM. Reason: i got already

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, underscore.

        Is the image data stored in the database, or is it just the path to the file?

        Comment

        Working...