franknu Posted May 28, 2007 Share Posted May 28, 2007 Ok I want to update the database with a session my problems is tht it is weping out everything i want to update not delete any advise on how to handle this i might have problems with session here is my code <? $query="UPDATE business_info SET BusinessName= ('$_POST[businessName]'), `Slogan`=('$_POST[slogan]'), Business_Address = ('$_POST[business_Address]'), Tel=('$_POST[Tel]'), Website= ('$_POST[Website]'), Email = ('$_POST[Email]'), Fax= ('$_POST[Fax]'), `type`='$type', make = '$make', Categories = ('$_POST[Categories]'), Keyword = ('$_POST[Keyword]'), `Picture1` = '$fullpath1', Headline = ('$_POST[Headline]'), Slogan2 = ('$_POST[slogan2]'), Description1 = ('$_POST[Description1]'), Description2 = ('$_POST[Description2]'), Description3 = ('$_POST[Description3]'), User_Name='".$_SESSION['User_Name']."' WHERE Password='".$_SESSION['Password']."'"; $result = mysql_query($query) or die ("Problem with the query: <pre>$query</pre><br>" . mysql_error()); ?> <? echo'<form action="'. $_SERVER['PHP_SELF'].'" method="post" enctype="multipart/form-data">'; ?> <table width="605" border="1"> <tr> <td width="595"><table width="584" border="1" cellpadding="0" cellspacing="0" bordercolor="#999999" background="fondo2.jpg"> <tr> <td width="101" valign="top"><strong>Business Name </strong></td> <td width="77" valign="top"><strong> <? echo"<input type=\"text\" name=\"BusinessName\" value=\"{$row['BusinessName']}\">"; ?> </strong></td> <td width="72" valign="top"><strong>Slogan </strong></td> <td width="306" valign="top"><? echo"<input type=\"text\" NAME=\"Slogan\" value=\"{$row['Slogan']}\" >"; ?></td> </tr> Link to comment https://forums.phpfreaks.com/topic/53324-updating-database-with-sessions/ Share on other sites More sharing options...
trq Posted May 28, 2007 Share Posted May 28, 2007 echo $query to the screen before you execute it and let us see what it looks like. Link to comment https://forums.phpfreaks.com/topic/53324-updating-database-with-sessions/#findComment-263535 Share on other sites More sharing options...
franknu Posted May 28, 2007 Author Share Posted May 28, 2007 UPDATE business_info SET BusinessName= (''), `Slogan`=(''), Business_Address = (''), Tel=(''), Website= (''), Email = (''), Fax= (''), `type`='Lawrence', make = 'Massachusetts', Categories = (''), Keyword = (''), Headline = (''), Slogan2 = (''), Description1 = (''), Description2 = (''), Description3 = (''), User_Name='franklin' WHERE Password='franklin01' that is my query so basicly the problem is that when i hit back it deletes the data Link to comment https://forums.phpfreaks.com/topic/53324-updating-database-with-sessions/#findComment-263559 Share on other sites More sharing options...
franknu Posted May 29, 2007 Author Share Posted May 29, 2007 i really dont know why that is happening, maybe i should create a logout session any idea Link to comment https://forums.phpfreaks.com/topic/53324-updating-database-with-sessions/#findComment-263577 Share on other sites More sharing options...
franknu Posted May 29, 2007 Author Share Posted May 29, 2007 well, i tried many diffrent things but it if it helps the user_NAme and password stay in when i hit the back bottom on the browser, but evething else deletes itself from the database Link to comment https://forums.phpfreaks.com/topic/53324-updating-database-with-sessions/#findComment-263920 Share on other sites More sharing options...
franknu Posted May 29, 2007 Author Share Posted May 29, 2007 please help Link to comment https://forums.phpfreaks.com/topic/53324-updating-database-with-sessions/#findComment-264204 Share on other sites More sharing options...
calabiyau Posted May 29, 2007 Share Posted May 29, 2007 Ok I want to update the database with a session my problems is tht it is weping out everything i want to update not delete any advise on how to handle this i might have problems with session here is my code <? $query="UPDATE business_info SET BusinessName= ('$_POST[businessName]'), `Slogan`=('$_POST[slogan]'), Business_Address = ('$_POST[business_Address]'), Tel=('$_POST[Tel]'), Website= ('$_POST[Website]'), Email = ('$_POST[Email]'), Fax= ('$_POST[Fax]'), `type`='$type', make = '$make', Categories = ('$_POST[Categories]'), Keyword = ('$_POST[Keyword]'), `Picture1` = '$fullpath1', Headline = ('$_POST[Headline]'), Slogan2 = ('$_POST[slogan2]'), Description1 = ('$_POST[Description1]'), Description2 = ('$_POST[Description2]'), Description3 = ('$_POST[Description3]'), User_Name='".$_SESSION['User_Name']."' WHERE Password='".$_SESSION['Password']."'"; When you put $_POST[Email] in the above code you need to have single quotes around the word email. $_POST['Email'] for example and you need to do that with every place you use a post variable. also i don't think you need the paranthesis around each instance of post variable either. Link to comment https://forums.phpfreaks.com/topic/53324-updating-database-with-sessions/#findComment-264215 Share on other sites More sharing options...
franknu Posted May 29, 2007 Author Share Posted May 29, 2007 Ok, defenely think that that is where the problems is because i can see that the session user name and paswword a set up as u said and that is the reason why they still keep there when i hit the back bottom on the browser.. the problem is that i am getting a parser error at the first line on the query and here is the error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/townsfin/public_html/authorization/text_update.php on line 114 <? $query="UPDATE business_info SET `BusinessName`= $_POST['BusinessName'], `Slogan`=$_POST['Slogan'], `Business_Address` = $_POST['Business_Address'], `Tel`= $_POST['Tel'], `Website`= $_POST['Website'], Email = ('$_POST[Email]'), Fax= ('$_POST[Fax]'), `type`='$type', make = '$make', Categories = ('$_POST[Categories]'), Keyword = ('$_POST[Keyword]'), Headline = ('$_POST[Headline]'), Slogan2 = ('$_POST[slogan2]'), Description1 = ('$_POST[Description1]'), Description2 = ('$_POST[Description2]'), Description3 = ('$_POST[Description3]'), User_Name='".$_SESSION['User_Name']."' WHERE Password='".$_SESSION['Password']."'"; $result = mysql_query($query) or die ("Problem with the query: <pre>$query</pre><br>" . mysql_error()); echo"$query"; ?> Link to comment https://forums.phpfreaks.com/topic/53324-updating-database-with-sessions/#findComment-264229 Share on other sites More sharing options...
franknu Posted May 29, 2007 Author Share Posted May 29, 2007 I had tried many diffrent things and i still keep getting the error message i looks that i only likes that way it was set up on the pass Link to comment https://forums.phpfreaks.com/topic/53324-updating-database-with-sessions/#findComment-264256 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.