Jump to content


UPDATE a row in a DB !

  • Please log in to reply
No replies to this topic

#1 christo

  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts

Posted 07 May 2006 - 07:49 PM

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

if(!isset($HTTP_SESSION_VARS['valid_user'])) {
    echo "blablah";
        echo "Welcome $HTTP_SESSION_VARS[valid_user]
        <title>* Blah *</title>
$objid = $HTTP_POST_VARS['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_rooms
floor price='$_POST[price]' garage cellar garden pool
descr='$_POST[descr]'age_par pic WHERE
username='".$HTTP_SESSION_VARS['valid_user']."'AND objid='$objid'";

$result = mysql_query($query) or die(mysql_error());

    if ($resultat) {
        echo"updated !";
        else {
            echo" problem !";
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, Thanks


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users