Jump to content
MakeWebGames

works offline but not online ?


Curt

Recommended Posts

I created a feature for my new game where players can complete tasks and earn points and money. This feature also serves as basic tutorial as it shows players the basics of the game.

I am having a problem...

I use xamplite to work on my game offline...it seems that the code im using works fine in my offline server....but when i upload it to the online game it doesnt work...

here is a portion of the code that doesnt seem to work online:

 

} else {

$i=0;
$chlist=$db->query("SELECT * FROM checklist_tasks WHERE ctID>0 ORDER BY ctID ASC");
while ($ch=$db->fetch_row($chlist))
{


     	$cTASK=$db->query("SELECT * FROM checklist_tasksdone WHERE ctdTASKID={$ch['ctID']}");
     	if ($db->num_rows($cTASK)==0) {
     	$i++;
       	$TYPE[$i]="{$ch['ctTYPE']} Tasks";
       	$DESC[$i]=$ch['ctDESC'];
}

}


echo "<span style='color:orange'>$TYPE[1]</span> : <span style='color:green'> $DESC[1] </span>";


}

 

Im not getting any type of error...it simply does not display the $TYPE and $DESC variables on my online game but it works fine in my offline server...

Basicly all im trying to do is show the next un-done task on the list...

Anyone have any suggestions as what is causing this problem ?...

I plan to make the Checklist a major feature in the game but it seems it just doesnt want to work...lol

It has been so long since i have asked for help :P

Thanks everyone,

Curt

Link to comment
Share on other sites

Thanks for the reply :)

Well i looked at my PHP.ini on my VPS and i believe the error display is already activated..

Heres some of the error settings..

error_reporting = E_ALL & ~E_NOTICE

display_errors = On

also i added error_reporting(E_ALL); in the top of my header and I get Undefined variable error when the variables are clearly defined :cursing:

 

this is one issue I dont understand at all :(

Link to comment
Share on other sites

I would change it to:

echo "<span style='color:orange'>".$TYPE[1]."</span> : <span style='color:green'> ".$DESC[1]." </span>";

 

Rather than

echo "<span style='color:orange'>{$TYPE[1]}</span> : <span style='color:green'> {$DESC[1]} </span>";

 

But that's just the way I code, I suppose it is preference.

Link to comment
Share on other sites

Just to update:

Curt has 2 sites both similar so i suggested that the none working script be placed on his first to which the script worked flawlessly

We then tried taking the header from the working site and place it in the none working site then it wouldnt load...

Iv'e told Curt to take all his files from Localhost and test it on another test site to see if this cures the problem.

So we can narrow down any problems caused on the none working site. Still waiting for an outcome.

But over all his script did work on the working site so it cant be a script error. So must have something to do with whats been added to the none working site.

or the database...

Link to comment
Share on other sites

I would change it to:
echo "<span style='color:orange'>".$TYPE[1]."</span> : <span style='color:green'> ".$DESC[1]." </span>";

 

Rather than

echo "<span style='color:orange'>{$TYPE[1]}</span> : <span style='color:green'> {$DESC[1]} </span>";

 

But that's just the way I code, I suppose it is preference.

That's too funny..... But as I have to be constructive, I'm agreeing with equinox, in the fact you've seen someone else do it, and copied, as most developers who use this method know that you should only use it for ', as a " will convert it automatically

Link to comment
Share on other sites

i have copied no one i get an error if i do not put a { } around array variable on both xampp and web hosting

echo "Hello $name"; works :thumbup:

echo "Hello {$name}"; works :thumbup:

echo "Hello $name[1];" doesnt work :thumbdown:

echo "Hello {$name[1]}"; works :thumbup:

maniak reason why i wouldnt use you way is because it takes an un noticably larger amount of time to concatenate strings using the "hello".$var."person"

Link to comment
Share on other sites

ok i just did some testing

i never really use number arrays i usually give them some name example $name['name1']

using the single quotes and that is where i was getting my error from so

echo "Hello $name[0]"; :thumbup:

echo "Hello $name['0']"; :thumbdown:

echo "Hello $name[name1]"; :thumbup:

echo "Hello $name['name1']"; :thumbdown:

i am an organized coder and will continue to use the brackets as it will give me the idea where the variable starts

my if statements look like this

if($blah==$blah)

{

___if($blah==$blah)

___{

______$what="blah blah blah {$var} blah blah blah \${$money} blah blah";

___}

}

usually people code them to look like this

if($blah==$blah) {

___if($blah==$blah) {

______$what="blah blah blah $var blah blah blah \$Smoney blah blah";

___}

}

*underscores are suppose to be spaces*

just my way of coding and seeing what is what (yea i know it's probable wasting diskspace but i have to know where everything's at)

the second way it is just hard for me to see what is in which if statement

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...