Jump to content

Edit data


Recommended Posts

Hey all, having a little trouble displaying usernames from a database and then having a link alongside each displayed username to edit it.

 

I'm using this script:

 

<?php # Script 13.8 - edit.php

// Include the configuration file for error management and such.
require_once ('./includes/config.inc.php');

// Set the page title and include the HTML header.
$page_title = 'Users';
include ('./includes/header.html');
?>

<table>
  <tr>
    <td align="center">Edit Users</td>
  </tr>
  <tr>
    <td>
      <table border="1">
      <?
      require_once ('../mysql_connect.php'); // Connect to the database.
      $order = "SELECT username FROM users";
      $result = mysql_query($order);
      while ($row=mysql_fetch_array($result)){
        echo ("<tr><td>$row[username]</td>");
        echo ("<td><a href=\"edit_form.php?id=$row[username]\">Edit</a></td></tr>");
      }
      ?>
      </table>
    </td>
   </tr>
</table>

<?php
include ('./includes/footer.html');
?>

 

The page displays this:

 

Edit Users

"); echo (""); } ?>

$row[username] Edit - this line being inside the table.

 

Please help if you can. Thanks.

Link to comment
https://forums.phpfreaks.com/topic/193888-edit-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.