Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-19-2008, 01:53 PM   PM User | #1
Peuplarchie
Regular Coder

 
Join Date: Feb 2006
Posts: 262
Thanks: 23
Thanked 1 Time in 1 Post
Peuplarchie is an unknown quantity at this point
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..
Peuplarchie is offline   Reply With Quote
Old 05-19-2008, 02:19 PM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
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!
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

Last edited by abduraooft; 05-19-2008 at 02:23 PM..
abduraooft is offline   Reply With Quote
Old 05-19-2008, 03:12 PM   PM User | #3
JohnDubya
Super Moderator


 
JohnDubya's Avatar
 
Join Date: Nov 2006
Location: Missouri
Posts: 634
Thanks: 12
Thanked 18 Times in 18 Posts
JohnDubya is on a distinguished road
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()
__________________
JDub
http://johnnyzone.com/blog
JohnDubya is offline   Reply With Quote
Old 05-19-2008, 03:19 PM   PM User | #4
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
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
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 05-19-2008, 03:21 PM   PM User | #5
JohnDubya
Super Moderator


 
JohnDubya's Avatar
 
Join Date: Nov 2006
Location: Missouri
Posts: 634
Thanks: 12
Thanked 18 Times in 18 Posts
JohnDubya is on a distinguished road
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.
__________________
JDub
http://johnnyzone.com/blog
JohnDubya is offline   Reply With Quote
Old 05-19-2008, 03:22 PM   PM User | #6
Peuplarchie
Regular Coder

 
Join Date: Feb 2006
Posts: 262
Thanks: 23
Thanked 1 Time in 1 Post
Peuplarchie is an unknown quantity at this point
You are right guys, only 3 para was allowed.

Thanks for you time !
Peuplarchie is offline   Reply With Quote
Old 05-19-2008, 03:29 PM   PM User | #7
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
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, ?
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 05-19-2008, 05:19 PM   PM User | #8
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,601
Thanks: 2
Thanked 397 Times in 390 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
Quote:
Originally Posted by abduraooft View Post
hey, there are up to 4 in the examples, ?
The third and fourth parameter are optional.
Inigoesdr is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:01 PM.


Advertisement
Log in to turn off these ads.