Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Jessica

  1. Get the contents of the text files, file_get_contents(). Do you want to do a regular expression, or just find if the string exists in the document? If you just want to check for an exact match, strpos() Your signature is funny.
  2. It tells you the problem Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource What does this mean? Well, your $result variable is not a valid resource. I think your connection: $db = database_connect(); is failing. Also, there's a forum for third party stuff :http://www.phpfreaks.com/forums/index.php/board,34.0.html :)
  3. Read: http://www.phpfreaks.com/tutorials/61/0.php If you want someone to do it for you, post on the freelancing board.
  4. Well it's like order of operations. If you have 2+2*5 - what do you do? It helps to add clarification, as (2+2)*5 is different than 2+(2*5) right? You do this in conditional statements in php also, like if($x==5 || ($x==2 && $y==2)).
  5. Why do you want to put echo in a variable? I think you mean you want to echo the variable. [code] $var = "<strong>".($row1["sellrenttext"]).", ".($row2["typeofobjecttext"]).", ".($row3["city"]).", ".($row4["countrytext"]).", ".($row5["price"], 0, ',', ' ')." ".($row6["currencycode"])."</strong><BR><BR>".($row7["objectdes"]); echo $var; [/code]
  6. Yep, it is :) Does it hurt to add it? I normally have sorting options so my ASC vs DSC is set in a variable, so I tend to add ASC anytime. If that causes a performance issue I'd take it out, but I think it's fine right?
  7. No problem. Whenever I have more than one clause like that, I add parenthesis just to help me keep track of what each part is.
  8. You need an order clause - I just ran thorpe's example on a table to check, and it returned them in order of PK (I did SELECT username FROM users and they were in PK order.) Try SELECT rownames FROM tablename ORDER BY sortedrow ASC;
  9. Have you tried adding parenthesis so it looks like this [code]$counting = "SELECT COUNT(*) FROM listings WHERE (title LIKE '%$search%' OR  description LIKE '%$search%') AND cat='$ncat' ORDER BY id ASC"; $showing = "SELECT * FROM listings WHERE (title LIKE '%$search%' OR  description LIKE '%$search%') AND cat='$ncat'  LIMIT $start, $display";[/code] It should be prioritized that way automatically, but just in case, try this.
  10. Good job :) Don't forget to hit the solved button ;)
  11. Where are you printing the next and last variables via echo? Shouldn't it be after you set them, somewhere you need to print them to the screen? You set them and then check a link to back, but nothing else?
  12. Thanks! I am not sure why I was escaping the . - this is the first regexp I have written and despite reading a ton of tutorials and a quick reference book, I still just can't get my mind around it. It works beautifully now, thanks a ton!
  13. I want to allow only letters, numbers, and the . and _ character - nothing else, no spaces, no $!, etc. This is what I have. [code]if(preg_match("/[^A-Za-z0-9_\.]+$/", $this->username)){     $msg = "Please use only letters, numbers, and the following characters: _ and ."; }else{     $msg = "Username OK!"; }[/code] It works great when a user enters !@#$% etc, but when a user enters spaces in between two words, IE: john doe, it says Username OK. If they enter a space and another unallowed character it gives the error, but not if it's just two words with space. What is wrong with my regexp?
  14. Does anyone know what I need to do here?
  15. That is what I am trying to do, but when I do the ajax call, the php file says the $_FILES[] is empty. I am using mootools, I posted on their forum but no response yet. How would you do it?
  16. If the user enters the string of where the file is on their computer: C:\Documents and Settings\user\My Documents\image.jpg How can I upload it to the server without using a form like I would normally? What I am trying to achieve is an ajax image upload form, like the one on TheDailyPlate.com (see: http://www.thedailyplate.com/food-nutrition/food/generic/mashed-potatoes click on Contribute a photo of this item! - Don't actually do it, but that is what I mean. It uploads the image without refreshing the page.) Thanks!
  17. [quote author=fenway link=topic=103135.msg410746#msg410746 date=1154881440] Why does the actual data have escape characters in it? [/quote] And, I have no idea why it's overescaped, when I put it in the database I used "mysql_real_escape_string(strip_tags($_POST['item']));" to get the string and put it in. In that case, 'item' was The Pirate's Code. Now I've gone into the database and changed the entry to "The Pirate's Code" unescaped, and the query SELECT name, id FROM all_items WHERE name LIKE '%Pirate\\\'s%' Finds it. WTF is going on here? Something is wrong with my database settings.
  18. The actual record in the database is The Pirate\'s Code, and that's what I need to find. :( Here's what happens. The user enters pirate's in a search form. Then: $item = mysql_real_escape_string(strip_tags($_POST['search'])); $shop_info = "SELECT name, id FROM all_items WHERE name LIKE '%$item%'"; At that point $shop_info = "SELECT name, id FROM all_items WHERE name LIKE '%Pirate\\\'s%'" Which if I understand the escaping, it should find pirate\'s. And, I have no idea why it's overescaped, when I put it in the database I used "mysql_real_escape_string(strip_tags($_POST['search']));" to get the string and put it in. ARGH
  19. SELECT name, id FROM all_items WHERE name LIKE '%pirate\\\'s%' MySQL returned an empty result set (i.e. zero rows). (Query took 0.0030 sec) SELECT name, id FROM all_items WHERE name LIKE '%pirate\'s%' MySQL returned an empty result set (i.e. zero rows). (Query took 0.0030 sec) SELECT name, id FROM all_items WHERE name LIKE '%pirate%' The Pirate\'s Code  30 Famous Pirates 32 I need to be able to search for the entry "The Pirate\'s Code" using "pirate\'s" or "pirate\\\'s". Why do the first two not work?
  20. I am performing this query: $update_item = "UPDATE stall_transactions SET cleared = 1 WHERE stall_id = $stall_id LIMIT 50"; I want it to update the 50 most recent by either sold (datetime) or transaction_id (primary key). How can I ensure it does the 50 most recent? Thanks! ps: the new forum design is awesome!
  21. Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 4252 bytes) in /home/www/sites/lifefiles.com/admin/uploadphotos.php on line 41 [code]function resize_image($type, $file, $max_width, $max_height){     $full_url = $file;          $imageinfo = getimagesize($file);     $src_width = $imageinfo[0];     $src_height = $imageinfo[1];          if($src_width > $max_width){         $divide = $imageinfo[0] / $max_width;     }     if($src_height > $max_height){         $divide = $imageinfo[1] / $max_height;     }          $dest_width = $src_width / $divide;     $dest_height = $src_height / $divide;          if($type == 2){         $src_img = imagecreatefromjpeg($file); (<-- Line 41)     }else{         $src_img = imagecreatefromgif($file);     }     $dst_img = imagecreatetruecolor($dest_width,$dest_height);     imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);     if($type == 2){         imagejpeg($dst_img,$full_url);     }else{         imagegif($dst_img,$full_url);     }     imagedestroy($src_img); } [/code] The file is a very large one, and I need to be able to do the resize. How do I make it use more memory?
  22. [!--quoteo(post=380786:date=Jun 6 2006, 04:26 PM:name=nogray)--][div class=\'quotetop\']QUOTE(nogray @ Jun 6 2006, 04:26 PM) [snapback]380786[/snapback][/div][div class=\'quotemain\'][!--quotec--] make sure the $cards is declared as an array somewhere in your script. I am not sure if you have it in the 'cards.php' file or not. But if you don't have it there, and it's not a global variable that is set as an array, you'll need to add $cards = array(); before you use it in the array_search() function [/quote] Yeah it is [code]$cards         = array(); $cards[1]     = '2H'; $cards[2]     = '3H'; $cards[3]     = '4H'; (snip)[/code] is cards.php. I had to put it in the file outside of the function and do global $cards; Thanks!
  23. [!--quoteo(post=380782:date=Jun 6 2006, 04:22 PM:name=Buyocat)--][div class=\'quotetop\']QUOTE(Buyocat @ Jun 6 2006, 04:22 PM) [snapback]380782[/snapback][/div][div class=\'quotemain\'][!--quotec--] What is the $dealer variable? You define it here: $dealer = $bj_info['dealer']; but that doesn't really help. If it isn't a string that would explain the error. Also you don't seem to define $cards here so it may not be set and if it is it may not be an array. Again if $card isn't a string and $cards isn't an array that is the source of the problem. [a href=\"http://us2.php.net/array_search\" target=\"_blank\"]http://us2.php.net/array_search[/a] [/quote] Every time I post on this forum, I manage to debug it right away :) I solved the problem by including cards.php at the start of the game_functions file, rather than IN the function. dealer is a string like 'AH9S' (Ace hearts, 9 spades) which go into the array to print the right images later on. So $card is a string and $cards is an array in cards.php Thanks anyway :) *SOLVED*
×
×
  • 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.