Can anyone tell me what's wrong with this bit of code generated by Dreamweaver:

<?php
$varLocation_qryJobBoard = "%";
if (isset(#Location#)) {
$varLocation_qryJobBoard = (get_magic_quotes_gpc()) ? #Location# : addslashes(#Location#);
}

I keep getting the message:

Parse error: syntax error, unexpected '=', expecting ',' or ')' in /home/skeetco/public_html/SearchResults.php on line 5 (which would be line 3 above)

Any help greatly appreciated.

    Because an unquoted "#" character indicates the start of a comment. Presumably "#Location#" is some sort of place-holder that you are supposed to replace with an actual variable name. As written above, what is actually interpreted as PHP code would have the comments stripped out, meaning the actual code to be interpreted would be:

    <?php
    $varLocation_qryJobBoard = "%";
    if (isset(
    $varLocation_qryJobBoard = (get_magic_quotes_gpc()) ? 
    }
    

      Thanks NogDog,

      I am now getting the following:

      Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in /home/skeetco/public_html/SearchResults.php on line 5

      The code reads as follows:

      Line 1 <?php require_once('Connections/connJobBoard.php'); ?>
      Line 2 <?php
      Line 3 $varLocation_qryJobBoard = "%";
      Line 4
      Line 5 if (isset(Location)) {
      Line 6 $varLocation_qryJobBoard = (get_magic_quotes_gpc()) ? Location : addslashes(Location);
      Line 7}

      Any ideas?

        It doesn't know how to interpret the line:

        Line 5 if (isset(Location)) {

        Is "Location" a variable? I'd imagine it must be since there's no other user for isset other than to check for the existence of the given variable... therefore it would need to be preceeded by a $ sign so PHP will understand how to utilize it within the [man]isset/man function.

        Line 5 if (isset($Location)) {

          Hi Guys,

          Just to let you know, I have resolved this. As stated in the error message, I needed to add a $ to the variable.

          DOH - should learn to read before posting eh!!

          Thanks again, your posting put me on the right track.

            Write a Reply...