Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: Loop problem

  1. #1
    New Coder
    Join Date
    Nov 2012
    Location
    chennai
    Posts
    55
    Thanks
    29
    Thanked 0 Times in 0 Posts

    Loop problem

    PHP Code:
    for($i=0$i<$count;$i++){
    if(
    $var[$i]==$str)
    {
    echo 
    "$str".$var[$i];
    $strfirstlettercaps strtolower($str);
    $var1=$strfirstlettercaps.".php";
    require_once 
    $var1;  
    }
    else 
    {
    $strfirstlettercaps="";
    $var1=fopen("$strfirstlettercaps".".php","x+");
    echo 
    "<img src='../uc1.jpg'>";

    please anyone tell me wat i'm doing wrog here.
    Last edited by gayathri; 02-15-2013 at 05:59 AM.

  • #2
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,467
    Thanks
    278
    Thanked 32 Times in 31 Posts
    something seems amis here, just giving it the once over, is this correct?

    you have a . before ".php" and a , after just make sure that format is corrrect..
    and you did not mention your problem you are having so im just guessing here. i have not tested this

    PHP Code:

    fopen
    ("$strfirstlettercaps".".php","x+"); 
    Last edited by durangod; 02-15-2013 at 08:13 AM. Reason: sorry i looked at that wrong, i thought the name would be name..php but your concatenating that my bad

  • Users who have thanked durangod for this post:

    gayathri (02-15-2013)

  • #3
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,472
    Thanks
    13
    Thanked 361 Times in 357 Posts
    the else part certainly has a problem. you reset $strfirstlettercaps so you eventually try to open ".php" of which I’m pretty sure you don’t have such a file.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  • Users who have thanked Dormilich for this post:

    gayathri (02-15-2013)

  • #4
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,467
    Thanks
    278
    Thanked 32 Times in 31 Posts
    Quote Originally Posted by Dormilich View Post
    the else part certainly has a problem. you reset $strfirstlettercaps so you eventually try to open ".php" of which I’m pretty sure you don’t have such a file.

    LMAO good eye, i didnt even notice that. I saw your post and im like duh are you blind dave lol... tooooo funny... i could have swore that was a dif name before.... nice catch, yep resetting that to that value is a bad deal for sure.

    Lets hope that was his only issue and that you get a much deserved thanks for that Dormilich

  • #5
    New Coder
    Join Date
    Nov 2012
    Location
    chennai
    Posts
    55
    Thanks
    29
    Thanked 0 Times in 0 Posts
    You are correct durangod. My problem is creating a php file inside that loop itself. Now i did the thing what i need, by placing the else part code in the corresponding php file, where i'm entering the new names ie)$strfirstlettercaps.php.
    Thanks Dormilich and durangod.


  •  

    Posting Permissions

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