RE: [PHP] Easy Form problem
| From: | Matt Schroebel | Date: | Thu, 19 Apr 2001 13:43:26 +0000 |
| Subject: | RE: [PHP] Easy Form problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-49365@lists.php.net to get a copy of this message | ||
You need to run the mysql_db_query() twice. Once for each statement, and between the assignments:
$query = ...;
$mysql_db_query(...);
$query = ...;
$mysql_db_query(...);
> I am trying to update two tables at once from a form using two Insert
> statements:
>
> Should I be using two different variable names for $query?
> Only one table
> updates when I use the same name like this. 2 different
> variable names
> give me an error.
>
> $query = "INSERT INTO $table1 VALUES ('$menu_id', '$server',
> '$menunumber', '$menuname')";
> $query = "INSERT INTO $table2
> VALUES('$submenuid','$submenu','$subrefmenu',
> '$submreflink')";
>
> $result = mysql_db_query($dbname, $query);
>
> I use one form using one submit button:
>
> <form enctype="multipart/form-data" method="post"
> action="<?php echo $PHP_SELF ?>">
>
>
> <INPUT type="submit" name="submit" value="submit">
> <INPUT type=reset value="Reset">
>
> // Display Results if there are results
> if ($result) {
>
> MySQL error 0: menu_id: NULL
>
>