elvn0
03-09-2008, 01:33 AM
<?php
function sql_quote($data) {
if (get_magic_quotes_gpc()) {
$data = stripslashes($data);
}
return addslashes($data);
}
$id = sql_quote($_GET['id']);
$action = sql_quote($_GET['action']);
include 'config.php';
include 'opendb.php';
$id = mysql_real_escape_string($id); // helps protect against injections
$query = "SELECT * FROM `members` WHERE `id` = '{$id}' ";
$result = mysql_query($query) or die(mysql_error());
$name=$row['name'];
$rank=$row['rank'];
$lastname=$row['lastname'];
$pos=$row['pos'];
$s=$row['squad'];
$asn=$row['asn'];
$tour=$row['tour'];
?>
<form name="update" action="edit_profile.php?action=edit method="post">
Name:<input type="text" name="name" value="<?php print $name; ?>"/>
Last name:<input type="text" name="lastname" value="<?php print $lastname; ?>"/>
Rank:<input type="text" name="rank" value="<?php print $rank; ?>"/>
Pos:<input type="text" name="pos" value="<?php print $pos; ?>"/>
<input type="submit" name="submit" value="save"/>
</form>
It's not getting the values from database and put them into text fields.
What am i doing wrong?
function sql_quote($data) {
if (get_magic_quotes_gpc()) {
$data = stripslashes($data);
}
return addslashes($data);
}
$id = sql_quote($_GET['id']);
$action = sql_quote($_GET['action']);
include 'config.php';
include 'opendb.php';
$id = mysql_real_escape_string($id); // helps protect against injections
$query = "SELECT * FROM `members` WHERE `id` = '{$id}' ";
$result = mysql_query($query) or die(mysql_error());
$name=$row['name'];
$rank=$row['rank'];
$lastname=$row['lastname'];
$pos=$row['pos'];
$s=$row['squad'];
$asn=$row['asn'];
$tour=$row['tour'];
?>
<form name="update" action="edit_profile.php?action=edit method="post">
Name:<input type="text" name="name" value="<?php print $name; ?>"/>
Last name:<input type="text" name="lastname" value="<?php print $lastname; ?>"/>
Rank:<input type="text" name="rank" value="<?php print $rank; ?>"/>
Pos:<input type="text" name="pos" value="<?php print $pos; ?>"/>
<input type="submit" name="submit" value="save"/>
</form>
It's not getting the values from database and put them into text fields.
What am i doing wrong?