I have a fairly simple PHP script.
The first portion is a FORM which queries a
mysql database for a serialnumber
<?php
unset ($stage);
if (!isset($stage))
{
?>
<FORM METHOD="POST" ACTION="<?php print("$PHP_SELF"); ?>">
-- HTML TABLE FORM STUFF HERE --
Now from my understanding, it should not process when happens in the else statement because $stage is not set yet (I have a hidden value setting stage to 1 in the first form), it will only look at the else portion if $stage is set with a value
However, when I test the page out, it gives me a parse error for one of the queries in the else statement (pasted below).
Obviously the queries will not work because i need the 5 digit number to be queried first!... From what I've read on php.net/manual the following should work...
Can someone shed some light on this subject?
<?php
}
else
{
include("/var/www/phpincludes/info.inc");
// Connect to database
$global_dbh = mysql_connect($hostname, $username, $password);
if (!$global_dbh)
die("Cannot Connect to Database");
mysql_select_db($db, $global_dbh);
// Find the spa
// Insert sanity checking here someday
$query = "SELECT * from spaserial where serialnum=\"wspanumquery\"";
$result_query = mysql_query($query);
$row = mysql_fetch_row($result_query);
// Find the Dealer
$dealer_query = "SELECT store_name from dealer where dealer_id=\"$row[3]\"";
$result_dealer = mysql_query{$dealer_query);
$row_dealer = mysql_fetch_row($result_dealer);
// Find the Model
$model_query = "SELECT modelname from spamodel where modelabbr=\"$row[5]\"";
$result_model = mysql_query($model_query);
$row_model = mysql_fetch_row($result_model);
?>