are you accessing another page using include (); cause its saying that $result is in the wrong spot. or your missing a ;, i'd have to see more code to help you
are you accessing another page using include (); cause its saying that $result is in the wrong spot. or your missing a ;, i'd have to see more code to help you
$result is in the next line of code, it's:
PHP Code:
$result = safe_query($sql);
and here's safe query:
PHP Code:
function safe_query ($query = "")
{
if (empty($query)) {return FALSE; }
$result = mysql_query($query)
or die("ack! query failed: "
."<li>errorno=".mysql_errno()
."<li>error=".mysql_error()
."<li>query=".$query
);
return $result;
}
function safe_query ($query = "")
{
if (empty($query)) {return FALSE; }
$result = mysql_query($query)
or die("ack! query failed: "
."<li>errorno=".mysql_errno()
."<li>error=".mysql_error()
."<li>query=".$query
);
return $result;
}
the error is here
PHP Code:
$db = mysql_connect("dgunning.db.8219830.hostedresource.com", "*****", "******");
mysql_select_db("dgunning", $db) or die(mysql_errno() . ": " . mysql_error() . "<br>");
$sql = "SELECT op.name, op.stnum, op.direction, op.street, arch.architect, op.yearbuilt, op.url, op.id FROM op, arch
WHERE op.archno = arch.archno AND op.stnum = htmlspecialchars($_GET['stnum']) AND op.direction = htmlspecialchars($_GET['dir']) AND
op.street = htmlspecialchars($_GET['street'])";
#HERE IS THE ERROR SWITCH THE ';' and the " around
$sql = "SELECT op.name, op.stnum, op.direction, op.street, arch.architect, op.yearbuilt, op.url, op.id FROM op, arch WHERE op.archno = arch.archno AND op.stnum = htmlspecialchars($_GET['stnum']) AND op.direction = htmlspecialchars($_GET['dir']) AND op.street = htmlspecialchars($_GET['street'])";
Should be:
PHP Code:
$sql = "SELECT op.name, op.stnum, op.direction, op.street, arch.architect, op.yearbuilt, op.url, op.id FROM op, arch WHERE op.archno = arch.archno AND op.stnum = '$_GET[stnum]' AND op.direction = '$_GET[dir]' AND op.street = '$_GET[street]'";
Inside a "double quoted" string, you do not use single['quotes'] in your arrays. This will cause the error you have been complaining of. Also as far as I'm aware, mysql doesn't have that htmlspecialchars() function. In php again, inside your "double quoted" string, you cannot use a function. It IS a PHP function so you must use it in PHP and not inside a string:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
That did it, the query is executing now. I have some additional issues later on in the code, but I'll see if I can get them working myself before asking for any additional help. Thanks a lot!