I'm using PHP 4.3, Apache 2.0, and Mysql 4.0 to run the following code on my Win 2K Pro machine. once I open my browser the form loads fine, but once I click on the submit button with ALL in the text area, I get the following error message:
Forbidden
You don't have permission to access /<br /><b>Notice</b>: Use of undefined constant scriptName - assumed 'scriptName' in <b>C:/Program Files/Apache Group/Apache2/htdocs/TMP21ctvg80eo.php</b> on line <b>42</b><br />scriptName on this server.
--------------------------------------------------------------------------------
Apache/2.0.46 (Win32) Server at localhost Port 80
Not sure why I am getting this error message. Have run several succesful examples of querying from the Mysql database already. Any help is appreciated. Thanks.
<html>
<body>
<?php
include 'db.inc';
include 'error.inc';
function displayWinesList($connection, $query, $regioname)
{
if (!($result = @ mysql_query ($query, $connection)))
showerror();
$rowsFound = @ mysql_num_rows($result);
if ($rowsfound > 0)
{
echo "Wines of $regionName<br>";
echo "\n<table>\n<tr>" .
"\n\t<th>\wine id</th>" .
"\n\t<th>\wine name</th>";
while ($row = @ mysql_fetch_array($result))
{
echo "\n<tr>".
"\n\t<td>" . $row["wine_id"] . "</td>" .
"\n\t<td>" . $row["wine_name"] . "</td>" .
"\n</tr>";
} //end while loop
echo "\n</table>";
} //end of $rowsFound
echo "$rowsFound records found matching your black ass, biaatach<br>";
} //end of function
$scriptName = "test2.php";
if(empty($regionName))
{
?>
<form action="<?=scriptName;?>" method="get">
<br>Enter a region, you fuck:
<input type="text" name = regionName value = all>
(type all to see all regions)
<br>
<input type=submit value=click this, asshole>
</form><br>
<a href=index.html>Home</a>
<?php
}
else
{
$regionName = clean($regionName, 30);
if (!($connection = @ mysql_connect($hostname, $username, $password)))
die("could not connect to DB"
;
if (!mysql_select_db($databaseName, $connection))
showerror();
//start a query
$query = "SELECT w.wine_id,
w.wine_name
FROM region r, wine w
WHERE r.region_name = w.wine_name";
if ($regionName != "ALL"
$query .= " AND r.region_name = \"$regionName\"";
$query .=" ORDER BY w.wine_name";
displayWineList($connection, $query, $regionName);
mysql_close($connection);
}
?>
</body>
</html>
Forbidden
You don't have permission to access /<br /><b>Notice</b>: Use of undefined constant scriptName - assumed 'scriptName' in <b>C:/Program Files/Apache Group/Apache2/htdocs/TMP21ctvg80eo.php</b> on line <b>42</b><br />scriptName on this server.
--------------------------------------------------------------------------------
Apache/2.0.46 (Win32) Server at localhost Port 80
Not sure why I am getting this error message. Have run several succesful examples of querying from the Mysql database already. Any help is appreciated. Thanks.
<html>
<body>
<?php
include 'db.inc';
include 'error.inc';
function displayWinesList($connection, $query, $regioname)
{
if (!($result = @ mysql_query ($query, $connection)))
showerror();
$rowsFound = @ mysql_num_rows($result);
if ($rowsfound > 0)
{
echo "Wines of $regionName<br>";
echo "\n<table>\n<tr>" .
"\n\t<th>\wine id</th>" .
"\n\t<th>\wine name</th>";
while ($row = @ mysql_fetch_array($result))
{
echo "\n<tr>".
"\n\t<td>" . $row["wine_id"] . "</td>" .
"\n\t<td>" . $row["wine_name"] . "</td>" .
"\n</tr>";
} //end while loop
echo "\n</table>";
} //end of $rowsFound
echo "$rowsFound records found matching your black ass, biaatach<br>";
} //end of function
$scriptName = "test2.php";
if(empty($regionName))
{
?>
<form action="<?=scriptName;?>" method="get">
<br>Enter a region, you fuck:
<input type="text" name = regionName value = all>
(type all to see all regions)
<br>
<input type=submit value=click this, asshole>
</form><br>
<a href=index.html>Home</a>
<?php
}
else
{
$regionName = clean($regionName, 30);
if (!($connection = @ mysql_connect($hostname, $username, $password)))
die("could not connect to DB"

if (!mysql_select_db($databaseName, $connection))
showerror();
//start a query
$query = "SELECT w.wine_id,
w.wine_name
FROM region r, wine w
WHERE r.region_name = w.wine_name";
if ($regionName != "ALL"

$query .= " AND r.region_name = \"$regionName\"";
$query .=" ORDER BY w.wine_name";
displayWineList($connection, $query, $regionName);
mysql_close($connection);
}
?>
</body>
</html>