Ibshas25 Posted November 12, 2010 Share Posted November 12, 2010 <b>Parse error</b>: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in <b>/export/SOI-50/students/m2009/abhr428/web/WebIbs/UserSearchPBT.php</b> on line <b>115</b><br /> <?php include("JSON.php"); require_once("connectdb.php"); $req = json_decode(stripslashes($_POST['data']), true); $req["SuccFail"]="fail"; $req["SuccFailMessage"]="Error Occured."; //$logFile = 'logFile'; // error_log("isl=baþladý: ", 3, $logFile); if ($req['operation'] == "usersearch") // select için veri geldi { // error_log("isl==select oluþuyor: ", 3, $logFile); $sql= "select usr_id, usr_username,usr_name,usr_surname,usr_email,usr_mobphone,usr_phone,usr_isuseractive from users"; $sql.=" where (usr_name is null or usr_name like '". $req['user'][0]['name']."%' ) and "; $sql.= "(usr_surname is null or usr_surname like '". $req['user'][0]['surname']."%' ) "; $sql .= " order by usr_name , usr_surname"; // error_log($sql, 3, $logFile); // error_log("sql: ".$sql, 3, $logFile); // error_log("\n", 3, $logFile); $result = mysql_query($sql); $reslist = "<table border='1'><tr><th>User Id</th><th>Username</th><th>Name</th><th>Surname</th><th>Email</th><th>Is Active</th></tr>"; while($row = mysql_fetch_array($result)) { // error_log("user: ".$row['usr_name']." surname :".$row['usr_username'], 3, $logFile); $reslist .= "<tr><td><a href='#' onclick='javascript:UserSearchChoose(".$row['usr_id'].", ".chr(34).$row['usr_username'].chr(34).",".chr(34).$row['usr_name'].chr(34).", ".chr(34).$row['usr_surname'].chr(34).",".chr(34).$row['usr_email'].chr(34).", ".chr(34).$row['usr_phone'].chr(34).",".chr(34).$row['usr_mobphone'].chr(34).", ".chr(34).$row['usr_isuseractive'].chr(34).");' >".$row['usr_id']."</a></td><td>".$row['usr_username']."</td><td>".$row['usr_name']."</td><td> ".$row['usr_surname']."</td><td>".$row['usr_email']."</td><td>".$row['usr_isuseractive']."</td></tr>"; } // error_log($reslist, 3, $logFile); // error_log("$reslist: ".$reslist, 3, $logFile); $reslist .= "</table>"; $req["SuccFail"]="success"; //operation success or fail $req["SuccFailMessage"]="successfully selected."; //alert($reslist); $req["ResultData"]=$reslist; mysql_close($conn); header("Content-type: text/plain"); echo json_encode($req); return; } else if ($req['operation'] == "userlist") // select için veri geldi { // error_log("isl==teamslist select oluþuyor: ", 3, $logFile); $sql="select usr.usr_name,usr.usr_surname where usr.usr_id =".$req['user'][0][usr_id]; $sql.=" order by usr.usr_name , usr.usr_surname "; $result = mysql_query($sql); $reslist = "<table border='1'><tr><th>Users Info</th> </tr>"; while($row = mysql_fetch_array($result)) { // error_log("user: ".$row['usr_name']." surname :".$row['usr_username'], 3, $logFile); //$user = $row['usr_name']." ".$row['usr_surname']; //$user = $row['usr_name']." ".$row['usr_surname']; $reslist .= "<tr><td><a href='#' onclick='javascript:userListChoose(".$row['usr_name'].chr(34).",".chr(34).$row['usr_surname'].chr(34).");'> </a></td></tr>"; $reslist .= "</table>"; $req["SuccFail"]="success"; //operation success or fail $req["SuccFailMessage"]="successfully selected."; //alert($reslist); $req["ResultData"]=$reslist; mysql_close($conn); header("Content-type: text/plain"); echo json_encode($req); return; } if ($req['operation'] == "userdelete") // teams silmek için geldi. { //error_log("isl==teamdelete: ", 3, $logFile); //$sql="delete from teams where tea_id=".$req['teamid']; mysql_query("delete from users where usr_id=".$req['userid']); //error_log("mysql_affected_rows= ".mysql_affected_rows($con), 3, $logFile); //var $affrows = mysql_affected_rows(); if ( mysql_affected_rows() > 0 ) { $req["SuccFail"]="success"; //operation success or fail $req["SuccFailMessage"]="successfully deleted."; //error_log("isl==teamdelete:success ", 3, $logFile); } else { $req["SuccFail"]="fail"; //operation success or fail $req["SuccFailMessage"]="error occured ". mysql_error(); // error_log("isl==teamdelete:fail ", 3, $logFile); } mysql_close($conn); header("Content-type: text/plain"); echo json_encode($req); return; } else if ($req['operation'] == "useradd") // teams silmek için geldi. { //error_log("isl==teamdelete: ", 3, $logFile); //$sql="delete from teams where tea_id=".$req['teamid']; $sql="insert into user VALUES (null,". $req['userid'].",".$req['username'].",".$req['usersurname'].", ".$req['useremail']" , "$req['userphone']", "$req['usermob']", "$req['useractive']"now(),".$req['recuser'].")"; mysql_query($sql); //error_log($sql, 3, $logFile); //var $affrows = mysql_affected_rows(); if ( mysql_affected_rows() > 0 ) { $req["SuccFail"]="success"; //operation success or fail $req["SuccFailMessage"]="successfully added."; //error_log("isl==teamdelete:success ", 3, $logFile); } else { $req["SuccFail"]="fail"; //operation success or fail $req["SuccFailMessage"]="error occured ". mysql_error(); // error_log("isl==teamdelete:fail ", 3, $logFile); } mysql_close($conn); header("Content-type: text/plain"); echo json_encode($req); return; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/218474-parse-error-syntax-error-unexpected-t_constant_encapsed_string-in/ Share on other sites More sharing options...
trq Posted November 12, 2010 Share Posted November 12, 2010 Serious? Line 115 is where? Quote Link to comment https://forums.phpfreaks.com/topic/218474-parse-error-syntax-error-unexpected-t_constant_encapsed_string-in/#findComment-1133383 Share on other sites More sharing options...
Ibshas25 Posted November 12, 2010 Author Share Posted November 12, 2010 //line starting 115 $sql="insert into user VALUES (null,". $req['userid'].",".$req['username'].",".$req['usersurname'].", ".$req['useremail']" , "$req['userphone']", "$req['usermob']", "$req['useractive']"now(),".$req['recuser'].")"; mysql_query($sql); Quote Link to comment https://forums.phpfreaks.com/topic/218474-parse-error-syntax-error-unexpected-t_constant_encapsed_string-in/#findComment-1133388 Share on other sites More sharing options...
trq Posted November 12, 2010 Share Posted November 12, 2010 You are missing several concatenation operators within that line. Quote Link to comment https://forums.phpfreaks.com/topic/218474-parse-error-syntax-error-unexpected-t_constant_encapsed_string-in/#findComment-1133390 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.