Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-13-2003, 09:26 PM   PM User | #1
ygrouk
New Coder

 
Join Date: Mar 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
ygrouk is an unknown quantity at this point
Something Wrong??

Hi guys

my browser returns the message found at the url below.
http://www.gameygro.com/play/space.php?1

I am using the following php code

PHP Code:
<?php
/* Count How Many Times A Space Game Has Been Played */
$temp file('/usr/local/psa/home/vhosts/gameygro.com/httpdocs/data/gamecount/' 'spacetotal.txt');
$fp=fopen($temp ,"r");
$count=fgets($fp,1024);
fclose($fp);
$fw fopen($temp ,"w");
$cnew $count+1;
$countnew fputs($fw,$count+1);
echo 
"$cnew";
fclose($fw); 

/* Send To Correct Page */
header ("Location: /play/space/$QUERY_STRING.php");
?>
Whats worong??

Pete
ygrouk is offline   Reply With Quote
Old 04-13-2003, 10:23 PM   PM User | #2
missing-score
Senior Coder


 
missing-score's Avatar
 
Join Date: Jan 2003
Location: UK
Posts: 2,194
Thanks: 0
Thanked 0 Times in 0 Posts
missing-score is on a distinguished road
Try this...

PHP Code:
<?php
/* Count How Many Times A Space Game Has Been Played */
$temp 'usr/local/psa/home/vhosts/gameygro.com/httpdocs/data/gamecount/spacetotal.txt';

$fp=fopen($temp ,"r");
while(!
feof($fp))
{
$count=fgets($fpfilesize($temp));
}
fclose($fp);
$fw fopen($temp ,"w");
$cnew $count+1;
$countnew fputs($fw,$cnew);

fclose($fw); 

/* Send To Correct Page */
header ("Location: /play/space/$QUERY_STRING.php");
?>
Right, that should work. Remember, headers can only be sent BEFORE any page content. You tried to echo $cnew, writing content to the page, so the header fails.

If it doesnt work, post back.
missing-score is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:28 PM.


Advertisement
Log in to turn off these ads.