franknu Posted March 28, 2007 Share Posted March 28, 2007 i need some help i need to update a database, i grab the info from the database but when i hit the bottom update it doesnt update anything please help i been trying to get this to work for weeks and i havent been able to figure it out by myself $query = "SELECT * FROM business_info WHERE `BusinessName`= '$BusinessName' AND `User_Name`='$User_Name'"; $result = mysql_query($query) or die (mysql_error()); $res2 = mysql_fetch_assoc($result); echo "$BusinessName"; if(isset($_POST['update'])) { $query="UPDATE business_info SET `BusinessName`= '{$BusinessName}', `Slogan`='{$Slogan}', `Business_Address`='{$Business_Address}', `Tel`='{$Tel}', `Website`='{$Website}', `Email`='{$Email}', `Fax`='{$Fax}', `type`='{$type}', `make`='{$make}', `Categories`='{$Categories}', `Keyword`='{$Keyword}', `Picture1`='{$Picture1}', `Headline`='{$Headline}', `Slogan2`='{$Slogan2}', `Description1`='{$Description1}', `Description2`='{$Description2}', `Description3`= '{$Description3}', `Picture2`='{$Picture2}', `Picture3`='{$Picture3}', `Password`='{$Password}' WHERE `User_Name`='{$User_Name}'"; $result = mysql_query($query) or die (mysql_error()); } echo"<table bgcolor='ffffff'>"; echo"<tr>"; echo"<td>"; echo"<table>"; echo"<tr>"; echo"</tr>"; echo"</table>"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td></td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"<table> "; echo" <tr>"; echo"<td>"; echo"<table bgcolor='ffffff '>"; echo" <tr>"; echo"<td>"; echo"<table>"; echo"<form action=\"{$_SERVER['PHP_SELF']}\" method='Post'>"; echo"<tr>"; echo"<td>"; echo"Business Info"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"<table>"; echo"<tr>"; echo"<td>"; echo"Business Name"; echo"</td>"; echo"<td> <input type='text' name='BusinessName' Value='$BusinessName'>"; echo" </td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"Slogan"; echo"</td>"; echo"<td> <input type='text' NAME='Slogan' value='$Slogan'>"; echo" </td>"; echo"<td>"; echo"Website"; echo"</td>"; echo"<td> <input type='text' name='Website' value='$Website'>"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"Tel"; echo"</td>"; echo"<td> <input type='text' name='Tel' value='$Tel'>"; echo"</td>"; echo"<td>"; echo"Key Words"; echo"</td>"; echo"<td> <input type='text' name='Keyword' value='$Keyword'>"; echo "</td>"; echo" </tr>"; echo"<tr>"; echo"<td>"; echo"Fax"; echo"</td>"; echo"<td> <input type='text' name='Fax' value='$fax'>"; echo" </td> "; echo"<td>"; echo"Address" ; echo"</td>"; echo"<td> <input type='text' name='Business_Address' value='$Business_Address'>"; echo" </td>"; echo" </tr>"; echo"</table>"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"<table>"; echo"<tr>"; echo"<td>"; echo"</td>"; echo"<td>"; echo"</td>"; echo"<td>"; echo"</td>"; echo"<td> "; echo"</td>"; echo"<td>"; echo"Category"; echo"</td>"; echo"<td>"; echo" <TEXTAREA ROWS=5 COLS=65 NAME='Categories' value='$Categories'> $Categories </TEXTAREA>"; echo"</td>"; echo"</tr>"; echo"</table>"; echo"<table>"; echo"<tr>"; echo"<td>"; echo"Business Webpage"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"Headline"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo" <td> <input type='text' name='Headline' value='$Headline'>"; echo" </td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"Slogan"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td> <input type='text' name='Slogan2' value='$Slogan2'>"; echo"</td>"; echo" </tr>"; echo"<tr>"; echo" <td>"; echo"Description1"; echo" </td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"<TEXTAREA ROWS=5 COLS=65 NAME='Description1' value='$Description1'>$Description1 </TEXTAREA> "; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"Description2"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td> <TEXTAREA ROWS=5 COLS=65 NAME='Description2' value='$Description2'>$Description2</TEXTAREA>"; echo"</td>"; echo"</tr>"; echo" <tr>"; echo"<td>"; echo"Description3"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td><TEXTAREA ROWS=5 COLS=65 NAME='Description3' value='$Description3'>$Description3</TEXTAREA>"; echo"</td>"; echo"</tr>"; echo" <tr>"; echo" <td>"; echo"<table>"; echo"<tr>"; echo"<td>"; echo"User Name"; echo"</td>"; echo"<td> <input type='text' name='User_Name' value='$User_Name'>"; echo"</td>"; echo"<td>"; echo"Password"; echo"</td>"; echo"<td> <input type='text' name='Password' value='$Password'>"; echo"</td>"; echo"</tr>"; echo"</table>"; echo"</td>"; echo"</tr>"; echo"</table>"; echo" </td>"; echo"</tr>"; echo"<tr>"; echo"<td> <input type='submit' value='Update my database' name='update' /> <input type='reset' value='Reset fields' />"; echo"<td> "; echo"</form>"; echo"</table>"; echo"</td>"; echo"<td>"; echo"</td>"; echo" </tr>"; echo"</table>"; echo"</td>"; echo"</table> " ; echo" </tr>"; //finish here echo "<td> </td>"; echo"</td>"; echo"<td valign='top'>"; echo"</td>"; echo"</tr>"; echo"</table>"; echo"</td>"; echo"</tr>"; echo"</table>"; } ?> Link to comment https://forums.phpfreaks.com/topic/44651-updating-database/ Share on other sites More sharing options...
trq Posted March 28, 2007 Share Posted March 28, 2007 Your kidding? Please, only the relevent code is required. Are you getting any errors? What are they? Also... in your UPDATE query, where are all the variables being defined? Eg; $BusinessName, $Slogan etc etc... More then likely you don't have register globals switched on (a good thing), you'll need to access these variables via $_POST['BusinessName'], $_POST['Slogan'] etc etc. Link to comment https://forums.phpfreaks.com/topic/44651-updating-database/#findComment-216829 Share on other sites More sharing options...
franknu Posted March 28, 2007 Author Share Posted March 28, 2007 sorry about adding most of the codes, i just wanted to give a more clear picture, i had declared the variables at the top.. i added this lines <input type='text' name='BusinessName' Value='$_POST['BusinessName'],'>"; but then i get this 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/Update_Page.php on line 258 Link to comment https://forums.phpfreaks.com/topic/44651-updating-database/#findComment-216831 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.