Jump to content

updatin database


franknu

Recommended Posts

ok I want to update data from my database any idea

 

here is my updating code

 


$sql = "SELECT * FROM business_info WHERE BusinessName = '$BusinessName' AND User_Name = '$User_Name'";
$result = mysql_query($query) or die ("Problem with the query: <pre>$sql</pre><br>" . mysql_error());
$res2 = mysql_fetch_assoc($result); 




if(isset($_POST["submit"]))




{

$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 ("Problem with the query: <pre>$query</pre><br>" . mysql_error());

}






echo"<table bgcolor='ffffff'>";

  echo"<tr><td> <table><tr> </tr>  </table>  </td></tr><tr><td></td>
  </tr><tr><td>  <table> <tr> <td><table bgcolor='ffffff'>
<tr> <td>

<table> ";


//208


echo '<form action="'. $_SERVER['PHP_SELF'].'" method="post">';





echo"<tr>";

echo"<td> Busiess Info </td></tr><tr>
    <td>
    <table>
        <tr>
          <td>
          Business Name
          </td>
          <td>";

echo"<input type='text' name='BusinessName'  Value='$BusinessName'> </td>
</tr> <tr> <td> Slogan </td>        <td>";

echo"<input type='text' NAME='Slogan' value='$Slogan'>";

echo"</td> <td> Website </td> <td> <input type='text' name='Website' value='$Website'> </td>";
       
echo"</tr>
        <tr>
          <td>
          Tel
          </td>
          <td>";

          echo"<input type='text' name='Tel' value='$Tel'>";
         echo"</td>";
          echo"<td>
          Key Words
          </td>
          <td>";
        echo"<input type='text' name='Keyword' value='$Keyword'>";
       echo"</td>
       </tr>
        <tr>
          <td>
          Fax
         </td>
          <td>";
          echo"<input type='text' name='Fax' value='$fax'>";
          echo"</td> 
          <td>
         Address
echo"<input type='submit'  value='Update my database' name='submit' />";
      echo"  <input type='reset' value='Reset fields' />";
      echo"<td> 
  </form>

 

i can pull all the data out my problem is that when i hit the submmit bottom it  doesnt make the changes

 

 

maybe i have to do something inside the value="$_POST'[variable']

 

please help

please help

Link to comment
https://forums.phpfreaks.com/topic/45001-updatin-database/
Share on other sites

@ Franknu: PLEASE use the code tags to wrap your php code so it displays properly.

 

Hints:

1. the first three lines of what you posted are pointless

2. nothing will ever get into a database before you make a database connection AND select a database

3. before trying to enter data into the database, you need to abstract the POSTed values from the $_POST array.

 

Perhaps it would help if you read one of the tutorials on the site about databases.

Link to comment
https://forums.phpfreaks.com/topic/45001-updatin-database/#findComment-218472
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.