Skip to main content

Edit mysql record db with php



i am trying to edit a mysql database record , there is seem to be an issue with my code





here is the code from page editVisitor.php







<?

while($row=mysql_fetch_array($result))

{

?>

<?

$message=stripslashes($row["userUserName"]);

$msg_id=$row["useId"];

?>



<li><a href="editUserDetails.php?edit=<?php echo $msg_id; ?>" >

<?php echo $message; ?></a> <a href="#" id="<?php echo $msg_id; ?>" class="delete_button">X</a></li>





<?php

}

?>







this is my code in editUserDetails.php that open new page with all fields to update the record :







<?php



$connection= mysql_pconnect("localhost","root","123") or die (mysql_error());

$db= mysql_select_db("reservebox",$connection) or die (mysql_error());





$selectdata="SELECT * FROM user WHERE useId =" . $edit . "";

mysql_query($selectdata);



$row = mysql_fetch_array($selectdata);





?>



//html form and table code







<input type="text" name="FirstName" id="FirstName" value="<? echo $row['userUserName']; ?>"/>







the editVisitorDetails.php doesn't show any data and i continue get this error







Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in




Comments

  1. $selectdata="SELECT * FROM user WHERE useId =" . $edit . "";
    $query=mysql_query($selectdata);

    $row = mysql_fetch_array($query);

    ReplyDelete

Post a Comment