Page 3 of 5

Re: PHP Question

Posted: Fri Aug 14, 2009 1:50 pm
by hallsofvallhalla
yes add in a or die so you can see what is failing. I have a feeling its the DB. What is the data type for the lastlogin field? PHP might be out putting a string not capable of you current datatype.

add

Code: Select all

echo $datetime;
what does it look like?

Re: PHP Question

Posted: Fri Aug 14, 2009 4:32 pm
by SpiritWebb
Ok, I placed the or die and when i click logout, this is what I get:
Warning: mysql_query() [function.mysql-query]: Access denied for user 'SYSTEM'@'localhost' (using password: NO) in C:\wamp\www\Mythuto\logout.php on line 19
Included is a screenshot of players in phpMyAdmin

Re: PHP Question

Posted: Fri Aug 14, 2009 5:50 pm
by hallsofvallhalla
change it to

Code: Select all

$result=mysql_query($SQL)or die("it crapped out");  

Re: PHP Question

Posted: Fri Aug 14, 2009 5:57 pm
by SpiritWebb
hallsofvallhalla wrote:change it to

Code: Select all

$result=mysql_query($SQL)or die("it crapped out");  
I tried the:

Code: Select all

$result=mysql_query($SQL)or die("MySql Error");
I get the same thing...(wamp is running, everything works, up until I click logout, now cause of the "or die" placed.)
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\Mythuto\logout.php on line 19
it crapped ou

Re: PHP Question

Posted: Fri Aug 14, 2009 6:51 pm
by Torniquet
are you including the connect.php script that connects to your DB? i cant see it on your script you put up.

Re: PHP Question

Posted: Fri Aug 14, 2009 7:09 pm
by SpiritWebb
Here is the entire code:

Code: Select all

<link href="style.css" rel="stylesheet" type="text/css" />
<STYLE type="text/css">
 <!--
 BODY { background-image:url(logoutFinish.png);
               background-repeat:no-repeat;
               background-position:center;
               background-attachment:fixed }
 -->
</STYLE>

<body bgcolor="black">
<body text="white">
<div id="return">
 <?php
    session_start();
    $datetime=date("d/m/y h:i:s"); //create date time

$sql="INSERT INTO players (lastlogin)VALUES('$datetime')";
$result=mysql_query($sql) or die("MySql Error");



    session_destroy();

    
       ?>


    </div>
I didnt change nothing with the code that halls provided with the tutorial. Except add the code in between session_start() and session_destroy(). I added the include_once 'connect.php'; command, and now I just get MySql Error

Re: PHP Question

Posted: Fri Aug 14, 2009 7:23 pm
by hallsofvallhalla
whats the mysql error?

Re: PHP Question

Posted: Fri Aug 14, 2009 7:27 pm
by SpiritWebb
hallsofvallhalla wrote:whats the mysql error?
where u put "it crapped out" I changed it too "MySql Error"

Re: PHP Question

Posted: Fri Aug 14, 2009 7:44 pm
by Torniquet
im pretty sure you need to have the include in there lol. as its trying to access a DB. in halls tut as far as i can remember he is not accessing any DBs.

stick the include in and see if it works :p

Re: PHP Question

Posted: Fri Aug 14, 2009 7:49 pm
by SpiritWebb
Torniquet wrote:im pretty sure you need to have the include in there lol. as its trying to access a DB. in halls tut as far as i can remember he is not accessing any DBs.

stick the include in and see if it works :p
i did place the include_once, its in the above code, and it still doesnt work.