Jump to content

ds111

Members
  • Posts

    112
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ds111's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello, I'm building a blog post website, and now I'm on the search part of it. I have a search field which I instruct the user to type in "keywords" they want to search for. The words they type in there are then to be searched in the "title" and "content" of each post in the "posts" table. Here's an example query of my current setup: SELECT * FROM (`posts`) WHERE MATCH(title,content) AGAINST('+term1* ' IN BOOLEAN MODE); This works fine if I have one or two words in they keywords. If I, however, copy and paste an entire sentence from an existing blog post, no results are found ??? Here's an example of a query where I just copy+pasted a sentence from a blog post: SELECT * FROM (`posts`) WHERE MATCH(title,content) AGAINST('+Hello* +everyone* +my* +name* +is* +Bob* ' IN BOOLEAN MODE); Yet, a search for just "Bob" returns the proper result. WHY? What's a better way to perform this search?!
  2. Hello, I'm building a blog post website, and now I'm on the search part of it. I have a search field which I instruct the user to type in "keywords" they want to search for. The words they type in there are then to be searched in the "title" and "content" of each post in the "posts" table. Here's an example query of my current setup: SELECT * FROM (`posts`) WHERE MATCH(title,content) AGAINST('+term1* ' IN BOOLEAN MODE); This works fine if I have one or two words in they keywords. If I, however, copy and paste an entire sentence from an existing blog post, no results are found ??? Here's an example of a query where I just copy+pasted a sentence from a blog post: SELECT * FROM (`posts`) WHERE MATCH(title,content) AGAINST('+Hello* +everyone* +my* +name* +is* +Bob* ' IN BOOLEAN MODE); Yet, a search for just "Bob" returns the proper result. WHY? What's a better way to perform this search?!
  3. Please help! User enters Date (that is somewhere in future, few hours or maybe few years). I need to store in MYSQL Date minus 6 hours keeping in mind daylight savings time. I tried to convert date to unix timestamp and subtract 6*60*60. Works great, but does not take into consideration daylight savings time.
  4. Hello! I recently found out that Gmail strips all "absolute" positioning from HTML emails. Is there any way to disable this behavior or work around it? Thanks!
  5. Hello, I have a window.open-based popup that includes a colorpicker (its just a ray of small colored boxes that the user can select). Once the user selects the color, I insert the HEX code into a hidden field in the parent (using window.opener.document.getelementbyid) and I close the popup. Now..I have to call a JavaScript function which is defined in the parent window. How can I do that once the popup has closed? Thanks!
  6. Hi! I have 3 select boxes: <select name="select1" id="select1"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <select name="select2" id="select2"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <select name="select3" id="select3"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> Does anyone know of a way, in Javascript, to delete option "1" in select2 and select3 if it was selected in select1? Then...if I select option "2" in select1, it should return option "1" in select2 and select3, and remove option "2." How can I do this? Thanks!
  7. I was trying to avoid using a transaction. I have an invoice form with invoice number as a primary key. When user is modifying an invoice, there are three choices: 1. No changes, user just pressed Save 2. Change invoice number to already existing one. 3. Change anything except invoice number. I am using UPDATE IGNORE. #3 is OK, but #1 and #2 are indistinguishable. Of course, I can check duplicate invoice number first, but I am trying to avoid using transactions. (Two users can call up the same invoice for modification). Again, is it any way to find out (check some mysql or stmt vars) why UPDATE IGNORE failed, because there are no changes or because of duplicate primary key ?
  8. I have a table with a PRIMARY KEY. My UPDATE IGNORE returns affected_rows = 0. How do I distinguish between a) nothing changed b) duplicate primary key Thanks!
  9. Hello! I have the following two tables: table1: --------------------------- | RID | NAME | | 1 | Bob | | 2 | Mark | | 3 | Sue | --------------------------- table2: --------------------------- | RID | RID2 | | 1 | 2 | | 2 | 3 | | 1 | NULL | --------------------------- I need an SQL Statement that will print out the following: RID: 1 NAME: Bob RID2: 3 NAME: Sue Can you help me construct this statement?
  10. Hello! I have a folder and it has 60 or so .HTML files. I need a PHP or Mac program that will recursively go through the directory and make a thumbnail of a certain size: let's say 270 x 80 (or something like that) and save that somewhere (I dont care where, just that I need to be able to access it haha) Does anyone know of anything like this? Or, can anyone share with me a simple PHP script to be able to make this? Thanks so much!
  11. Hello! I have the following code, for example: class Controller_test extends controller_template { function action_index() { $this->execute_hooks("action_index"); } } My execute_hooks function is this: if ( isset ( $this->hooks[$where] ) ) { if (is_array($this->hooks[$where])) { foreach($this->hooks[$where] as $key => $value) { $file = $value['file']; $function = $value['function']; require ( $file ); $function() } } } This works correctly, however...I want something a bit more... I want it to literally **add code to the function** See the require( $file ); line? Here's an example of a file: <?php function test() { echo "Hi!"; } ?> it calls the test() function, and echos "hi" in the correct place... But what If I want to use some class-specific variable? It doesn't work. I tried to literally read the file contents then return it to the execute_hooks() call, but that doesn't work. So basically I want to turn this: <?php $this->execute_hooks("test"); ?> to this: <?php echo "hi!"; ?> How do i do it?
  12. Sorry, (can't edit post). If it's in a for loop, that's even better
  13. Hi! I have an array like this: [test1] => [test2] => [test3] => Array ( [archives] => Array ( [file] => application/hooks/archives.php [function] => archives ) ) How can I make a foreach loop so that it takes the "archives" text out of test 'test3' index? Afterwards, I then need to take the "file" and "function" out, also in the foreach loop. I also need an "if" statement, to check if there is anything in the 'test1' index as well. All 3 indexes will be called, and I need to loop through each of them. If there is anything there, I need to loop through those, and include the "file" one.
  14. I have 1 drop down select box with 1,000 options. In some case, there will be 100+ of these select boxes, with absolutely identical options. Is there any way to avoid repeating 1,000 options for 100 select boxes? For example: OnBlur = remove options from selectbox, and OnFocus = to add them back. Can you refer me to some example of the proper way to do this?
  15. Does this work when you are instantiating the Mysqli class as well? because it looks like you call mysqli_stmt_close() only when you do not use the OOP style. Since $stmt is a "shortcut" to $mysqli->stmt_init(); then wouldn't $stmt->close() be the same thing as: $mysqli->stmt_init()->close(); ? What does stmt_init() return? I thought it returns $this so that you can then call another function of the Mysqli class...?
×
×
  • 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.