Is your id field in your db row numeric or character? rEMEMBER: In the example it is a numeric, so the sql statement defined is something like "... WHERE id=. $_REQUEST['i']". When it is a character field, you must enclose this id in quotes, such as
-
$sqlst = "UPDATE listofitem SET NameOfTools='$NameOfTools' WHERE id='" . $_REQUEST['i']."'";
If the id is numeric, you must have changed the code in some other place. In that case, please show it exactly as you have tested it.
Ronald :cool:
So sorry to make u diffucult.
Now i already understand what did u mean in the above code. But it seen like not suitable with what i want to create. So now i have another idea is that create a form that can edit by user corresponding to the ID andinformation that display as the code below
if (isset($_GET['id'])) {
$id = strip_tags($_GET['id']);
//required file for database connection
require("config.php");
$information=mysql_fetch_array($sql);
echo "<table border='1'>";
echo "<tr><td Name</th><td >Brand</th></tr>";
echo"<tr><td>{$information1['Name']}</td>
<td>{$information1['Brand']}</td>;
echo "</table>";
And then i had found an example like below
<?php
//required file for database connection
require 'config.php' ;
//user photo display
echo "<a href=user_profile.php?ret=general>General Information</a><br>";
if ($_GET['ret'] == '' && $_GET['edit'] == '' ){
echo "<font color=ultra>*Select the user profile on the User Profile menu above</font>";
}
if ($_GET['ret'] == 'general' ){
//User General Information Retriving
//find the user
$general_result = mysql_query("SELECT * FROM system_user WHERE userId='{$_SESSION['userid']}'")
or die(mysql_error());
$general_row = mysql_fetch_array( $general_result ); //set $row to result
//table to display general user inforamtion
echo "General Information";
echo "Staff ID: " . $general_row['userId'] ."</td></tr>";
echo "<tr><td width=20%>Staff Name</td><td width=65%>: ".$general_row['userName'] ."</td></tr>";
echo "<tr><td width=65%><br>
<a href=user_profile.php?edit=general><img src=images/edit.jpg border=0></td></tr>";
echo "</table>"
}//end selection on general information retriving
//User general edit mode
if ($_GET['edit'] == 'general' ){
//User General Information Edit Mode
//find the user
$general_result = mysql_query("SELECT * FROM system_user WHERE userId='{$_SESSION['userid']}'")
or die(mysql_error());
$general_row = mysql_fetch_array( $general_result ); //set $row to result
//table to display general user inforamtion
echo "<font size=4 color=blue>General Information: </font>";
echo "<font size=4 color=Red>Edit Mode</font><br><br>";
echo "<table width=75% border=0>";
echo "<tr><td width=20%>Staff ID</td><td width=65%>: " . $general_row['userId'] ."</td></tr>";
echo "<tr><td width=20%>Staff Name</td><td width=65%>:
<input name=txt_userName type=text value='" . $general_row['userName'] ."'></td></tr>";
}//end selection on general information edit
if ($_GET['edit'] == 'gen_confirm' ){
echo "Are you sure to save the changes? <a href=user_profile.php?edit=general_ok> OK <a/>";
//echo $_GET['txt_userName'];
echo "Hello...";
}
if ($_GET['edit'] == 'general_ok' ){
$general_update = "UPDATE system_user SET WHERE userId='{$_SESSION['userid']}'";
mysql_query($general_update) or die(mysql_error());
//$general_row = mysql_fetch_array( $general_update );
echo "Are you sure to save the changes? <a href=user_profile.php?edit=general_ok> OK <a/>";
}
?>
Do u think it is suitable for me to follow this format?If yes how do i do. I had try to follo tat code but it seen like didnt work because error : "unfind index edit".