Trouble With Php

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Trouble With Php

imacul8
I am having a little trouble on my home page with my php script,. i get a double error

QUOTE
Warning: str_repeat(): Second argument has to be greater than or equal to 0. in /home/imacul8/public_html/forums/modules/navigation.php on line 115

Warning: str_repeat(): Second argument has to be greater than or equal to 0. in /home/imacul8/public_html/forums/modules/navigation.php on line 115


CODE

// Additional pages
$customnavigationbits = '';

$mod_options['portal_navigation_addpages'] = unserialize($mod_options['portal_navigation_addpages']);

if (!empty($mod_options['portal_navigation_addpages']))
{
    foreach ($mod_options['portal_navigation_addpages'] AS $key => $navlinks)
    {
        $link = $navlinks['link'];
        $title = $navlinks['text'];
line 115 --- >$navmark = iif($navlinks['level'] == 1, $mod_options['portal_navigation_mark1'], str_repeat(' ', ($navlinks['level'] - 1)) . $mod_options['portal_navigation_mark2']);

        eval('$customnavigationbits .= "' . fetch_template('adv_portal_navigationbits') . '";');
    }
}

eval('$home["$mods[modid]"][\'content\'] = "' . fetch_template('adv_portal_navigation') . '";');


?>


please help smile.gif

Notice from BuffaloHELP:
Always use QUOTE and CODE bbcodes when pasting error messages and codes.

 

 

 


Reply

Spectre
Well, evidently, the str_repeat function requires the second argument to be of integer value above 0. The 'iif' statement isn't natively supported in PHP (nor in many other languages) as far as I know, so I'm assuming it's user-defined within one of your scripts; but a quick bit of research indicates that it operates on the basis of 'iif(condition,true,false)' meaning that it is evaluating '$navlinks['level'] - 1' if '$navlinks['level']' is any different to 1 - such as if it is 0, meaning that '$navlinks['level'] - 1' obviously become less than 0 and therefore illegal in that context. Additionally, I would recommend simply using 'condition ? true : false' as it is natively supported by both PHP and a wider range of languages, and much more likely to be recognised and understood by more people.

Reply

peroim
This is what i found about str_repeat():

string str_repeat ( string input, int multiplier )

Gives multiplier repeats of input_str. multiplier has to be greater or equal to 0. If multiplier is 0, this fuction will return an empty string.

(Sorry for the possibly bad English, but I had to translate this from Dutch.)

Reply

fffanatics
Basically, you are getting this error because $navlinks['level'] = 0 since subtracting 1 creates a negative number. Try displaying $navlinks['level'] prior to your condition so that you know its value because this will help in debugging the error. If that isnt it, then i dont know what the problem could be.

Reply

imacul8
thankyou for the help, havent had a chance to check it out yet, havent been able to get online for ages sad.gif

will post if i have any troubles with it still..

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : trouble, php

  1. Need Help With Javascript Drag And Drop Script
    Having trouble with javascript drag and drop script. (2)
  2. Having Trouble Accessing Google
    (1)
    I opened my computer this morning very excited about checking my email but to no avail because till
    now I am having a hard time connecting to gmail and google. I already tried a few things like 1.
    reset my modem 2. virus and malware scan my computers but as I found out it's not only a
    problem in my pc. It's a problem in all of the pcs here at home as well. We're all connected
    to the internet via a wireless hub (linksys). Well recently I found out that the firmware of our
    hub is corrupted (meaning people could connect to our network and use our interne....
  3. I'm Having Trouble Registering [resolved]
    (my application is accepted, but not going through) (6)
    I joined the forums here a week or two ago. I worked my credits up to about 39 and applied for an
    account (I became completely approved). However, when I tried registering my account, my browser
    was stuck on the "Xisto" page for about 48 hours. It just kept telling me to wait (it could take a
    "long time"). Eventually, I had to close my browser because it was using exorbitant levels of RAM.
    I lost all my credits anyway. I'm wondering how to fix that. Does my application require human
    input after being approved? I thought it was completely automatic, so I appli....
  4. Browser Compatibility Problem With Firefox - Javascript + Css
    Having trouble making a script work right - any suggestions? (3)
    Hi, Im working on a website, and im trying to make a right-click menu, which opens on right click,
    wherever the cursor is, and closes on mouse out. I wrote the code below, and when i ran it in IE it
    ran fine, just how i wanted it to work. However in firefox, the menu just opened in the top left. im
    presuming this is because it doesnt like my style changing in the javascript. Any ideas, and
    suggestions? If i cant make this work, i will just make it so it works slightly differently when
    viewev in firefox so that it can just open in one place. All ideas appreciated. ....
  5. The Olympics-more Trouble Than It's Worth?
    (6)
    I love watching the Olympics like many other people. It is pretty cool to see athletes from all over
    the world compete in sporting events. However, it seems to me that the Olympics may be causing more
    trouble than what it's worth. The debate over drug involvement, underage gymnasts, tie scores,
    dropping s medal on the ground, and falling on the vault are all examples of things that have been
    debated. It seems to me that all of these things are ruining the Olympics. What's the point in
    winning a gold medal when everyone questions it? It seems to me that the Olympi....
  6. Cms?
    Trouble!!! (2)
    I installed a CMS which is called Slaed. This is the mistake I am getting on the main page: QUOTE
    Warning: unlink(config/counter/sess.txt) : Permission denied in
    /home/alex1985/public_html/function/function.php on line 1607 How can I solve it? Your
    suggestions?....
  7. Mime Type Trouble
    (3)
    I have been trying to validate my site with xhtml 1.1 and I am supposed to serve it as an
    application vs. text/html... 1. It recommends changing to .xml or .xhtml extension but when I do
    this in my home folder it doesn't recognize the extension and calls is text/generic. 2. Yes, i
    have added the mime type in apache, but I don't know why it doesn't recognize it?? It
    recognized a pearl script I made. 3. I also tried adding a perl script to the top of my pages to
    declare mime type but it doesn't seem to be working. How can I get cpanel to recognize these ....
  8. Cpanel Help, Trouble Logging In.
    Cannot login as it states "Login Attempt Failed!" (4)
    Before I was able to login within my Cpanel without problem but now I try to login and it states
    "Login Attempt Failed!" which makes no sense. I made sure nothing was written incorrectly within
    the fields but yet I get this error. ;-; I hope I wasn't hacked or anything.... anyone has any
    idea of what this could mean?....
  9. Runescape Through A Proxy
    I'm having trouble running Runescape through a proxy server (2)
    I use GhostGo when I surf the web most of the time because it helps protect my privacy. One
    problem I've encountered, is playing Runescape on it. A picture of my screen is attached. I use
    Safari to play Runescape. I'd rather not, but I will use Firefox if I need to.....
  10. Nasal Irrigation For Sinus Trouble
    (4)
    Has anyone ever tried nasal irrigation? I have, it works wonders!....
  11. Trouble Creating Hosting Account
    i would have posted in the HOSTED MEMBERS section but.... (20)
    I need urgent help! When i recieved my email for comfirmation of my hosting account - i went to
    trap17.com/manage/index.php. Logged in and created a hosted account. At the top of it it said "There
    were problems creating your account! Please Contact Administrator. " But i went to my website
    flashy.trap17.com and it was created. But now the only thing is my hosted credits were not set
    back to 0.00 and my group is still Members - not hosted. HELP ME PLEASE!! i dont want to
    get banned....
  12. School Giving You Too Much Trouble?
    Better Here This Audio Clip (1)
    Too Funny! Turn up your Speakers for this one...
    http://mosh.nokia.com/content/32EAC8BB8289...040050AEE041F49 ....
  13. Wordpress Login Trouble [resolved]
    It says something about cookies. (8)
    Whenever I try to login to my newly installed Wordpress account, it gives me this message at the
    top: Warning: Cannot modify header information - headers already sent by (output started at
    /home/a0123b56/public_html/wp-config.php:29) in /home/a0123b56/public_html/wp-login.php on line 12
    Warning: Cannot modify header information - headers already sent by (output started at
    /home/a0123b56/public_html/wp-config.php:29) in /home/a0123b56/public_html/wp-login.php on line 24
    And then when I ignore that and try to login, it says that either cookies are blocked or your brow....
  14. [php/mysql]id Trouble [resolved]
    (3)
    session_start(); include "database.php"; if (!$_SESSION || $_SESSION { // User
    not logged in, redirect to login page Header("Location: main.php"); } $result =
    mysql_query("select * from users order by id asc"); while($r=mysql_fetch_array($result))
    { $username=$r ; $info=$r ; $msn=$r ; $email=$r ;
    $id=$r ; $password=$r ; $userlevel=$r ; echo "
    user ID User Level U....
  15. Login Trouble [resolved]
    (3)
    I'm having trouble logging into Trap17. When I login with the top bar, it sends me to the login
    page, and when I login page, it sends me to
    http://www.trap17.com/forums/index.php?htt...ums/forums.html And I'm still not logged in.
    I've tried on FF and IE. I'm at school and it's the only place where it will actually
    log me into Trap. I've got a feeling this will damage my credits. /unsure.gif"
    style="vertical-align:middle" emoid=":unsure:" border="0" alt="unsure.gif" />....
  16. Logo Trouble
    (4)
    I'm making a website that will contain jokes and hopefully maintain a successful community. I
    thought of the name "The Comedy Club" but I am having trouble on which font to choose for the logo.
    In order there is: * Laffayette Comic Pro tintin Cheri Badaboom BB Kill Switch Mom`s
    Typewriter If you can please vote for your favourite(s), it would be greatly appreciated. I will
    be changing the colour scheme to match the finished website but I chose red as it is simple and easy
    to see. Cheers, Ryan....
  17. I Am Having Tonnes Of Trouble.... [resolved]
    (5)
    I am having lots of trouble getting some different php codes to work on traps servers....
    Link For example, I tried this to creat a link, but it would not work... is there anything I can
    do that I may not be doing, or that I may be doing wrong, or don't know about? It seemse to
    happen for a few other things too... /sad.gif" style="vertical-align:middle" emoid=":(" border="0"
    alt="sad.gif" /> help me please.....
  18. Cpanel Login Trouble!
    (4)
    Plz help me out with my cpanel mess!! with correct username and psswrd i cannot log in...was
    working fine sme days bck when i purchased it!! i`m losing business as i cannot reply to
    emails as they woudn`t open either!!! whats this mess?? I tried to log in with my
    default psswrd which was mailed to me!! lemme outta dis people!!!!
    /unsure.gif" style="vertical-align:middle" emoid=":unsure:" border="0" alt="unsure.gif" /> link to
    my website is https://sun.host.ac:2083/frontend/x3/index.html ....
  19. Php An Js Window.open Pages Trouble.
    I need a way to set hidden input values to the new window. (3)
    I have 2 main pages Page A(events_locked.php) and Page B(add_attendance.php). Both are php files.
    Page A takes a post var from another page(not Page B ) and then used to query for displaying records
    in a mysql datase. This variable has set as a session variable because there is 1 <script
    LANGUAGE="JavaScript"> window.name="main_index"; function openFormWindow() {
    OpenWindow=window.open("add_attendance.php", "newwin", "height=250,
    width=400,toolbar=no,scrollbars=no,menubar=no,location=no,resizable=no"); var x =
    getElementByName("form1"); x.target="newwin"; x.s....
  20. Trouble Logging Into Cpanel
    (0)
    When i go to the cpanel page for my account, internet explorer tells me the that it doesn't have
    certain certificates to prove authentication. So i think "fine, no big deal lets carry on anyway",
    so i continue and a login in window pops up i enter my details.. nothing, again... nothing, again
    Third time lucky? oh wait... it takes me to the cpanel login page, hmm... so i enter my details into
    that... nothing, again... nothing no matter what i try and i dont get the password wrong becuase i
    use the password for another service somewhere else. i was wondering if some li....
  21. Window Media Player License.
    having trouble with it. (1)
    Hey friends i m having trouble with some window media audio formats. when i try to play them it says
    download media player security license. i tried to download but it says url not found. Plz can
    some body help me? and i don't think that microsoft has designed this for some purpose! It
    is useless.. i'll must say that it is just a way to tease you. what do u think that microsoft
    should remove this feature?....
  22. Trouble With Phpbb Email
    (1)
    Hi guys, I want to know if there is anything you can do for sending confirmation email to your
    users automatically when they have just regeistered, when the host server does not support SMTP
    (Simple Mail Transfer Protocol). ? Thanks alot.....
  23. New Arisen Site Problem
    Nettek Login Trouble (2)
    Okay, so I installed Nettek and got everything set up. But every time I try and login, it says
    it's incorrect. I've gone into the Database and gotten the password and since it was
    simple, put them in and had tried but with no success. I tried changing the password but I still
    couldn't get in. I tried adding another login and it still didn't work. I have no idea
    what's wrong and I need some help.....
  24. Important ! I Am Having A Lot Of Trouble Setting Up My...
    (0)
    hi guys/girls, i am having a lot of trouble setting up my email account with go daddy their
    customer service sucks ! (sorry for the language) but as of now i waited 2 days posted the same
    question as how to setup my Email at Godaddy but they send me irrelavent answers totally bull crap
    its frustrating to know that such a good company cant provide good help. can anyone help me i have
    already created my Email id example@eample.com then it says Pending : MX updating. since 2 days what
    must i do ??? i am really stuck when i click help it says change your MX 0 stmp....se....
  25. Having Trouble Installing Smf
    (3)
    am i allowed to upload a forum? one that is all coded in php, not a service, a completely scratch
    forum. the company who made the templates is simplemachines and its an smf. it just documents, i
    just need to know if i can use it. also, it doesnt let me access files i have uploaded.......
  26. Trouble With Rpgmaker Xp
    (19)
    I newly installed RPG Maker XP and a message pops up saying. "Failed to obtain a trial activation
    code from the nTitles server!" Now what do I do?....
  27. Windows Update Trouble
    Office XP Service Pack 3 (7)
    I tried downloading Office XP Service Pack 3 And when I try to download it I Get this box that pops
    up QUOTE Title says: Microsoft Office XP Professional with FrontPage The feature you are
    trying to use is on a network resource that is unavailable. Click ok to try again, or enter and
    alternate path to a folder containing the installation package “PROFLUS.MSI” in the box below Use
    source. C:\Documents and settings\Owner\Desktop (In a drop Down Menu) Then there is
    3 options (OK, Cancel, Browse…) Kind of puzzled as to how I could install the win....
  28. Having Trouble Installin Half Life 1 On Windows Xp
    help me plz... (8)
    im havin trouble installing half life 1 on my computer it meets all the requirments and stuff but it
    wont install and ive read because im using windows xp but ive also read ppl got it to work even
    though there usin windows xp i tried steam but that didnt really help it installed but kept screwin
    up so if anyone has any suggestions plz post them....
  29. Trouble With Emailer.php
    failed sending email error (6)
    Whenever someone registers at my forum, they get this error: Failed sending email :: PHP :: DEBUG
    MODE Line : 234 File : emailer.php however, the account will be sucessfully registered. It is
    weird because i did not change the original emailer.php at all. O__O||| anyone know whats up with
    it?....
  30. Neomail, Horde, Squirrelmail
    What's the deal?? Having trouble here... (4)
    I'm using an email address under my domain and had been using Neomail to check it for most of
    the time that I've been hosted (less than 2 months now). Not long ago I tried Horde and
    switched to it because it looked nicer. At first, my emails weren't visible in Horde, but later
    they appeared and I couldn't see them in Neomail anymore (I don't know how this happened or
    what I did.) But since using it, Horde was giving me trouble so I decided to switch back to Neomail.
    So I logged into Neomail, but my messages haven't gone back to it. Next, I al....

    1. Looking for trouble, php

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for trouble, php

*MORE FROM TRAP17.COM*
Similar
Need Help With Javascript Drag And Drop Script - Having trouble with javascript drag and drop script.
Having Trouble Accessing Google
I'm Having Trouble Registering [resolved] - (my application is accepted, but not going through)
Browser Compatibility Problem With Firefox - Javascript + Css - Having trouble making a script work right - any suggestions?
The Olympics-more Trouble Than It's Worth?
Cms? - Trouble!!!
Mime Type Trouble
Cpanel Help, Trouble Logging In. - Cannot login as it states "Login Attempt Failed!"
Runescape Through A Proxy - I'm having trouble running Runescape through a proxy server
Nasal Irrigation For Sinus Trouble
Trouble Creating Hosting Account - i would have posted in the HOSTED MEMBERS section but....
School Giving You Too Much Trouble? - Better Here This Audio Clip
Wordpress Login Trouble [resolved] - It says something about cookies.
[php/mysql]id Trouble [resolved]
Login Trouble [resolved]
Logo Trouble
I Am Having Tonnes Of Trouble.... [resolved]
Cpanel Login Trouble!
Php An Js Window.open Pages Trouble. - I need a way to set hidden input values to the new window.
Trouble Logging Into Cpanel
Window Media Player License. - having trouble with it.
Trouble With Phpbb Email
New Arisen Site Problem - Nettek Login Trouble
Important ! I Am Having A Lot Of Trouble Setting Up My...
Having Trouble Installing Smf
Trouble With Rpgmaker Xp
Windows Update Trouble - Office XP Service Pack 3
Having Trouble Installin Half Life 1 On Windows Xp - help me plz...
Trouble With Emailer.php - failed sending email error
Neomail, Horde, Squirrelmail - What's the deal?? Having trouble here...
advertisement



Trouble With Php



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE