It looks like your not assigning the arrays correctly. Here's a long piece
of code I use: (it has alot of extra code that you don't need.)

<?
 // Create Connection
 $connection = mysql_connect("sql.server.com", "username", "passwd") or die
("Couldn't connect to the database!");

 // Select Database
 $db = mysql_select_db("table_name", $connection) or die ("Couldn't connect
to Database!");

 //Create SQL Statement
 $sql = "SELECT title, price, description, image FROM featured WHERE
image='$sel_record'";

 //Execute SQL query and get results
 $sql_result = mysql_query($sql, $connection) or die ("Couldn't execute
query");

 if (!$sql_result) {
 print ("<P>Couldn't get list!");
 } else {
  while ($row = mysql_fetch_array($sql_result)) {
   $title = addslashes($row["title"]);
   $price = $row["price"];
   $image = $row["image"];
   $description = addslashes($row["description"]);
   $fmt_price = sprintf("%0.2f", $price);
   $fmt_title = stripslashes($title);
   $fmt_desc = stripslashes($description);
   echo "
    <table border=\"0\" cellpadding=\"5\">
     <tr>
      <td align=\"right\">Title:</td>
      <td>$fmt_title</td>
     </tr>
     <tr>
      <td valign=\"top\">Description:</td>
      <td><textarea name=\"description\"cols=\"65\"
rows=\"5\">$fmt_desc</textarea></td>
     </tr>
     <tr>
      <td align=\"right\">Price:</td>
      <td><input type=\"text\" name=\"price\" value=\"$fmt_price\"
size=\"15\"></td>
    </table>
    <input type=\"hidden\" name=\"title\" value='$fmt_title'>
    ";
   }
  }
?>

"Mike" <[EMAIL PROTECTED]> wrote in message
news:<95c33h$5a3$[EMAIL PROTECTED]>...
> Im trying to create  an edit page for database records on the fly.I get
all
> the fieldnames and all the textboxes but only the first textbox has
data.the
> rest are always empty.any suggestions?
>
> for ($i =0;$i<mysql_num_fields($result);$i++)
> {
>
>  $row = mysql_fetch_row($result);
>  $name=mysql_field_name($result,$i);
>   echo "<p>$name<input type='text' value='$row[$i]' name='T1'
> size='20'></p>";
> }
>
>
> Thanks
> Mike P
> [EMAIL PROTECTED]
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to