0

i uploaded file but it show error.

Parse error: syntax error, unexpected '(', expecting T_STRING in ///admin.php on line 26 how can fix this error?

line is

function index($success){
    include("header.php");
    global $link,$prefix;
    if (isset($success)) {
        openTable();
        echo "<center><font color='#FF0000'>$success</font><center><br>";
        closeTable();
        echo"<br>";
        goto("index.php?file=admin");/  error line
    }
5
  • 1
    Is goto() a function you defined? Commented Oct 21, 2012 at 13:51
  • Stackoverflow is turning into a real-time debugger. goto is defined as a PHP function, but I haven't seen it used in years in any language... Commented Oct 21, 2012 at 13:54
  • @nickhar, it's just a mere operator, and it exists since PHP 5.3 indeed, see the API. Commented Oct 21, 2012 at 13:56
  • @Havelock I meant in any programming lang - not php. Commented Oct 21, 2012 at 13:57
  • 2
    If goto should work as a redirect function then why echo something before? Commented Oct 21, 2012 at 13:58

3 Answers 3

3

Most probably you're using PHP 5.3, where goto is an operator and in that line you're calling a custom function goto(), which you've defined.

Solution: rename your function, something like go_to() will help.

Sign up to request clarification or add additional context in comments.

Comments

1

Please refer PHP manual for goto here: http://php.net/manual/en/control-structures.goto.php

goto is used to shift execution to a different point in the same code file and you need to specify an identifier for another location in your code in the same file (refer to the example given in the PHP manual link). If you want to go to another link, use header() method instead.

header("Location:index.php?file=admin");

Manual here: http://php.net/manual/en/function.header.php

1 Comment

Well, I do not see any search code here as well as the question is too generic. Are you using a database? Then it depends totally on the schema of the database. As far as retrieving the data in your PHP and displaying it is concerned, you can refer to some tutorials on database connectivity. In case you are using MySQL, you can check out the link here: (php.about.com/od/phpwithmysql/ss/mysql_php.htm)
0

I've never used goto, but I just looked it up in the manual and they never used brackets around the destination. However if you want to redirect to another page, I think you're using the wrong method.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.