Forum Moderators: coopster

Message Too Old, No Replies

works fine on home server but not on hosting package!

         

nshack31

3:29 pm on Feb 4, 2005 (gmt 0)

10+ Year Member



He the following code works on my apache machine but not on my purchased webspace! it gives the error ... Error, insert query failed

all pages apart from this one work

Can anybody help?!


<?php

ob_start();
include 'open.php';
$id=$_COOKIE['id1'];

$query3="Delete From link Where id = $id";
mysql_query($query3) or die('Error, delete query failed');

if (isset($_REQUEST['ctf']))
{
$ctf = 1;
$gameid = 1;
$query4="Insert Into link (id, leagueid, gameid) Values ('$id', '$ctf', '$gameid')";
mysql_query($query4) or die('Error, insert query failed');
$query4 = "FLUSH PRIVILEGES";
mysql_query($query4) or die('Error, insert query failed');
}

if (isset($_REQUEST['obj']))
{
$obj = 2;
$gameid = 1;
$query5="Insert Into link (id, leagueid, gameid) Values ('$id', '$obj', '$gameid')";
mysql_query($query5) or die('Error, insert query failed');
$query5 = "FLUSH PRIVILEGES";
mysql_query($query5) or die('Error, insert query failed');
}
if (isset($_REQUEST['tdm']))
{
$tdm = 3;
$gameid = 1;
$query6="Insert Into link (id, leagueid, gameid) Values ('$id', '$tdm', '$gameid')";
mysql_query($query6) or die('Error, insert query failed');
$query6 = "FLUSH PRIVILEGES";
mysql_query($query6) or die('Error, insert query failed');
}
if (isset($_REQUEST['css']))
{
$css = 4;
$gameid = 2;
$query7="Insert Into link (id, leagueid, gameid) Values ('$id', '$css', '$gameid')";
mysql_query($query7) or die('Error, insert query failed');
$query7 = "FLUSH PRIVILEGES";
mysql_query($query7) or die('Error, insert query failed');
}
if (isset($_REQUEST['snd']))
{
$snd = 5;
$gameid = 3;
$query8="Insert Into link (id, leagueid, gameid) Values ('$id', '$snd', '$gameid')";
mysql_query($query8) or die('Error, insert query failed');
$query8 = "FLUSH PRIVILEGES";
mysql_query($query8) or die('Error, insert query failed');
}
if (isset($_REQUEST['codtdm']))
{
$codtdm = 6;
$gameid = 3;
$query9="Insert Into link (id, leagueid, gameid) Values ('$id', '$codtdm', '$gameid')";
mysql_query($query9) or die('Error, insert query failed');
$query9 = "FLUSH PRIVILEGES";
mysql_query($query9) or die('Error, insert query failed');
}
header ('location: clanadmin.php');
include 'close.php';
ob_end_flush();
;?>

nshack31

4:00 pm on Feb 4, 2005 (gmt 0)

10+ Year Member



I sorted it by removing the

$query4 = "FLUSH PRIVILEGES";
mysql_query($query4) or die('Error, insert query failed');

Parts. What is FLUSH PRIVALEGES for? thanks!

coopster

6:46 pm on Feb 5, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



A quick tip for you, when you are going to throw a die() statement for your queries, dump the query statement along with it during testing so you can see which one is having the troubles.

mysql_query($query4) or die("Error, insert query failed:\n\n$query4");

Don't forget to pull these before putting them in production or at least handling the error a bit differently.

FLUSH PRIVILEGES [dev.mysql.com] reloads the privileges from the grant tables in the mysql database. The statement is typically run after making security changes in the privileges databases.

nshack31

12:26 pm on Feb 7, 2005 (gmt 0)

10+ Year Member



brilliant thankyou very much