franknu Posted January 29, 2007 Share Posted January 29, 2007 ok, i have this datase which is not updating when i hit submit it keeps the same data on the barsalso the file that process the form is the same as the one that has the script any idea why [code=php:0]<?php$host = "";$username = "";$password = "";$database = "";$db = mysql_connect($host, $username, $password) or die(mysql_error());mysql_select_db($database) or die(mysql_error());$BusinessName = (isset($_POST['BusinessName']) ? $_POST['BusinessName'] : '');$Slogan = (isset($_POST['Slogan']) ? $_POST['Slogan']:'');$Business_Address = (isset($_POST['Business_Address']) ? $_POST['Business_Address']:'');$Tel = (isset($_POST['Tel']) ? $_POST['Tel']:'');$Website = (isset($_POST['Website']) ? $_POST['Website']:'');$Email = (isset($_POST['Email']) ? $_POST['Email']:'');$Member_Status = (isset($_POST['Member_Status']) ? $_POST['Member_Status']:'');$Fax =(isset($_POST['Fax']) ? $_POST['Fax']:'');$type = (isset($_POST['type']) ? $_POST['type']:'');$make = (isset($_POST['make']) ? $_POST['make']:'');$Categories = (isset($_POST['Categories']) ? $_POST['Categories']:'');$Keyword = (isset($_POST['Keyword']) ? $_POST['Keyword']:'');$Picture1 = (isset($_POST['Picture1']) ? $_POST['Picture1']:'');$Headline = (isset($_POST['Headline']) ? $_POST['Headline']:'');$Slogan2 = (isset($_POST['Slogan2']) ? $_POST['Slogan2']:'');$Description1 = (isset($_POST['Description1']) ? $_POST['Description1']:'');$Description2 = (isset($_POST['Description2']) ? $_POST['Description2']:'');$Description3= (isset($_POST['Description3']) ? $_POST['Description3']:'');$Contact2 = (isset($_POST['Contact2']) ? $_POST['Contact2']:'');$Picture2 = (isset($_POST['Picture2']) ? $_POST['Picture2']:'');$Picture3 = (isset($_POST['Picture3']) ? $_POST['Picture3']:'');$Picture4 = (isset($_POST['Picture4']) ? $_POST['Picture4']:'');$User_Name = (isset($_POST['User_Name']) ? $_POST['User_Name']:'');$Password = (isset($_POST['Password']) ? $_POST['Password']: '');$User_Name=strtolower($_POST['User_Name']);$Password=strtolower($_POST['Password']);$usercheck = mysql_query("SELECT * FROM business_info whereUser_Name='$User_Name' AND Password='$Password'",$db);$userrow = mysql_fetch_array($usercheck);$num_rows = mysql_num_rows($usercheck);$query = "SELECT * FROM business_info where User_Name='$User_Name' AND Password='$Password'";$result = mysql_query($query);while ($row = mysql_fetch_assoc($result)) {$BusinessName= $row['BusinessName'];$Keyword = $row['Keyword'];$Picture1 = $row['Picture1'];$Headline = $row['Headline'];$Slogan=$row['Slogan'];$Slogan2 = $row['Slogan2'];$Description1 =$row['Description1'];$Description2 = $row['Description2'];$Description3= $row['Description3'];$Contact2 = $row['Contact2'];$Picture2 = $row['Picture2'];$Picture3 = $row['Picture3'];$Categories=$row['Categories'];$Business_Address= $row['Business_Address'];$make=$row['make'];$type=$row['type'];$Tel= $row['Tel'];$Website=$row['Website'];}if ($num_rows!=1){print "<p><b>username and/or password not found. Tryagain?</b></p>";}else{echo"<table border='0'>"; echo" <tr>"; echo"<td valign='top'>"; echo"<table border='0'>"; echo"<tr>"; echo"<td width='100%' bgcolor='cococo'>";echo"<a href='index.php'>Home<font color='cococo'>ddddddddddddddddddddd</font></a>"; echo"</td>"; echo"</tr>"; echo"<tr>"; echo"<td>"; echo"welcome $BusinessName, <font color='ffffff'>dddddddddddddddddddfffffffffffffffffffdd</font> "; echo"</td>"; echo"</tr>"; echo"</table>"; echo"<table background='../images/fondo2.jpg' border='1' valign='top'>"; echo"<tr> "; echo"<td valign='top'>"; echo"<table border='1' background='../images/fondo2.jpg' valign='top'>";echo "<tr> "; echo"<td>"; echo"<a href= 'http://entrepreneur.com'>Pictures Uploads/change</a>"; echo"</td>"; echo"</tr>"; echo "<tr> "; echo"<td>"; echo"<a href= 'http://entrepreneur.com'>Advertise your website</a>"; echo"</td>"; echo"</tr>"; echo"<tr> "; echo"<td>"; echo"</td>"; echo"</tr>"; echo"<tr> "; echo"<td>";echo"<a href='http://69.89.27.201:2082/horde/index.php/'>Email</a>"; echo"</td>"; echo"</tr>"; echo"<tr> "; echo"<td>"; echo"</td>"; echo"</tr>"; echo"<tr> "; echo"<td>"; echo"<a href='http://www.nasdaq.com'>Stock Market</a>"; echo"</td>"; echo"</tr>"; echo"</table>"; echo"</td>"; echo"<td valign='top'> "; echo"<center><table border='1'>"; echo" <tr>"; echo"<td>";echo "<a href=\"update.php?update=true\">update</a>"; echo"</td>"; echo"<td>"; echo"<a href=\"keyword.php?keyword=true\">Add Key words</a>"; echo"</td>"; echo"<td>"; echo"<a href='http://www.ccbill.com'>CCBILL</a>"; echo"</td>"; echo"</tr>"; echo"</table></center>"; echo "Welcome to the The member session<br> here you can update your webpage<br>"; //start here$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($_GET['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 name='form' method='Post' action='Update_Page.php' > "; 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 hereecho "<td> </td>"; echo"</td>"; echo"<td valign='top'>"; echo"</td>"; echo"</tr>"; echo"</table>"; echo"</td>"; echo"</tr>";echo"</table>";}[/code]?> Link to comment https://forums.phpfreaks.com/topic/36189-updatin-database/ Share on other sites More sharing options...
Jessica Posted January 29, 2007 Share Posted January 29, 2007 tldr;You can break out of PHP to write your html.<?phpcode();?><html><?phpmoreCode();?> Link to comment https://forums.phpfreaks.com/topic/36189-updatin-database/#findComment-171922 Share on other sites More sharing options...
franknu Posted January 29, 2007 Author Share Posted January 29, 2007 so i have to eliminate the html Link to comment https://forums.phpfreaks.com/topic/36189-updatin-database/#findComment-171929 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.