i would like some help with making my search box work on my forum, at the moment when u type anything in it just refreshes the page and the same page is shown. I want it to show the thread if some types in say 'hello' it should show threads that start with hello below is my code if anyone1 can help me adjust the code that couwld be great!!. thanks

<?
// Command_BlogIndex.php

//############################################################################
// SearchVenueCommand class
//############################################################################

require_once("ManagerMessage.php"); 


class Command_BlogIndex extends Command
{


 //############################################################################
 // doExecute
 //############################################################################ 
 function doExecute(Request $request)
 {
 // Create manager object
 $manager = new ManagerMessage();

 // Get data from database object
 $data = $manager->getAllMessages();
 
 // Include view
 include("views/index.php");
 }
} 
?>

Recommended Answers

All 6 Replies

Member Avatar for diafol

This code does not highlight what you're doing to get the data. Try again.

i have been trying and was stuck thats y i posted on the forum for some help not to be told to try again, advice in the right direction would be better or some suggestion on what i neeed to add to the code to make it work, im not asking for u to provide me with a full blown code but to tell me where to adjust the code or what to add to it so i can make it work

Member Avatar for diafol

I was simply stating that you have not included the code that needs to be posted to help you. You obviously have the code that runs with the class. Otherwise the class is meaningless. If you misread my reply, I apologise, but it still doesn't change the reality of the situation. Which piece of code is failing? If you don't post it, we can't help. The code as you've posted looks like some random piece of object-orientated stuff. So my 'try again' comment simply means, post the right piece of code. Don't be so quick to take offence.

been trying to get this right but still getting errors pls could u tell me where i am going wrong here im gettin this error Parse error: syntax error, unexpected T_INCLUDE in /home/0/092/public_html/Command_BlogIndex.php on line 37

<?
// Command_BlogIndex.php

//############################################################################
// SearchVenueCommand class
//############################################################################

require_once("ManagerMessage.php"); 


class Command_BlogIndex extends Command
{


// doExecute

function doExecute(Request $request)
{
// Create manager object
$manager = new ManagerMessage();

// Get data from database object
$title = $request->getProperty('title');

if($title == "")
{ 
$data = $manager->getAllMessages(); 
}

else

{
$data = $manager-> searchMessages() 
 

// Include view
  include("views/index.php");
}
}

?>
Member Avatar for diafol
$data = $manager-> searchMessages()

Put a ; at the end.

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.