Posted by Michael Phipps on 08/04/05 03:47
> $result = mysql_query ($sql);
> $row = mysql_fetch_row($result);
> while($row = mysql_fetch_array($result , MYSQL_NUM))
> {
> echo "
> <table width=100% border=1 height=18 bgcolor=#DADADA
> onmouseover=this.style.backgroundColor='#ffcc99';
> onmouseout=this.style.backgroundColor='#DADADA';>
> <tr>
> <td width=300> $row[0] </td>
> <td width=100> $row[1] </td>
> </tr>
> </table>
> ";}
>
> Now what whould I add here to make it work like in PHPMyAdmin?
> Any help appreciated!
>
You are wanting to edit/update an individual row? Well you need something
to uniquely identify that row. Most commonly, an id field in your database
that autoincrements. Because the ID field is unique you can use a select /
update query to do something to it: ie: SELECT * FROM table WHERE id=4;
BTW - to make your code easier to read, consider using mysql_fetch_assoc.
Info on this at http://au3.php.net/mysql_fetch_assoc - there are also a few
examples there to help you understand the function.
[Back to original message]
|