hi guys,
find below my code. I don't know why but it does not do what I want it to. the way it is, it echo-s the variable $edit_id, but I don't know why I don't get any results. If I substitute $edit_id with the id of the record for example, I get the necessary informatio. Please tell me why the sql statement does not accept my variable
Thanks
<head>
<title>Untitled</title>
</head>
<body>
<?
function db_connect($host, $user, $pass, $db) {
$dbh = mysql_connect($host, $user, $pass);
mysql_select_db($db);
return $dbh;
}
function db_execute ($sql_statement){
$dbh = db_connect('localhost','root','newpass', 'myhome');
$rth = mysql_query($sql_statement);
return $rth;
}
function edit_entry($edit_id) {
$cth = db_execute("SELECT location, price FROM PROPERTY WHERE ID = '$edit_id'");
}
function presentation() {
$rth = mysql_query ("select * from property where id = '$edit_id'");
?>
<table border="1" width="600">
<tr>
<td bgcolor="yellow" colspan="7" align="middle" class="header">Manage properties</td>
</tr>
<?
while ($column = mysql_fetch_array($rth)) {
?>
<TR>
<td>ID</td>
<td class="small"><?= $column["id"] ?></td>
</tr>
<tr>
<td>Location</td>
<td class="small"><?= $column["location"] ?></td>
</tr>
<tr>
<td>Price</td>
<td class="small"><?= $column["price"] ?><td>
</tr>
<?
}
}
if (!isset($edit_id)) {
presentation();
}
else {
edit_entry($edit_id);
presentation();
}
?>
</table>
<table>
<td>
<?
echo($edit_id);
?>
</td>
</table>
</body>