Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Thread Tools Display Modes
Old 09-12-2012, 08:07 PM   #1
Join Date: Oct 2010
Posts: 340
Default UPDATE row

Can anyone tell me why this isnt working?

Its not throwing up any errors either, so Im kinda stuck.

Ive been trying for over an hour now but cant work it out.



$id = $_GET['id'];
$id = $_POST['id'];

$query = "SELECT * FROM people WHERE id = $id";
$result = mysqli_query($link, $query);

while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){

$name = $row['name'];
$age = $row['age'];
$hobby = $row['hobby'];
echo $name . $age . $hobby;



$id = $_POST['id'];
$update = "UPDATE people
SET name = '$name',
age = '$age',
hobby = '$hobby'
WHERE id = $id
$r = @mysqli_query($link, $update) or die(mysqli_error($link));

echo "done";
echo mysqli_error($link);



<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
// put your code here


<form method="post" action="update.php">

<p>Name<input type="text" name="name" value="<?php echo "$name"; ?>" /></p>
<p>Age<input type="text" name="age" value="<?php echo "$age"; ?>" /></p>
<p>Hobby<input type="text" name="hobby" value="<?php echo "$hobby"; ?>" /></p>
<p><input type="hidden" name="id" value="<?php echo "$id"; ?>" /></p>
<p><input type="submit" name="submit" value="SUBMIT" /></p>

tony09uk is offline   Reply With Quote

Thread Tools
Display Modes

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

Forum Jump

All times are GMT. The time now is 04:11 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com