SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Wizard
    Join Date
    Jul 2006
    Location
    New Zealand
    Posts
    1,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Errors: Undefined Constant page and li and undefined function

    Several Years ago i was given a script by an online friend of mine we used to game together when i tried to install the script the sql drop file didnt work but 2day i have fixed that because since then i didnt know wat was wrong but now i have another code Problem its to do with functions.php which is required in every file.

    The Errors i get is

    Notice:use of undefiend constant page - assumed 'page' in .. on line 9436

    on this line get

    PHP Code:
        $newpageview $row[page] + 1
    Thats all
    the others are

    Notice :use of undefined constant li - assumed 'li' on line on line 10 of index.php Other is Fatal error:called to undefnied function dpli() in index.php on line 11 how can i fix these?

    This is what on line 10 AND 11

    PHP Code:
        if($li[li] == 1) {
    dpli(); 
    this is the functions page here

    and index page is here

    I Know the functions page is huge i didnt write this script i am just trying to repair it 4 my friend.

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    strings in php must be quoted.

    $row is an array

    your specifying an indice for the array. indices can either be numeric, or they can be strings. your using a string indice. again, strings must be quoted.

    $row['page'] is the proper way to write it.

    if your indice was numeric, it wouldnt need to be quoted.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    Williamsport, PA
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Common mistake

    Notice:use of undefiend constant page - assumed 'page' in .. on line 9436
    Here is your fix.

    Code:
     $newpageview = $row['page'] + 1;
    Code:
    if($li['id'] == 1) {
    Note that I'm making an assumption that you really meant $li['id'], not $li['li'] in the second error. I don't know your database schema so I don't know what you really meant.

    As for the third error, the function name is mispelled. But there are so many display functions in the functions file that I have noooooo idea which one was meant.

  4. #4
    SitePoint Wizard
    Join Date
    Jul 2006
    Location
    New Zealand
    Posts
    1,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you ill fix the whos that you told me how to fix at the moment can anyone else help me with the last one?

  5. #5
    SitePoint Wizard
    Join Date
    Jul 2006
    Location
    New Zealand
    Posts
    1,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i will be happy to post my sql drop file here if would really help solving the last problem?

  6. #6
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by william232
    i will be happy to post my sql drop file here if would really help solving the last problem?
    you dont really need permision to ask a question. just ask it. if someone wants to answer, they will.

  7. #7
    SitePoint Wizard
    Join Date
    Jul 2006
    Location
    New Zealand
    Posts
    1,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just Found out that last part was for the license system but it wasnt found so i have to go through and find all the li parts and remove them.

  8. #8
    SitePoint Wizard
    Join Date
    Jul 2006
    Location
    New Zealand
    Posts
    1,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now i have commented out the li which is license code and i get these errors

    PHP Code:
    NoticeUndefined variableREMOTE_ADDR in C:\Documents and Settings\School Work\Desktop\TestingServer\xampp\htdocs\dbs\index.php on line 13

    Notice
    Undefined variablesec in C:\Documents and Settings\School Work\Desktop\TestingServer\xampp\htdocs\dbs\index.php on line 65

    Notice
    Undefined variablesec in C:\Documents and Settings\School Work\Desktop\TestingServer\xampp\htdocs\dbs\index.php on line 66

    Notice
    Undefined variablesec in C:\Documents and Settings\School Work\Desktop\TestingServer\xampp\htdocs\dbs\index.php on line 67

    Notice
    Undefined variablesec in C:\Documents and Settings\School Work\Desktop\TestingServer\xampp\htdocs\dbs\index.php on line 68

    Notice
    Undefined variablesec in C:\Documents and Settings\School Work\Desktop\TestingServer\xampp\htdocs\dbs\index.php on line 69 
    How can i fix these you can use the same index page above i havnt changed anything on index on mine just commented out the li code part

  9. #9
    SitePoint Wizard
    Join Date
    Jul 2006
    Location
    New Zealand
    Posts
    1,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now i get these errors

    Warning: extract() [function.extract]: First argument should be an array in C:\Documents and Settings\School Work\Desktop\TestingServer\xampp\htdocs\dbs\index.php on line 22

    Notice: Undefined variable: sec in C:\Documents and Settings\School Work\Desktop\TestingServer\xampp\htdocs\dbs\index.php on line 66

    Notice: Undefined variable: sec in C:\Documents and Settings\School Work\Desktop\TestingServer\xampp\htdocs\dbs\index.php on line 67

    Notice: Undefined variable: sec in C:\Documents and Settings\School Work\Desktop\TestingServer\xampp\htdocs\dbs\index.php on line 68

    Notice: Undefined variable: sec in C:\Documents and Settings\School Work\Desktop\TestingServer\xampp\htdocs\dbs\index.php on line 69

    Notice: Undefined variable: sec in C:\Documents and Settings\School Work\Desktop\TestingServer\xampp\htdocs\dbs\index.php on line 70


    For extract i just have

    PHP Code:
    extract($row); 
    and thats all and for

    PHP Code:
          if($sec == 5) echo("<TR><TD><center><img src=images/securitylevel/4.gif></img></center></TD>"); 
          if(
    $sec == 4) echo("<TR><TD><center><img src=images/securitylevel/3.gif></img></center></TD>");
          if(
    $sec == 3) echo("<TR><TD><center><img src=images/securitylevel/2.gif></img></center></TD>");
          if(
    $sec == 2) echo("<TR><TD><center><img src=images/securitylevel/1.gif></img></center></TD>");
          if(
    $sec == 1) echo("<TR><TD><center><br><img src=images/securitylevel/0.gif></img></center> 
    How can i fix these ones?

  10. #10
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the error tells you what your problem is.

    First argument should be an array

    your variable is not an array. find out why. look at your code.

  11. #11
    SitePoint Wizard
    Join Date
    Jul 2006
    Location
    New Zealand
    Posts
    1,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    for a start in my code $row is mysql_fetch_array($result)

    so it is an array

  12. #12
    SitePoint Wizard
    Join Date
    Jul 2006
    Location
    New Zealand
    Posts
    1,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is what i have in index.php

    http://www.bcdesigns.hozter.info/index.txt

  13. #13
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    var_dump($row)

    its not an array. its most likely boolean false.

  14. #14
    SitePoint Wizard
    Join Date
    Jul 2006
    Location
    New Zealand
    Posts
    1,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it says under that line bool(false)

  15. #15
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    therefore, its not an array.

    check your query. your silencing your errors with the @ operator. we told you many times you want to see errors so you can debug. use mysql_error() to help you just like we showed you in some of your other posts.

    even if you dont have an error, you should be checking to see if your query returned any data. use mysql_num_rows() to check if you have some data to work with, before you try to fetch it with mysql_fetch_*


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •