Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > Software > PHP MySQL UPDATE

Thread Tools

PHP MySQL UPDATE is offline
Junior Member
Join Date: Oct 2012
Location: Middle Sweden
Posts: 15
Can anyone help me with correcting this page so it works?

Seems to have a problem with this line esp, $id=($_GET["id"]);

echo '<html>
<title>Edit a Record from MySQL Database</title>
<form method="post" action="update_ac.php">';

$con = mysql_connect("localhost","root","");
if (!$con)
die('Could not connect: ' . mysql_error());

mysql_select_db("my_db", $con);

// get value of id that sent from address bar

// Retrieve data from database
$sql="SELECT * FROM persons WHERE id='$id'";


echo "<table border='1'>

while ($row = mysql_fetch_array($result)){
$id = $row['id'];
$FirstName = $row['FirstName'];
$LastName = $row['LastName'];
$Age = $row['Age']; //we will echo these into the proper fields

echo '<tr><td><input type="text" value="<?php echo $id;?>" name="id" disabled/><br/> </td
<td>First Name:<br/><input type="text" value="<?php echo $FirstName;?>" name="FirstName"/> <br/> </td
<td>Last Name:<br/><input type="text" value="<?php echo $LastName;?>" name="LastName"/> <br/> </td
<td>Age:<br/><input type="text" value="<?php echo $Age;?>" name="Age"/> </br>
<input type="submit" value="submit changes"/></td</tr>';
echo "</table>";

// close connection

echo "</form>
Reply With Quote
heff heff is offline
Junior Member
Join Date: Jan 2013
Posts: 2
You've probably solved this by now, but here goes anyway.
Your GET request should be $id=$_GET['id'];
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP MySQL Web Development - Why Do You Need a PHP & MySQL ... neha shena Python 1 10-29-2010 04:54 AM
FREE SEMINAR on PHP Web Development in Lahore, It covers PHP, MySQL,AJAX & Zend Certification EVS MCSE 0 08-08-2010 12:41 PM
FREE SEMINAR on PHP Web Development in Lahore and Rawalpindi, Itcovers PHP, MySQL, AJAX & Zend Certification EVS MCSE 0 05-31-2010 01:13 PM
PHP Training Institute In Delhi, Live Projects on PHP. Short TermPHP Courses, PHP Scripts, PHP Training with Live Projects. Rajive Narain Java 0 09-18-2009 10:47 AM