Jump to content

[SOLVED] Parse Error


karyoker

Recommended Posts

Usually this means error in the last line

<?php


$myServer = "localhost";

$myUser = "cabaretk";

$myPass = "xxxxxxxxx";

$myDB = "cabaretk_phpbb2";

mysql_connect("localhost", "cabaretk", "cab9876") or die(mysql_error());
mysql_select_db("cabaretk_phpbb2") or die(mysql_error());


             while($row = mysql_fetch_array($result)) {

             $result = mysql_query("SELECT * username FROM phpbb_users))
            or die(mysql_error());

             INSERT INTO _accounts (user)  VALUES(user_name)
               or die(mysql_error());

   }

39.     ?>

 

Parse error: parse error in c:\apache\htdocs\phbb2\hd355\transfer.php on line 39

 

What do I have wrong?

 

Link to comment
https://forums.phpfreaks.com/topic/43282-solved-parse-error/
Share on other sites

Should be

<?php


$myServer = "localhost";

$myUser = "cabaretk";

$myPass = "xxxxxxxxx";

$myDB = "cabaretk_phpbb2";

mysql_connect("localhost", "cabaretk", "cab9876") or die(mysql_error());
mysql_select_db("cabaretk_phpbb2") or die(mysql_error());


             while($row = mysql_fetch_array($result)) {

             $result = mysql_query("SELECT * username FROM phpbb_users))
            or die(mysql_error());

           $insert =  mysql_query("INSERT INTO _accounts (user)  VALUES(user_name)") or die(mysql_error());

   }

?>

Link to comment
https://forums.phpfreaks.com/topic/43282-solved-parse-error/#findComment-210163
Share on other sites

$result = mysql_query("SELECT * username FROM phpbb_users)) or die(mysql_error());

 

Even if you get rid of the parse error, you'll just get a MySQL error from that query.

 

Perhaps you want to close the query string (missing ") and either select * or select username ...

 

$result = mysql_query("SELECT username FROM phpbb_users") or die(mysql_error());

Link to comment
https://forums.phpfreaks.com/topic/43282-solved-parse-error/#findComment-210182
Share on other sites

I give up Im not that proffiecent with php or mysql I have debugged 1000 line assembly language programs.. No matter what combination I get errors The latest is

 

15.                 $result = mysql_query("SELECT * user_name FROM phpbb_users"))
            or die(mysql_error());

             while($row = mysql_fetch_array($result))  {

                $insert = mysql_query("INSERT INTO _accounts (user)
             VALUES(user_name)") or die(mysql_error());

        }

      ?>

 

Parse error: parse error in c:\apache\htdocs\phbb2\hd355\transfer.php on line 15

 

With this code    $result = mysql_query("SELECT * user_name FROM phpbb_users")

 15.        $result = mysql_query("SELECT * user_name FROM phpbb_users")
            or die(mysql_error());

             while($row = mysql_fetch_array($result))  {

                $insert = mysql_query("INSERT INTO _accounts (user)
             VALUES(user_name)") or die(mysql_error());

        }

      ?>

You have an error in your SQL syntax near 'user_name FROM phpbb_users' at line 1

Im debating a loop counter and using pure mysql code...  When I get this to work I want to move 4 or 5 fields...And modify the login.php  in the forum to insert into _account  with a new registry.. It's beer/thirty

Link to comment
https://forums.phpfreaks.com/topic/43282-solved-parse-error/#findComment-210222
Share on other sites

Andy I finally got it..

 

   mysql_query($query);
                 $result = mysql_query("SELECT  username FROM phpbb_users")
            or die(mysql_error());

               while($row = mysql_fetch_array($result))  {

                $query=("INSERT INTO _accounts (User)
                    FROM (username) phpbb_users")
              or die(mysql_error());
            
        }
      ?>

Link to comment
https://forums.phpfreaks.com/topic/43282-solved-parse-error/#findComment-210720
Share on other sites

Actually here is a better and final one

      $query  = "SELECT username, user_password, user_email FROM phpbb_users";
                       $result = mysql_query($query);

while(list($name,$pass,$email)= mysql_fetch_row($result))
{
    echo "Name :$name " .
         "pass : $pass " .
         "email : $email <br>";
           $query=("INSERT INTO _accounts (User,Pass,email_addr)
                     Values ('$name','$pass','$email')");
             mysql_query($query) or die('Error, insert query failed');
}

Link to comment
https://forums.phpfreaks.com/topic/43282-solved-parse-error/#findComment-210877
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.