<?php
$host="xxxxx.xxxxxx.com"; // Host name
$username="xxxxxx"; // Mysql username
$password="xxxxx"; // Mysql password
$db_name="xxxxxxxx"; // Database name
$tbl_name="xxxxxx"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// get value of id that sent from address bar
$id=$_GET['id'];
// Retrieve data from database
$sql = "SELECT * FROM $tbl_name WHERE name BY id='$id'";
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result))
?>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<form name="form1" method="post" action="update_ac.php">
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td> </td>
<td colspan="3"><strong>Update filename</strong> </td>
</tr>
<tr>
<td align="center"> </td>
<td align="center"> </td>
<td align="center"> </td>
<td align="center"> </td>
</tr>
<tr>
<td align="center"> </td>
<td align="center"><strong>Name</strong></td>
</tr>
<tr>
<td> </td>
<td align="center"><input name="name" type="text" id="name" value="<? echo $row['name']; ?>"></td>
</tr>
<tr>
<td> </td>
<td><input name="id" type="hidden" id="id" value="<? echo $row['id']; ?>"></td>
<td align="center"><input type="submit" name="Submit" value="Submit"></td>
<td> </td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<?
// close connection
mysql_close();
?>
The error is like this:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /hermes/xxxxx/web068/b681/xxxxxx/xxxxxx/update.php on line 19
>
Got a clue?