Forum Moderators: coopster

Message Too Old, No Replies

Help with this code i generated please

         

lowridertj

5:23 am on Jan 30, 2006 (gmt 0)

10+ Year Member



That is the link to view teh code in which im having trouble.

Here it is aswell.


<?
include("funcs.php");
$time1=time();

$getgames = mysql_query("SELECT round FROM $tab[game] WHERE ends>'$time1';");
while ($game = mysql_fetch_array($getgames))
{
$get#*$!s = mysql_query("SELECT code,id,status,subscribe1a,subscribe2b FROM $tab[#*$!] WHERE id>'0';");
while ($#*$!s = mysql_fetch_array($getpimps))
{
$chkcode=$pimps[0];
$pimpusrinfos = mysql_query("SELECT code,id,status,statusexpire,subscribe1a,subscribe2b,sub1aexpires,sub2bexpires FROM $tab[user] WHERE code='$chkcode';");
while ($pimpusrinfo = mysql_fetch_array($pimpusrinfos))
{

$check=admin;
$chsups=supporter;
$chsilv=yes;
$chgold=yes;
$chmaxadd=yes;

if (($pimpusrinfo[2]!= $check) && ($pimpusrinfo[3] < $time1) && ($pimpusrinfo[2]=$chsups)){
$thealert1 ="Your Supporter Status Package has ended!";
mysql_query("UPDATE r$game[0]_$tab[pimp] SET status='normal', newalert='1', alert='$thealert1' WHERE id>0;");
}
if (($pimpusrinfo[2]!= $check) && ($pimpusrinfo[3] > $time1) && ($pimpusrinfo[2]=$chsups)){
mysql_query("UPDATE r$game[0]_$tab[pimp] SET status='supporter' WHERE id>'0';");
}
if (($pimpusrinfo[2]!= $check) && ($pimpusrinfo[6] < $time1) && ($pimpusrinfo[4]=$chsilv)){
$thealert2 ="Your Silver Subscription Package has ended!";
mysql_query("UPDATE r$game[0]_$tab[pimp] SET subscribe1a='no', newalert='1', alert='$thealert2' WHERE id>0;");
}
if (($pimpusrinfo[2]!= $check) && ($pimpusrinfo[6] > $time1) && ($pimpusrinfo[4]=$chsilv)){
mysql_query("UPDATE r$game[0]_$tab[pimp] SET subscribe1a='yes' WHERE id>0;");
}
if (($pimpusrinfo[2]!= $check) && ($pimpusrinfo[7] < $time1) && ($pimpusrinfo[5]=$chgold)){
$thealert3 ="Your Gold Subscription Package has ended!";
mysql_query("UPDATE r$game[0]_$tab[pimp] SET subscribe2b='no', newalert='1', alert='$thealert3' WHERE id>0;");
}
if (($pimpusrinfo[2]!=$check) && ($pimpusrinfo[7]>$time1) && ($pimpusrinfo[5]==$chgold)){
mysql_query("UPDATE r$game[0]_$tab[pimp] SET subscribe2b='yes' WHERE id>0;");
}
echo "completed GAME $game[0] PIMP $pimps[1] USER $pimpusrinfo[1]<br>";
}
}
}
?>

Any help would be great.

Its to pull from each game the Pimp in that game then there master account information and update there in game status accordingly..

This file will be hit by a cron and update that way.

[edited by: jatar_k at 5:31 am (utc) on Jan. 30, 2006]
[edit reason] no urls thanks [/edit]

tomda

6:21 am on Jan 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



At least, let us know what is the error or problem encounter?
Debugging a PHP script is easy but debugging PHP+MYSQL can be tricky coz we can't access all datas...
So what's wrong?

lowridertj

2:22 pm on Jan 30, 2006 (gmt 0)

10+ Year Member




Any help would be great.

Its to pull from each game the Pimp in that game then there master account information and update there in game status accordingly..

I thought i had done so.

It pulls there infortion from teh different tablkes and matches them to each other quite fine.

but the update query is not updating as it should.

lowridertj

4:52 am on Jan 31, 2006 (gmt 0)

10+ Year Member



can no one help me.

tomda

6:10 am on Jan 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Its to pull from each game the Pimp in that game then there master account information and update there in game status accordingly..

OK! This is what the script is supposed to do

the update query is not updating as it should.

There you are :) This is the problem you have... It is not updating. Therefore, it is not an error PHP (I guess you do not have any PHP error message). There is a problem with your query...

Have you tried to echo each query to see how the query looks like? If not, it is the way to go to debug SQL queries!

lowridertj

10:23 pm on Jan 31, 2006 (gmt 0)

10+ Year Member



ive added echo statements to each update area. And its not echoing meaning its not getting past the querys and the && statements supplied.

Wondering if anyone can see why it isnt getting past.

I should have been more detailed in posting this.. Sorry.

Any help is great

vincevincevince

11:46 pm on Jan 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try adding:

echo mysql_error();

To show the last mysql error encountered. Post it here if you don't understand it!

tomda

7:12 am on Feb 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



yeah, try mysql_error!

Note that

echo "mysql_query("UPDATE r$game[0]_$tab[#*$!] SET subscribe2b='yes' WHERE id>0;")";
will not echo your query. You should have something like
$sql="UPDATE r$game[0]_$tab[pimp] SET subscribe2b='yes' WHERE id>0";
echo $sql;
mysql_query($sql);
to echo your query.

Last remark, MYSQL will not update if you are trying to update a value with the same value.