close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

PHP Explode Search Results

Thread began 6/21/2012 4:23 pm by Daryl | Last modified 6/21/2012 5:07 pm by Jason Byrnes | 3604 views | 3 replies |

DarylBeta Tester

PHP Explode Search Results

I have a Data Assist database search which works OK, but I am trying to figure out how to explode the result so that only the first sentence that contains the keyword is shown by looking for the deliminator of a fullstop and a space.

Has anyone else done this?

Sign in to reply to this post

Ian S

Yes... In the Data Assist Search GUI there is a value type of keyword.

I use it frequently for checkbox arrays.

Choose that and it should work OK

Cheers
Ian

Sign in to reply to this post

DarylBeta Tester

Hi Ian

I am using Keyword as the type, but this shows the entire database record that contains that keyword.

I just want an extract of the record that contains that word

Sign in to reply to this post

Jason ByrnesWebAssist

here is an example outside of Data Assist Search that should help give a direction for accomplishing this:


php:
<?php

$heystack 
"The quick brown fox jumps over the lazzy dog. Humpty Dumpty sat on a wall. Jack and jill went up the hill";
$retStr $heystack;
$heystackArray explode(". "$heystack);
if(isset(
$_POST['keyword']) && $_POST['keyword'] != "") {
    
$needle $_POST['keyword'];
    for(
$i 0$i sizeof($heystackArray); $i++) {
        
$termArray explode(" "$heystackArray[$i]);
        if(
in_array($needle$termArray)) $retStr $heystackArray[$i];
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
<form id="form1" name="form1" method="post"  action="">
  <input type="text" name="keyword" id="keyword" />
  <input type="submit" name="button" id="button" value="Submit" />
</form>
<?php echo $retStr?>
</body>
</html>
Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...