Can't find the problem in this code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vlio20
Forum Commoner
Posts: 26
Joined: Sat Jun 02, 2012 6:46 am

Can't find the problem in this code

Post 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!!
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Can't find the problem in this code

Post 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.
Post Reply