Web Analytics Made Easy -
StatCounter T_VARIABLE Error - CodingForum

Announcement

Collapse
No announcement yet.

T_VARIABLE Error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • T_VARIABLE Error

    Hi Guys

    Please help, i have tried to code this and keep getting


    Parse error: parse error, unexpected T_VARIABLE, expecting ',' or ';' in /home/httpd/vhosts/xxxxx.com/httpdocs/php/users/reg.php on line 160


    it happens with this code

    PHP Code:
    function addNewUser($title$f_name$surname$address1$address2$towncity$countystate$zippostcode$country$telnum$mobnum$faxnum$email$username$password){
       global 
    $conn
       $q 
    "INSERT INTO users VALUES('$title', '$f_name', '$surname', '$address1', '$address2', '$towncity', '$countystate', '$zippostcode', '$country', '$telnum', '$mobnum', '$faxnum', '$email', '$username')";
       
    $q1 "INSERT INTO user_id VALUES('$username', '$password', '$email', '0', '0', '$f_name')";
       return 
    mysql_query($q,$conn);
       return 
    mysql_query($q1,$conn);

    please help,....

    pete

  • #2
    global $conn

    Does that need an ';' affter it? I'm not sure.

    Comment


    • #3
      Thanks Desinc

      Thanks Mate

      All Working OK Now

      Pete

      Comment


      • #4
        for the record, you can't return two values like that...as soon as it hits the first return statement, it exits the function. to return two values, return them as an array

        PHP Code:
        function addNewUser($title$f_name$surname$address1$address2$towncity$countystate$zippostcode$country$telnum$mobnum$faxnum$email$username$password){
           global 
        $conn
           $q 
        "INSERT INTO users VALUES('$title', '$f_name', '$surname', '$address1', '$address2', '$towncity', '$countystate', '$zippostcode', '$country', '$telnum', '$mobnum', '$faxnum', '$email', '$username')";
           
        $q1 "INSERT INTO user_id VALUES('$username', '$password', '$email', '0', '0', '$f_name')";
          
        $res1mysql_query($q,$conn);
           
        $res2mysql_query($q1,$conn);
        return array(
        $res1,$res2);

        Comment

        Working...
        X