Jump to content

ds111

Members
  • Posts

    112
  • Joined

  • Last visited

    Never

Everything posted by ds111

  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...?
  16. Hello I have the following code.. <?php $mysqli = db_connect ($dbn); // <-- This returns mysqli dbconnection link $query = "SELECT user_id, role, test FROM users WHERE uid=? AND id=?"; $stmt = $mysqli->stmt_init (); if ($stmt->prepare ($query)) { $stmt->bind_param ("ii", $uid, $id); $stmt->execute (); $stmt->bind_result ($this->user_id, $this->role, $this->test); $stmt->fetch (); $stmt->close (); $mysqli->close (); return NULL; } I am using MYSQLi as you can see. I have a question: Is $mysqli->close() the same as $stmt->close() ? Do I need those two lines of code or by closing $stmt I also close $mysqli since its in the same class? Thank you for any answers.
  17. Hello, I am trying to make an email tracking application to log whether or not a specific copy of an email has been read or not. I have done some research and have been advised to implant an invisible image into the email message and track through logs for access information. #1) Is the invisible image solution the most optimal? #2) How do I add the tracking code to the image? #3) How do I recognize if the image has been accessed? Thanks for the help!
  18. Hello, I am interested in learning more about preventing PHP SQL Injection. What is the safest procedure to read submitted form data via POST and insert it into MySQL? What is the safest way to process the data before displaying on the page? (to prevent XSS?) Do those procedures change if I have magic_quotes on or off? Thank you!
  19. Thanks for your advice. I will create one directory per user. I hope that Linux "ridiculous" number of directories is more than 10,000.
  20. Thanks. Should I create 10,000 separate directories (one per user) or one per 100 users or ... Assuming 10,000 users and 50 images each. What is better: may small directories or large one with a lot of files?
  21. Hello, I am building a website and I expect around 10,000 users. Throughout the website, I allow users to upload images (up to 50 images/user) for various purposes. The problem I am facing is how to store the image? Should I save the encoding of the image in MySQL, or should I have a separate directory for each user and store the path in MySQL? Which would be the most efficient, and why? Thank you very much for your help.
  22. Hmm, no not quite. I've set up a free DynDNS thing so you can test it out: http://jcropper.selfip.com I've tweaked the script so that it uses your calculations.
  23. Hello! I am confused on how to use imagecopyresampled with a cropper and image resizer. I use jCrop (a jquery cropping plugin) and my own built resizing utility using the jquery slider. I have the following values: $x => The x-coord of the cropping field $y => The y-coord " " " " $s => The side of the cropping field (it's a square) $reg_w => The regular width of the image $reg_h => The regular height of the image $edit_w => The resized width of the image $edit_h => The resized height of the image I'm a bit confused on which values to put for the imagecopyresized() function. Please don't link to the PHP.net website detailing that function, as I've already spent the past 3 days trying to come up with the solution. Basically, the problem is that when I select the area to crop, it doesn't crop that area -- it crops something else, a bit below and to the side. I'm positive the X and Y coords are correct, I've already tested them. Any other ideas? Thanks!
  24. Hello, I am developing an application that heavily uses jQuery. Although I'm really good with PHP, I'm completely new to jQuery. So i found the $("#id").load("http://url....."); function. I also use the jquery ajax form plugin.So basically, this is whats going. The HTML: <div id="results"></div> ...an html form... The JS: $(document).ready(function() { $("#result").load("http://www.url.com/test.php) }); The PHP: echo '<script>alert("Test");</script>'; I know the JS works because if i put alert() infront of it, it works. So how come the PHP code doesnt load and the JS code go into the div "results"? Thanks!
×
×
  • 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.