I created a set of helper functions to make my life easier when doing database operations in php. Essentially I pass the functions an stdClass Object that they then use to either perform an operation (delete, add, etc) or retrieve information. They seem to work as intended except for the helper function that is meant to delete database entries. What is frustrating to me is that works perfectly fine on my local machine running WAMP, but when I put it live it refuses to delete the database entries.
I think I've narrowed down the issue to a strange quirk I can't explain between the output of the stdClass Object between WAMP and my live site.
PHP:
<?php
session_start();
require_once('dbconnect.php');
require_once('dbhelpers.php');
$cat = $_GET['cat'];
$id = $_GET['id'];
//remove row from table
$a_remove = (object) array(
"table" => "{$cat}",
"columns" => (object) array(
"`id`"
),
"results" => (object) array(
"{$id}"
),
"type" => (object) array(
"i"
)
);
removeRow($a_remove);
?>
Here is the output from the response on WAMP when I run a print_r on the $a_remove object:
stdClass Object
(
[table] => subjects
[columns] => stdClass Object
(
[0] => `id`
)
[results] => stdClass Object
(
[0] => 36
)
[type] => stdClass Object
(
[0] => i
)
)
However when I do print_r on $a_remove on my live site, I get the following:
stdClass Object
(
[table] => subjects
[columns] => stdClass Object
(
[0] => `id`
)
[results] => stdClass Object
(
[0] => 36
[0] =>
)
[type] => stdClass Object
(
[0] => i
)
)
There is that strange additional index in the response for "result". Any ideas on what might be causing this?