Click to See Complete Forum and Search --> : problem with a line in my code


ezio2010
October 20th, 2010, 04:20 PM
hi i've been working on a web based event reporter for a card game that i love but when i test the section of code it comes up with an error message

this is the error i get

Parse error: syntax error, unexpected T_VARIABLE in /www/zxq.net/m/w/s/mws-repoter/htdocs/match-ups.php on line 52


here is my code for the page


<?php
require_once('auth.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Event Started
</title>
<link href="loginmodule.css" rel="stylesheet" type="text/css" />
<?php


//Include database connection details
require_once('config.php');


//Array to store validation errors
$errmsg_arr = array();

//Validation error flag
$errflag = false;

//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$link) {
die('Failed to connect to server: ' . mysql_error());
}

//Select database
$db = mysql_select_db(DB_DATABASE);
if (!$db) {
die("Unable to select database");
}

//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
$str = @trim($str);
if (get_magic_quotes_gpc ()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}

//Sanitize the POST values
$EventName= clean($_POST['EventName']);
$RoundNUM= clean($_POST['Round']);
mysql_query("UPDATE event SET event_round = '$RoundNUM' where event_name = '$EventName'")

// pairings
$roundsql="SELECT * FROM event WHERE event_state='open'"; //this is the line i get the error from
if ($result=mysql_query($roundsql)) {
if ($row=mysql_fetch_row($result)) {
if($row[event_round]==1){

$sql = "SELECT * FROM members where picked='0'";
echo "<table border='1'>";
do {
// Select records from the DB
$query = "SELECT * FROM members WHERE event='1' AND picked='0'
ORDER BY Rand() LIMIT 2";
$result = mysql_query($query);

while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
$PlayerOne=$row[3];
mysql_query("update members set picked='1' where login='$row[3]'") or die(mysql_error());
}
// Display records from the table

while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
$PlayerTwo=$row[3];
mysql_query("update members set picked='1' where login='$row[3]'") or die(mysql_error());
}
mysql_query("INSERT INTO games(plaery1,player2) VALUES('$PlayerOne', '$PlayerTwo')")
} while ($Result = mysql_query($sql));
}
}
}
}
?>
</head>

<body>
<p>
Pairings done Please go to <a href="view-event.php">View Event</a> and see the listings
</p>
</body>
</html>


could someone help me as to where i goin wrong

PeejAvery
October 21st, 2010, 03:26 PM
99% of the time, that means you forgot a semicolon. So, look at the line above 52.

ezio2010
October 21st, 2010, 07:09 PM
thanks i will bear that one in mind. i'm guessing php is like C++ in that way