Ibshas25 Posted November 4, 2010 Share Posted November 4, 2010 i seem to be getting this error and cant figure it out.. ?php require_once("connectdb.php"); /*Connect to your Database $conn = mysql_connect("127.0.0.1", "root", "kasapogluo") or die("Could not connect to MySQL Server: " . mysql_error()); //Select your Database mysql_select_db("test") or die("Could not select database"); */ $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_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>Is Active</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']; $reslist .= "<tr><td><a href='#' onclick='javascript:UserSearchChoose(".$row['usr_id'].",".chr(34).$row['usr_name'].chr(34).",".chr(34).$row['usr_surname'].chr(34).");'>".$row['usr_id']."</a></td><td>" . $row['usr_username'] . "</td><td>" . $row['usr_name'] . "</td>"; $reslist .= "<td>" . $row['usr_surname'] . "</td><td>" . $row['usr_isuseractive'] . "</td></tr>"; } // error_log("$reslist: ".$reslist, 3, $logFile); $reslist .= "</table>"; // error_log("$reslist: ".$reslist, 3, $logFile); // error_log("\n", 3, $logFile); $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'] == "rolesearch") // select için veri geldi { $sql= "select rol_Id, rol_name from roles order by rol_name"; $result = mysql_query($sql); $reslist = "<select id='roles' name='roles'>"; while($row = mysql_fetch_array($result)) { $reslist .= "<option value='".$row['rol_Id']."' "; if($row['rol_Id']==1) { $reslist .= " selected "; } $reslist .= " >".$row['rol_name']."</option>"; } //error_log("$reslist: ".$reslist, 3, $logFile); //error_log("\n", 3, $logFile); $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'] == "teamslist") // select için veri geldi { // error_log("isl==teamslist select oluþuyor: ", 3, $logFile); $sql="select tea.tea_id,tea.tea_projectId, prj.prj_projectname , tea.tea_userId,usr.usr_name,usr.usr_surname,tea.tea_rolId,rol.rol_name from teams as tea LEFT JOIN projects as prj ON prj .prj_id = tea.tea_projectId LEFT JOIN users as usr ON usr.usr_id = tea.tea_userId LEFT JOIN roles as rol ON rol.rol_Id = tea.tea_rolId where tea.tea_projectId =".$req['teams'][0][projectid]; $sql.=" order by usr.usr_name , usr.usr_surname ,prj.prj_projectname "; /* (usr.usr_name is null or usr.usr_name like 'ib%' ) and (usr.usr_surname is null or usr.usr_surname like '%' ) order by usr.usr_name , usr.usr_surname ,prj.prj_projectname $sql= "select usr_id, usr_username,usr_name,usr_surname,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: ".$sql, 3, $logFile); //error_log("\n", 3, $logFile); $result = mysql_query($sql); $reslist = "<table border='1'><tr><th>Team Id</th> <th>Role</th> <th>Name</th> <th>Surname</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']; $reslist .= "<tr><td><a href='#' onclick='javascript:TeamListChoose(".$row['tea_id'].",".$row['tea_projectId'].",".$row['tea_userId'].",".$row['tea_rolId'].",".chr(34).$row['usr_name'].chr(34).",".chr(34).$row['usr_surname'].chr(34).");'>".$row['tea_id']."</a></td><td>" . $row['rol_name'] . "</td><td>" . $row['usr_name'] . "</td>"; $reslist .= "<td>" . $row['usr_surname'] . "</td></tr>"; } // error_log("$reslist: ".$reslist, 3, $logFile); $reslist .= "</table>"; // error_log("$reslist: ".$reslist, 3, $logFile); // error_log("\n", 3, $logFile); $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'] == "teamdelete") // teams silmek için geldi. { //error_log("isl==teamdelete: ", 3, $logFile); //$sql="delete from teams where tea_id=".$req['teamid']; mysql_query("delete from teams where tea_id=".$req['teamid']); //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'] == "teamadd") // teams silmek için geldi. { //error_log("isl==teamdelete: ", 3, $logFile); //$sql="delete from teams where tea_id=".$req['teamid']; $sql="insert into teams VALUES (null,". $req['projectId'].",".$req['userId'].",".$req['rolId'].",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 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; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/217759-fatal-error-call-to-undefined-function-json_decode-in/ Share on other sites More sharing options...
Ibshas25 Posted November 4, 2010 Author Share Posted November 4, 2010 Fatal error: Call to undefined function json_decode() in /export/SOI-50/students/m2009/abhr428/web/WebIbs/teams.php on line 12 Quote Link to comment https://forums.phpfreaks.com/topic/217759-fatal-error-call-to-undefined-function-json_decode-in/#findComment-1130318 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.