Page 5 of 5

Re: PHP Question

Posted: Sat Aug 15, 2009 1:09 pm
by Torniquet

Code: Select all

$SQL="INSERT INTO players (lastlogin)VALUES('$datetime') WHERE name='$player'";
are you accually setting the $_POST variable?

Re: PHP Question

Posted: Sat Aug 15, 2009 4:59 pm
by hallsofvallhalla

Code: Select all

 $player=$_SESSION('player');
notice the '

Re: PHP Question

Posted: Sun Aug 16, 2009 5:42 am
by SpiritWebb
hallsofvallhalla wrote:

Code: Select all

 $player=$_SESSION('player');
notice the '
I placed the ' in (player), and I still get: Fatal error: Function name must be a string in C:\wamp\www\Mythuto\logout.php on line 4. See code below:

Code: Select all

<?php
include_once 'connect.php';
  session_start();
  $player=$_SESSION('player');

  $lastlogin=$_POST['lastlogin'];
  $datetime=date("d/m/y");

  $SQL="INSERT INTO players (lastlogin)VALUES('$datetime') where name='$_SESSION(player)'";
  $result=mysql_query($SQL) or die("MySql Error");

  session_destroy();

?>

Re: PHP Question

Posted: Fri Sep 04, 2009 4:11 pm
by Falken
hallsofvallhalla wrote:

Code: Select all

 $player=$_SESSION('player');
notice the '
Should be:

Code: Select all

$player=$_SESSION['player'];
If you use ( instead of [ it thinks "$_SESSION" is a function, and functions can't start with $, thats why you get the function name is not a string error.

Re: PHP Question

Posted: Fri Sep 04, 2009 5:32 pm
by SpiritWebb
Nice, thanks Falken, granted I have moved on...decided to go with programming the game in flash, and using PHP in the background!! But thanks for that, i will keep that in mind!!