Warning: Missing argument
Posted: Wed Oct 22, 2003 11:36 am
Here's the problem, I keep getting this error message on my page
OK how about some code.
First step I drop the results of a SELECT statement into a variable
I think you can ignore $bbcode -> parse_bbcode($v -> sqlOut , these are some functions I use to create BBCode and do some Data Scrubbing before displaying it. Unless you think it might be picking something up in these functions (or loosing something) I then take that $text variable and pass it through my keyword function like this
And here is what the keyword function looks like
Like I said, it seems to work but I need to understand what the error is referencing so I can fix it. I did Google this but everyone seems to state the obvious, which is “your not passing one of the variables”. This does not seem to be my problem, or if it is I’m not understanding what I’m not passing.
Any ideas?
Real quick here is what I am trying to do. I'm creating a journal application that will automatically create links based on certain keywords in the entry. It pulls the entry from the database, parses it looking for keywords from an array and then does a simple string replace. Funny thing is, it works. Even though I get the error message, it still does it's job. Working exactly as I expected it to with the exception of the annoying error message at the top of the page.Warning: Missing argument 1 for keyword() in C:\Long\MS\Path\To\File\classes\keyword.class.php on line 14
OK how about some code.
First step I drop the results of a SELECT statement into a variable
Code: Select all
<?php
$text = $bbcode -> parse_bbcode($v -> sqlOut($row['journal_text']));
?>Code: Select all
<?php
echo $keywords -> keyword($text);
?>Code: Select all
<?php
function keyword($value) //this is line 14 of the file keyword.class.php
{
$keyword = array(
"Windows 2000" => "http://www.microsoft.com/windows2000/",
"Microsoft" => "http://www.microsoft.com/"
);
foreach ($keyword as $k => $v) {
$value = str_replace($k, "<a href="$v" target="_blank">$k</a>", $value);
}
return $value ;
}
?>Any ideas?