Page 1 of 1

Can't find the problem in this code

Posted: Sat Sep 22, 2012 5:05 am
by vlio20
Hi,
Here is my code, it seems there is some problem with it:

Code: Select all

<?php
require_once 'connection.php';
$link = conenct('localhost', 'root', '', 'w_db');

mysql_query( "SET NAMES utf8" );
mysql_query( "SET CHARACTER SET utf8" );
mysql_set_charset('utf8', $link);

Class AreaInfo{
    public $areaNmae;
    public $areaId;
    public $areaTableName;
}

$areaOfWorkArray = json_decode($_POST['userAreaOfWorkArray']); // userAreaOfWorkArray is an array 
$areaInfoArray = Array();
foreach ($areaOfWorkArray as $key){
    $key = mysql_real_escape_string($key);
    $tmpObj = new AreaInfo();
    $tmpObj->areaId = $key;
    $query = mysql_query("SELECT areaOfWork, tableName FROM area_of_work WHERE id = '$key'");
    $query = mysql_fetch_assoc($query);
    $tmpObj->areaNmae = $query['areaOfWork'];
    $tmpObj->areaTableName = $query['tableName'];
    array_push($areaInfoArray, $tmpObj);    
}

echo json_encode($areaInfoArray);
?>
userAreaOfWorkArray is an array that I am posting via ajax from javascript code.

Please HELP ME!!

Re: Can't find the problem in this code

Posted: Sat Sep 22, 2012 6:49 pm
by requinix
Yeah... You're going to have to tell us why you think there's a problem because I don't think a single person here is just to take a microscope to your code looking for something wrong when they have absolutely no idea what that would be.