I have a beautiful, dynamic and very attractive front page:
[PHP]<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
include '../../db.inc';
$id = intval( mysql_real_escape_string( $_GET['id'] ));
//echo "id = $id";
// Connect to server and select database.
$sql="SELECT name,link FROM $tbl_name where contentid = '$id'";
$result=mysql_query($sql);
?>
<table width="180" border="0" cellspacing="1" cellpadding="0">
<tr>
<td>
<table width="170" border="0" cellspacing="0" cellpadding="1">
<tr>
</tr>
<tr>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td><? echo $rows['name']; ?></td>
<td><? echo $rows['link']; ?></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
<td align="center"><a href="update_doc.php?id=<? echo $id;?>">update</a></td>
<td align="center"><a href="delete_doc.php?id=<? echo $id;?>">delete</a></td>
<td align="center"><a href="insert_doc.php?id=<? echo $id;?>">insert</a></td>
<?php
mysql_close();
?>[/PHP]
And my update_doc.php is also very beautiful, attractive.
[PHP]<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
include '../../db.inc';
$tbl_name="jos_documentation"; // 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 name,link FROM $tbl_name WHERE contentid='$id'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
?>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<form name="form1" method="get" action="update_ac.php">
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td> </td>
<td colspan="3"><strong>Update Main Issues</strong> </td>
</tr>
<tr>
<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" value="<? echo"$rows[name]"; ?>" size="30" /></td>
<td align="center"><input name="name" type="text" value="<? echo"$rows[link]"; ?>" size="30" /></td>
</label></td>
</tr>
<tr>
<td> </td>
<td><input name="id" type="hidden" id="id" value="<? echo $rows['contentid']; ?>"></td>
<td align="center"><input type="submit" name="Submit" value="Submit"></td>
<td> </td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<?
// close connection
mysql_close();
?>[/PHP]
Problem is that it will only give me the first set of data, name link.
And I'm guessing it should be a petty thing that I have either a) not done or b) done wrong.
Can anyone of you point me in the right direction?
when I do an:
[PHP]SELECT name,link from table where contentid='13'[/PHP] I get two lines of results, instead of only one.
Thank's in advance for all help!
Phopman