javascript php call fails
I read the grid and build and set cookie in javascript then call php function to retieve cookie and process SQL as follows:-
<?php
...
function sql_update() {
if (isset($_COOKIE["sql"])) {
$sql = $HTTP_COOKIE_VARS["sql"];
$connection = @mysql_connect("localhost", 'x', x');
if (!$connection) {
die('Could not connect: ' . mysql_error());
}
@mysql_select_db(orders', $connection);
$result = @mysql_query($sql, $connection);
setcookie("sql",'',time()-3600);
if (!$result) {
die('Could not connect: ' . mysql_error());
}
mysql_close($connection);
echo $result;
}
}
...
?>
<html>
<head>
<script>
...
function savegrid() {
var sql = processgrid();
writeCookie(sql);
<?= sql_update() ?> !!! FAILS HERE !!!
}
Can someone please advise - Thanks
<?php
...
function sql_update() {
if (isset($_COOKIE["sql"])) {
$sql = $HTTP_COOKIE_VARS["sql"];
$connection = @mysql_connect("localhost", 'x', x');
if (!$connection) {
die('Could not connect: ' . mysql_error());
}
@mysql_select_db(orders', $connection);
$result = @mysql_query($sql, $connection);
setcookie("sql",'',time()-3600);
if (!$result) {
die('Could not connect: ' . mysql_error());
}
mysql_close($connection);
echo $result;
}
}
...
?>
<html>
<head>
<script>
...
function savegrid() {
var sql = processgrid();
writeCookie(sql);
<?= sql_update() ?> !!! FAILS HERE !!!
}
Can someone please advise - Thanks
Andy
January 18,