christo Posted May 7, 2006 Share Posted May 7, 2006 What i would like to do here is to retrieve the infos of a row in a DB and display it in a form (the same i entered the data) correct them and save .Here's what i've done [code]<?session_start();if(!isset($HTTP_SESSION_VARS['valid_user'])) { echo "blablah";} else{ echo "Welcome $HTTP_SESSION_VARS[valid_user]<html> <title>* Blah *</title> <body> $objid = $HTTP_POST_VARS['objid'];echo"objid=$objid";$host = "";$user = "";$pass = "";$base = "";$db_conx = mysql_connect($host,$user,$pass) or print("error de connection mysql");mysql_select_db($base, $db_conx) or print("error connection base");$query ="UPDATE object SET region state city='$city'district='$_POST[district]'accomodation transaction nb_roomsfloor price='$_POST[price]' garage cellar garden pooldescr='$_POST[descr]'age_par pic WHEREusername='".$HTTP_SESSION_VARS['valid_user']."'AND objid='$objid'";$result = mysql_query($query) or die(mysql_error()); if ($resultat) { echo"updated !"; } else { echo" problem !"; }}?>[/code]But honestly i haven't understood the concept...Do i need to write 2 requests? (display,update)How can get the infos from the DB and show the values appearing in the form (another php that i enter infosin the DB from, tx radio, checkbox) ?? What do you think of the above script, am i in the right way ???Any info on this subject is welcome, ThanksChristos Link to comment https://forums.phpfreaks.com/topic/9260-update-a-row-in-a-db/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.