karyoker Posted March 18, 2007 Share Posted March 18, 2007 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 More sharing options...
papaface Posted March 18, 2007 Share Posted March 18, 2007 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 More sharing options...
karyoker Posted March 18, 2007 Author Share Posted March 18, 2007 THANKS!! I been trying for 3 weeks to "merge" a help desk into a phpbb2 forum.. It's not easy.. Link to comment https://forums.phpfreaks.com/topic/43282-solved-parse-error/#findComment-210167 Share on other sites More sharing options...
karyoker Posted March 18, 2007 Author Share Posted March 18, 2007 `Cept now I'm getting a parse error on the line we just inserted.. And I know the syntax is right....???? It can be in a loop right? Link to comment https://forums.phpfreaks.com/topic/43282-solved-parse-error/#findComment-210180 Share on other sites More sharing options...
AndyB Posted March 18, 2007 Share Posted March 18, 2007 $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 More sharing options...
karyoker Posted March 18, 2007 Author Share Posted March 18, 2007 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 More sharing options...
AndyB Posted March 19, 2007 Share Posted March 19, 2007 get rid of the * in * username - that's a syntax error. Link to comment https://forums.phpfreaks.com/topic/43282-solved-parse-error/#findComment-210238 Share on other sites More sharing options...
karyoker Posted March 19, 2007 Author Share Posted March 19, 2007 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 More sharing options...
karyoker Posted March 20, 2007 Author Share Posted March 20, 2007 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.