PHP and MySQL deleting fields in database when it shouldn't -


i'm using simple html form 2 submit buttons. each button enacts php function inserts data specific field in database. php function first submit button enacts contains mysql code:

    $placea = "".$_session['username']."";     $connect = mysql_connect("localhost", "root", "root") or die("couldn't connect!");     mysql_select_db("login") or die("couldn't find db");      $queryreg = mysql_query("     insert places values ('$placea', '$placeb')     "); 

and second button enacts similar php function contains mysql code:

    $placeb = "".$_session['username']."";     $connect = mysql_connect("localhost", "root", "root") or die("couldn't connect!");     mysql_select_db("login") or die("couldn't find db");      $queryreg = mysql_query("     insert places values ('$placea', '$placeb')     "); 

when push first button it's supposed do. assigns $placea username, , adds $placea first column of "places" table in database. problem comes when click second button. second function inserts username database under second column of "places" table it's supposed to, deletes username inserted first column. if click first button again, inserts username first column , deletes username second column. it's if mutually exclusive reason? should do? (none of other code relevant database @ all. it's bunch of echos.)

the $placea , $placeb variables defined using session , if don't define every time each var have , empty 1 , if structture accepts null in fields ( placea or placeb ) result strange strange record .

imho , start use more extend query "insert (field1, field2, ..) values ('val1',val2,etc) . more clear debug .


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -