Jump to content

[SOLVED] I've Stuffed up... Big


MasterACE14

Recommended Posts

I keep looking through my files over and over again, But I just cant figure out where player_session() has been called already, it just doesnt seem to be previously called at all  :-\

 

is their a way I can make a debugging script to check for all player_sessions() called for say all the files in the folder or something?  ???

Link to comment
Share on other sites

removing player_session() from the top of base.php still gives me the redeclare error  :-\ :

<?php // players base

/* includes */
include '/home/ace/public_html/conflictingforces/functions.php';

//player_session();

 

Fatal error: Cannot redeclare player_session() (previously declared in /home/ace/public_html/conflictingforces/functions.php:7) in /home/ace/public_html/conflictingforces/functions.php on line 4

 

and player_session() isnt called in functions.php as that is where the function has been created. So this is really weird  ???

 

EDIT: I commented out the entire player_session() function, and then when I went to base.php it gave the exact same error message for player_table()

 

somethings stuffing up with the functions altogether. Cannot redeclare when it hasnt even been declared once? very bizarre

Link to comment
Share on other sites

I've finnaly fixed the bug. My final working code is this(on base.php):

<?php // players base

/* includes */
include_once '/home/ace/public_html/conflictingforces/functions.php';

player_session();

 

I have used include_once() instead of include() and that has fixed some wacky behavior.

 

Now I got 1 more bug left, this one is also weird. My player_table() function works fine on base.php, but while it is working fine on pages I need it, I am getting mysql errors on pages where I dont, what i mean by dont is, I dont even include() functions.php(has player_table() function) and I dont even call the function. But yet, this fully working code is displaying error messages on my other pages.

 

here's the error message:

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 7 in /home/ace/public_html/conflictingforces/functions.php on line 40

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 8 in /home/ace/public_html/conflictingforces/functions.php on line 40

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 9 in /home/ace/public_html/conflictingforces/functions.php on line 40

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 10 in /home/ace/public_html/conflictingforces/functions.php on line 40

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 11 in /home/ace/public_html/conflictingforces/functions.php on line 40

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 12 in /home/ace/public_html/conflictingforces/functions.php on line 40

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 13 in /home/ace/public_html/conflictingforces/functions.php on line 40

 

line 40 of functions.php is:

<?php
$query = mysql_result($rs,0,0);

(without the php tags right before it of course)

 

Link to comment
Share on other sites

I got it working now ;D

 

the final code was:

<?php
// Select fields from the user table
function player_table($select){
    $where = $_SESSION['playerid'];
    $rs = mysql_connect("localhost", "ace_ACE", "*****");
    mysql_select_db("ace_cf", $rs);
    $sql = "SELECT `" . $select . "` FROM `cf_users` WHERE `id`='" . $where . "' LIMIT 1";
    $rs = mysql_query($sql) or die('Query:<br />' . $sql . '<br /><br />Error:<br />' . mysql_error());
    while($row = mysql_fetch_assoc($rs)){
        if(isset($row[$select])){return $row[$select];}
    }
}

 

Thanks for all your help guys, much appreciated  :D

 

Regards ACE

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.