Jump to content

becu

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

becu's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, turn out solution of Ruzzas works. Thank you so much!!!
  2. Hi, thank you for your reply. This is a work-around way which won't help me because I tried to grab data from various external sites. Some of them will have forward slash. I need a way to escape them. To my understanding, you wrote your own regex function but then in the end, you entered $parsed = get_string_between($fullstring, "<title>", "</title>"); which if replaced $start and $end string with <title> and </title>, it won't work. I have to use variable in preg_match, I can't pass in string directly in my problem. All I'm asking is preg_match_all('/'.$start.'(.*)'.$end.'/U', $str, $output); what do you do if $end or $start contains a "/", how do you escape them? They're are part of regex so you can't just escape them before hand then plugin because then it won't match with what's actually on the external sources. Thanks.
  3. Hi, I need some help. below is an example, $str = "<title>some text goes here</title> <title>some other text goes here</title>"; $start = "<title>"; $end = "</title>"; preg_match_all('/'.$start.'(.*)'.$end.'/U', $str, $output); I got this error "Warning: preg_match() [function.preg-match]: Unknown modifier 'p'." Above is just an example, and the main problem is if in any of my variables, I have a forward slash, I will get an error. How do you solve this problem if theres a slash in your variable which is then goes into preg_match. If I was to escape the forward slash in my variable before preg_match (ie. $end = "<\/title>") , I won't get any results back. Thanks.
  4. becu

    mysql search.

    Thanks fenway, I will dig into it.
  5. becu

    mysql search.

    any ideas guys? thanks.
  6. becu

    mysql search.

    fenway, I can't access the page you gave. can you double-check the url? thanks for your help!
  7. becu

    mysql search.

    fenway, I don't own the server. I just need an okay search method for now. I guess this is more of a PHP question. let say I have an array of 3, 4 elements. Can you propose an algorithm to swap elements and get all possible arrays from this one array? $arr = array("a", "b", "c"); ==> I want (a, b, c) (a, c, b) (c, a, b) (c, b, a) (b, a, c) (b, c, a) thanks.
  8. becu

    mysql search.

    Hi, I'm trying to write a search function for my site. Let say a user input "my lovely dog", then if my site has an article let say: "my cute lovely but not very friendly doggy" -> then there's a match. but if my site has an article: "my friendly doggy lovely" -> then my search can't find this article. My question is how do you swap input text, so that it doesn't matter what order the users input, it can always find matched article. my above sample would be: my lovely dog, dog my lovely, lovely dog my...will be matched with an article entitled "my cute lovely but not very friendly doggy". Thanks.
  9. Hi, I'm trying to parse XML data, but every time the <title> tag contains a single quote, part of the title to the left of the single quote disappear. Can anybody help me to fix this? ex: John's bookstore this case, I can only get "bookstore" Thank you.
  10. i got it worked! need single quote around the url. thanks DrDoc
  11. Hi guy, I'm very new to ajax. Please help me fix error below. This code supposes to take the url from the link, put it into showHint function and output and image. <script type="text/javascript"> var xmlHttp function showHint(str) { if (str.length==0) { document.getElementById("txtHint").innerHTML=""; return; } xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="img.php"; url=url+"?img="+str; url=url+"&sid="+Math.random(); xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4) { document.getElementById("txtHint").innerHTML=xmlHttp.responseText; } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } </script> <a href="#" onclick="showHint(http://farm2.static.flickr.com/1123/847641124_05ad612bf7.jpg)">here</a> <span id="txtHint"></span> And this is the code of img.php <?php echo "<img src=\"{$_GET['img']}\">"; ?> the code won't work. when I paste the source code of the page into frontpage, it said I got an error near onclick. When I replace the link of the image by a random number or any other character, it works just fine. why? thanks.
  12. my code, every time it sees an opening "<Url>" tag, it will get the data in between those tags. In this case, there are 2 <Url> tags in one xml file and I only need to get data in between <Url> </Url> tags in <Thumbnail>. Is there a way to know that we're in the <Url> tag of Thumbnail not the other <Url> tag
  13. I don't think that's what i'm asking. thanks anyway.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.