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

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?