please check my thread i need help, updation there is a code for this
furqan219
Junior Poster in Training
89 posts since Jun 2009
Reputation Points: 2
Solved Threads: 4
This is your 11th post and still you have no idea how to post source code?
Please read http://www.daniweb.com/forums/announcement17-4.html
You should paste your code in BB tags
<?php
$query= mysql_query(" SELECT * FROM office
WHERE officeID='" . $_GET['officeID'] . "'");
while($entry=mysql_fetch_array($query))
{
echo "<br/>Name : $entry[name]";
echo "<br/>Location : $entry[location]";
}
?>
__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
try this and change according to u
<?
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("new", $con);
$result = mysql_query("SELECT * FROM abc
WHERE SiteId='C-SIL-4441' "); // I just get one value at this time
while($row = mysql_fetch_array($result))
{
echo "<table cellpadding=2 cellspacing=2 width=100%>
<tr>
</tr>";
echo "<tr>";
echo "<th bgcolor=#5D9BCC >SiteID</th>";
echo "<td bgcolor=#FEE9A9>" . $row['SiteId'] . "</td>";
echo "<td bgcolor=#FEE9A9>" . $row['Name'] . "</td>";
echo "<td bgcolor=#FEE9A9>" . $row['Address'] . "</td>";
echo "<td bgcolor=#FEE9A9>" . $row['City'] . "</td>"; // show value in cell
$b =$row['SiteId'];
$c =$row['Name'];
$d =$row['Address'];
$e =$row['City'];// store value in variabel
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
<form action="update2.php" method="post">
<table>
<tr>
<td>name</td>
<td>
<input type="text" name="username" id="username" value="<?php echo $c; ?>" /> </td></tr>
<tr>
<td>Address</td>
<td>
<input type="text" name="address" id="address" value="<?php echo $d; ?>"></td></tr>
<tr>
<td>city</td>
<td>
<input type="text" id="city" name="city" value="<?php echo $e; ?>">
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Update"/>
</td>
</tr>
<input type="text" value="<?php echo $b; ?>" name="siteid">
</table>
</body>
</html><?
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("new", $con);
$result = mysql_query("SELECT * FROM abc
WHERE SiteId='C-SIL-4441' "); // I just get one value at this time
while($row = mysql_fetch_array($result))
{
echo "<table cellpadding=2 cellspacing=2 width=100%>
<tr>
</tr>";
echo "<tr>";
echo "<th bgcolor=#5D9BCC >SiteID</th>";
echo "<td bgcolor=#FEE9A9>" . $row['SiteId'] . "</td>";
echo "<td bgcolor=#FEE9A9>" . $row['Name'] . "</td>";
echo "<td bgcolor=#FEE9A9>" . $row['Address'] . "</td>";
echo "<td bgcolor=#FEE9A9>" . $row['City'] . "</td>"; // show value in cell
$b =$row['SiteId'];
$c =$row['Name'];
$d =$row['Address'];
$e =$row['City'];// store value in $b
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
<form action="update2.php" method="post">
<table>
<tr>
<td>name</td>
<td>
<input type="text" name="username" id="username" value="<?php echo $c; ?>" /> </td></tr>
<tr>
<td>Address</td>
<td>
<input type="text" name="address" id="address" value="<?php echo $d; ?>"></td></tr>
<tr>
<td>city</td>
<td>
<input type="text" id="city" name="city" value="<?php echo $e; ?>">
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Update"/>
</td>
</tr>
<input type="text" value="<?php echo $b; ?>" name="siteid">
</table>
</body>
</html>
furqan219
Junior Poster in Training
89 posts since Jun 2009
Reputation Points: 2
Solved Threads: 4
hi
I just edited your code
so you can find solution as you want
<?php
$query= mysql_query(" SELECT * FROM office
WHERE officeID='" . $_GET['officeID'] . "'");
?>
<table>
while($entry=mysql_fetch_array($query))
6.
{ ?>
7. <tr>
<td>Name</td>
<td><?=$entry['name']?></td>
</tr>
<tr>
<td>Location</td>
<td><?= $entry['location']?></td>
</tr>
<?
} ?>
</table>
<form method="post">
<input type="text" name"txt_name" id="txt_name" value='<?=$entry['name']?>'>
</form>
like this you can do as per your requirement if you want fetch only one row that time no need of while loop ok $entry=mysql_fetch_array($query);
Thanks
Tulsa
Junior Poster in Training
77 posts since May 2009
Reputation Points: 13
Solved Threads: 15