snoodle
07-21-2007, 03:03 AM
this is driving me nuts...
If I execute the following code...
function MyFunc()
{
echo "inside MyFunc - ";
// $sql = "INSERT INTO test (aline) VALUES('mary had a little lamb')";
// $result = $database->query($sql);
}
// Parse the incoming data
$q=$_GET["q"];
parse_str($q);
$sql = "DELETE from test";
$result = $database->query($sql);
MyFunc();
$sql = "INSERT INTO test (aline) VALUES('mary had a little lamb')";
$result = $database->query($sql);
echo "All Done";
---------------------------------------------
Everything works fine... "mary had a little lamb" gets put in the table called "test", and the responsetext in my ajax code gets "MyFunc - All Done".
--------------------------------------------------
However, if I uncomment those lines above that insert the 'mary had a little lamb' from within the function, nothing happens (I get a <br> in my responsetext and the db does not get updated. BTW, the reference to $database is just my database object that has the connection already set up and all that. I know this seems like a really dumb question, but it is really making me crazy as I try every iteration possible. I was hoping someone would see something simple going on that I'm simply not seeing.
If I execute the following code...
function MyFunc()
{
echo "inside MyFunc - ";
// $sql = "INSERT INTO test (aline) VALUES('mary had a little lamb')";
// $result = $database->query($sql);
}
// Parse the incoming data
$q=$_GET["q"];
parse_str($q);
$sql = "DELETE from test";
$result = $database->query($sql);
MyFunc();
$sql = "INSERT INTO test (aline) VALUES('mary had a little lamb')";
$result = $database->query($sql);
echo "All Done";
---------------------------------------------
Everything works fine... "mary had a little lamb" gets put in the table called "test", and the responsetext in my ajax code gets "MyFunc - All Done".
--------------------------------------------------
However, if I uncomment those lines above that insert the 'mary had a little lamb' from within the function, nothing happens (I get a <br> in my responsetext and the db does not get updated. BTW, the reference to $database is just my database object that has the connection already set up and all that. I know this seems like a really dumb question, but it is really making me crazy as I try every iteration possible. I was hoping someone would see something simple going on that I'm simply not seeing.