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 8 of 8
  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    262
    Thanks
    23
    Thanked 1 Time in 1 Post

    RESOLVE - array_splice problem.

    Good day to you all,

    I have another problem with my shout box script.

    Wrong parameter count for array_splice() in
    ERROR LINE : $Data = array_splice($before, 0, 1,$nomcol,$messageq);


    Here is my code :

    PHP Code:
    <?php
    if (isset($_POST['nameq'])) {

    if (
    $_POST['nameq'] != "" && $_POST['messageq'] != "")
    {
    $nom $_POST["nameq"];
    $nomcorrecting strtoupper($nom);
    $nomcorr substr($nomcorrecting0, -9);
    $messageq $_POST["messageq"];
    $choice $_POST["COLOUR_CHOICE"];

    $handle = @fopen(date('Y')."/".date('m')."/".date('d')."/messages.html""r");
    if (
    $handle) {
        while (!
    feof($handle)) {
            
    $buffer fgets($handle4096);
            
    $before $buffer;
        }
        
    fclose($handle);
    }

    $nomcol "<font color=\"#".$choice."\" size=\"3\">".$nomcorr."</font>";


    $File date('Y')."/".date('m')."/".date('d')."/messages.html";
    $Handle fopen($File'w+');





    $Data array_splice($before01,$nomcol,$messageq);




    fwrite($Handle$Data);

    fclose($Handle);


    }
    }
    ?>




    <form action="" method="post">
    <input type="hidden" name="nameq" value="<? echo $_SESSION['Name'];?>"/>
    <textarea name="messageq" cols="70" rows="5"></textarea><br/>
    <b>Couleur du text : </b> 
    <?
    echo "<select  name=\"COLOUR_CHOICE\" id=\"COLOUR_CHOICE\">";

    $colourArray = array("000000""cccc99""FFFFFF""0000FF");
    for (
    $i 0$i count($colourArray); $i++)
    {
        
    $selected = ($colourArray[$i] == trim($_POST['COLOUR_CHOICE'])) ? 'selected="selected"' '';
        echo 
    '<option value="' $colourArray[$i] . '"' $selected  ' . id="opt' $colourArray[$i] . '">#' $colourArray[$i] . '</option>';
    }  
    echo 
    "</select>";
    ?>

    <input type="submit" name="Envoyer !!!" value="post"/>
    </form>


    <br/>

    <iframe id="myframe" name="myframe" src="<?php echo date('Y').'/'.date('m').'/'.date('d').'/messages.html'?>" scrolling="auto" marginwidth="0" marginheight="0" frameborder="0" style=" width:580px; height:400px;"></iframe>

    Thanks again !
    Take good care !
    Last edited by Peuplarchie; 05-19-2008 at 03:26 PM.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,859
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Where is the definition of that function which starts like
    PHP Code:
    function array_splice
    Compare the parameter count of this and the function call. That error message is pretty clear!
    Last edited by abduraooft; 05-19-2008 at 02:23 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    Well, array_splice is a built-in PHP function, not a manually created one. Peuplarchie, go here to read about what parameters the array_splice function needs:

    array_splice()

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,859
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Quote Originally Posted by JohnDubya View Post
    Well, array_splice is a built-in PHP function, not a manually created one. Peuplarchie, go here to read about what parameters the array_splice function needs:
    array_splice()
    Thanks for clearing it. I haven't seen it yet
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    Quote Originally Posted by abduraooft View Post
    Thanks for clearing it. I haven't seen it yet
    No prob. I saw your code and thought, "Man, that function looks familiar." lol I never use it personally either.

    Peuplarchie, just read over that function's description, and it will help guide you through how to use the array_splice() function.

  • #6
    Regular Coder
    Join Date
    Feb 2006
    Posts
    262
    Thanks
    23
    Thanked 1 Time in 1 Post
    You are right guys, only 3 para was allowed.

    Thanks for you time !

  • #7
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,859
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Quote Originally Posted by Peuplarchie View Post
    You are right guys, only 3 para was allowed.

    Thanks for you time !
    hey, there are up to 4 in the examples, ?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #8
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by abduraooft View Post
    hey, there are up to 4 in the examples, ?
    The third and fourth parameter are optional.


  •  

    Posting Permissions

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