Jump to content

vadimyer

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

vadimyer's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Can you please explain how to construct a query on my example? I'm a perfect newbie in this...
  2. I guess I need to make 2 queries, first search query and the second query gets tags for the search result... Because tags have URIs and other properties. My DB structure is like: posts ========= id title 1 First Post 2 Second Post tags ========= id post_id tag_title uri 1 1 cats /cats/ 2 1 dogs /dogs/ And the query is: SELECT * FROM posts JOIN tags ON posts.id = tags.post_id WHERE posts.title LIKE '%$match%' This query returns two results, but with one tag in each, as I've already said. How to combine?
  3. Thanks! but I think that's not what I'm looking for. I have a SEARCH query (that contains LIKE condition and JOIN to join tags table) that returns this array: Array ( [0] => stdClass Object ( [title] => First post [tag] => cats ) [1] => stdClass Object ( [title] => First post [tag] => dogs ) ) And when I foreach() it in PHP, it returns 2 same results, but first result contains the tag from [0] and the second - from [1]. How can I print only one result containing both two tags? Cause it is the same “first post” but because of tags the query returns me two array objects. Also notice that tags should be html-formatted and contain links, so mysql GROUP_CONCAT is not the solution. Thanks in advance!
  4. Hello there. In brief, I have a MySQL query that selects the data from one table, joins two more tables that contain additional data like tags, etc. And this query uses LIKE to get only necessary data. So, when I foreach the query result in php, it prints 1 result twice, if it contains more than 1 tag. And each tag is placed under each result, alone. Hope I described it clearly. So, the question is, how can I manipulate the database query or the foreach loop so I can print only 1 result containing 2 or more tags in it? Because it seems the query works like it multiplies results, if there are more than 1 rows in joined table that are equal to the id column of the main table. Thanks!
  5. Hey, thanks for the answer! Yeah, it seems that's a browser problem. Chrome encodes the URI in some right way, but others encode it as ASCII windows-1251. So for example, if one symbol "n" (in cyrillic) would be %EF%D0% in UTF-8, other browsers encode it as %ED%, see the difference? And that's why I can't urldecode() this further, so I'm stuck.
  6. My project is based on CodeIgniter, but I guess this question isn't about it at all. First, I have enabled query strings and a search function. Search string passes to the “searchterm” variable and when I pass it through the form, it works fine and looks like: http:// local/home/search/?searchterm=testtesttest Okay, now when I input some cyrillic string in a search form, it works fine as well, the URI would be for example: http:// local/home/search/?searchterm=привет (in chrome) or http:// local/home/search/?searchterm=������ (in IE, Opera etc.) Two above cases work fine, BUT WHEN I enter the CYRILLIC search string directly from the address bar (for example, in Opera or IE) it doesn’t wanna search anything. $_GET[‘searchterm’] is empty, and as for QUERY_STRING, it is something like searchterm=������ (all data from profiler). I urldecode my string from the controller, but it somehow doesn’t work. I also tried some iconv() cases, from what I’ve googled, but they also didn’t work. So the question is why all other browsers except chrome doesn’t retrieve CYRILLIC $_GET variable from the address bar if it was entered from there? Passing through the form everything works fine. Thanks in advance, guys. Hope for your help. P.S. I've also found: %D0%BD%D0%BE%D1%87%D0%B0%D0%BB%D0%BE this is passed from the form, accept-charset is set to UTF-8. In that case, as I said, everything works fine. And: %ED%E0%F7%E0%EB%EE this comes in the address bar when typing the string directly inside the address bar. So I guess every browser changes my cyrillic symbols into something strange... I don't know Don't forget that with Chrome everything works fine! Maybe it's because by default this browser doesn't encode cyrillic symbols in wrong way like other browsers.
×
×
  • 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.