Current location: Hot Scripts Forums » Programming Languages » PHP » php or mysql parse error ( ? )


php or mysql parse error ( ? )

Reply
  #1 (permalink)  
Old 03-06-04, 12:19 PM
jrave jrave is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy php or mysql parse error ( ? )

im making a league for my clan and ive got this error which ive had before and solved easyily since it was always my silly bad syntax errors... however this one has me:

PHP Code:

                $result mysql_query("SELECT * FROM league_teams") or die("Query failed: " mysql_error());

                
$numteams mysql_num_rows($result);
                
$newteamid = ++$numteams;
                
$newteamname $_REQUEST['teamName'];
                
$query "INSERT INTO league_teams (team_id, team_name, team_wins, team_draws, team_losses, team_kills) VALUES ('$newteamid', '$newteamname','0','0','0','0')";
                
$result mysql_query($query) or die("Query failed: " mysql_error());

                
$result mysql_query("SELECT * FROM league_players") or die("Query failed: " mysql_error());
                
$numplayers mysql_num_rows($result);

                print 
"Debugging:<br>\n"//debugging
                
print "newteamid: $newteamid<br>\n"//debugging
                
print "numplayers: $numplayers<br>\n"//debugging

                
for ($i 0$i <= 10$i++) {
                    
$numplayers++;
                    
$playeraddname $_REQUEST['playerName$i'];
                    
$playeraddrank $_REQUEST['playerRank$i'];
                    
$playeraddid $numplayers;
                    print 
"playeraddname$i = $playeraddname <br>\n"//debugging
                    
print "playeraddrank$i = $playeraddrank <br>\n"//debugging

                    
if(!empty($playeraddname) && isset($playeraddname) && !empty($playeraddrank) && isset($playeraddrank)) {
                        
$query "INSERT INTO league_players (team_id, player_name, player_rank, player_played, player_kills, player_id) VALUES ('$newteamid', '$playeraddname', '$playeraddrank', '0', '0', '$playeraddid')";
                        
$result mysql_query($query) or die("Query failed: " mysql_error()); //error line
                    
}
                }
                
showMain(''); 
i cant see it, am i doing something i shouldnt?! the input form has ten rows of text inputs.. player names and ranks and a single input text box for the team name.

the error is:

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/father/public_html/bseteam/league/admin.php on line 97

thanks in advance for anyhelp anyone can give me
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-07-04, 11:38 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
it will help alot to know which line in your code has the error!! it says it's in line 97,, bring lines 95-100 so we check ..
anyway I checked your code and it seems fine .. this kind of errors appear when a semicolon/dot is missing!
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-07-04, 05:07 PM
jrave jrave is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy

i marked the line in the code with "// error line". and i looked up and down for a semi colon missing or other parse error but could not find it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 03-07-04, 05:13 PM
Infinite_Hackers's Avatar
Infinite_Hackers Infinite_Hackers is offline
Coding Addict
 
Join Date: Dec 2003
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Code:

$result mysql_query("SELECT * FROM league_teams") or die("Query failed: " mysql_error());

                
$numteams mysql_num_rows($result);
                
$newteamid $numteams++;
                
$newteamname $_REQUEST['teamName'];
                
$query "INSERT INTO league_teams (team_id, team_name, team_wins, team_draws, team_losses, team_kills) VALUES ('$newteamid', '$newteamname','0','0','0','0')";
                
$result mysql_query($query) or die("Query failed: " mysql_error());

                
$result mysql_query("SELECT * FROM league_players") or die("Query failed: " mysql_error());
                
$numplayers mysql_num_rows($result);

                print 
"Debugging:<br>\n"//debugging
                
print "newteamid: $newteamid<br>\n"//debugging
                
print "numplayers: $numplayers<br>\n"//debugging

                
for ($i 0$i <= 10$i++) {
                    
$numplayers++;
                    
$playeraddname $_REQUEST['playerName$i'];
                    
$playeraddrank $_REQUEST['playerRank$i'];
                    
$playeraddid $numplayers;
                    print 
"playeraddname $i = $playeraddname <br>\n"//debugging
                    
print "playeraddrank $i = $playeraddrank <br>\n"//debugging

                    
if(!empty($playeraddname) && isset($playeraddname) && !empty($playeraddrank) && isset($playeraddrank)) {
                        
$query "INSERT INTO league_players (team_id, player_name, player_rank, player_played, player_kills, player_id) VALUES ('$newteamid', '$playeraddname', '$playeraddrank', '0', '0', '$playeraddid')";
                        
$result mysql_query($query) or die("Query failed: " mysql_error()); //error line
                    
}
                }
                
showMain(''); 
the $newteamid was messed...
also idk maby right or not but showMain(''); is that corrent? should be.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 03-08-04, 07:24 PM
jrave jrave is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb

lol, thanks for the replys guys.. but i was barking in the wrong bloomin forest..lmao.. i not only marked the wrong error line.. but i posted the wrong block of code and the error turned out to be one of my debugging lines which i constantly over looked. hey i was tired... wheres the embarrased smilie in this place?

but thanks for your help guys
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 03-08-04, 07:26 PM
Infinite_Hackers's Avatar
Infinite_Hackers Infinite_Hackers is offline
Coding Addict
 
Join Date: Dec 2003
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
yet
$newteamid = $numteams++;
was first wrong ;D
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 03-09-04, 08:49 AM
jrave jrave is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
is it? i was under the impression that ++$var would increase the var by one then print it and $var++ would print then increase?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 03-09-04, 12:08 PM
Infinite_Hackers's Avatar
Infinite_Hackers Infinite_Hackers is offline
Coding Addict
 
Join Date: Dec 2003
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
NVm your rit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #9 (permalink)  
Old 03-09-04, 02:14 PM
jrave jrave is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
lol ty anyway
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error when trying to create MySQL table via PHP HasansWeb PHP 5 05-19-11 07:59 AM
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 03:22 AM
PHP, MySQL, WML superman PHP 0 03-04-04 11:46 AM
[php error] parse error | fatal error xeoHosting PHP 1 01-03-04 09:12 PM
php error plz help darkcarnival PHP 2 11-19-03 09:14 PM


All times are GMT -5. The time now is 12:22 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.