Page 1 of 1

updating the database

Posted: Wed Mar 28, 2007 11:49 am
by franknu
i need some


Code: Select all

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 (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'>";
i added this line...

Code: Select all

<input type='text' name='BusinessName'  Value='$_POST['BusinessName'],'>";
bu then i got a syntax error on this line any help please

Posted: Wed Mar 28, 2007 11:54 am
by RobertGonzalez
The line you added isn;t quoted properly.

Posted: Wed Mar 28, 2007 11:57 am
by franknu
what is the right quatation for those

thank you..

Posted: Wed Mar 28, 2007 12:02 pm
by RobertGonzalez
You might want to consider something like this...

Code: Select all

<?php
if (isset($_POST['submit']))
{
  $sql = "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($sql) or die (mysql_error());
}
?>

<table bgcolor='ffffff'>
  <tr>
    <td>
      <table>
        <tr>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td></td>
  </tr>
  <tr>
    <td>
      <table> 
        <tr>
          <td>
             <table bgcolor='ffffff '>
              <tr>
                <td>
                  <table>
                    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method='Post'>
                    <tr>
                      <td>
                        Business Info
                      </td>
                    </tr>
                    <tr>
                      <td>
                        <table>
                          <tr>
                            <td>
                              Business Name
                            </td>
                            <td>
                              <input type='text' name='BusinessName'  Value='<?php echo $BusinessName; ?>'>
                             </td>
                          </tr>
                          <tr>
                            <td>
                              Slogan
                            </td>
                            <td>
                              <input type='text' NAME='Slogan' value='<?php echo $Slogan; ?>'>
                            </td>
                            <td>
                              Website
                            </td>
                            <td>
                              <input type='text' name='Website' value='<?php echo $Website; ?>'>
                            </td>
                          </tr>
                          <tr>
                            <td>
                              Tel
                            </td>
                            <td>
                              <input type='text' name='Tel' value='<?php echo $Tel; ?>'>

Posted: Wed Mar 28, 2007 12:09 pm
by franknu
i am sorry, but i dont see the diffrents, i dont want to be a jackass but i also want to learn can you explain please

Posted: Wed Mar 28, 2007 12:32 pm
by RobertGonzalez
There is not a whole lot of difference other than the cleanliness of the code. I guess what I would like to know is what is not working that you need help with? You said earlier that you got a parse error. Well, if you limit the amount of parsing to do (which is what I did) your chance for errors goes way down. Have you run the code I posted yet?