Jump to content

siwelis

Members
  • Posts

    135
  • Joined

  • Last visited

Everything posted by siwelis

  1. Figured it out... it should be: $prodimg = array(); $prods = mysql_query($prods) or die ("<p>Sorry, an error has occurred!</p>"); while($row = mysql_fetch_assoc($prods)) { stripslashes(extract($row)); while ($tagArray[$prod_id] > 1){ echo "<br />".$tagArray[$prod_id]; $prodoptions.= $prod_name." <select name=\"".$tagArray[$prod_id]."_prodid".$prod_id."\">".$imgoptions."</select><br /><br />"; $prodimg[] = $prodimg[$prod_img] = $tagArray[$prod_id]; $tagArray[$prod_id]--; } } might even be able to take it a step further...
  2. I have this code... $prodimg = array(); $prods = mysql_query($prods) or die ("<p>Sorry, an error has occurred!</p>"); while($row = mysql_fetch_assoc($prods)) { stripslashes(extract($row)); while ($tagArray[$prod_id] > 1){ echo "<br />".$tagArray[$prod_id]; $prodoptions.= $prod_name." <select name=\"".$tagArray[$prod_id]."_prodid".$prod_id."\">".$imgoptions."</select><br /><br />"; $prodimg[] = $prod_img; $prodimg[$prod_img] = $tagArray[$prod_id]; $tagArray[$prod_id]--; } } For some reason when I echo it, it comes out like this: 8x10.png - 0 2 - 8x10.png 8x10.png - 1 8x10.png - 2 8x10.png - 3 4-4x5.png - 4 2 - 4-4x5.png 2-5x7.png - 5 2 - 2-5x7.png 2-5x7.png - 6 2-5x7.png - 7 2-5x7.png - 8 8wall.png - 9 2 - 8wall.png 8wall.png - 10 8wall.png - 11 8wall.png - 12 8wall.png - 13 8wall.png - 14 8wall.png - 15 8wall.png - 16 print_r Array ( [0] => 8x10.png [8x10.png] => 2 [1] => 8x10.png [2] => 8x10.png [3] => 8x10.png [4] => 4-4x5.png [4-4x5.png] => 2 [5] => 2-5x7.png [2-5x7.png] => 2 [6] => 2-5x7.png [7] => 2-5x7.png [8] => 2-5x7.png [9] => 8wall.png [8wall.png] => 2 [10] => 8wall.png [11] => 8wall.png [12] => 8wall.png [13] => 8wall.png [14] => 8wall.png [15] => 8wall.png [16] => 8wall.png ) I can't figure out where the results in BOLD are coming from. Does anyone have any clue?
  3. I tried it with strpos and it executed everything in between the brackets whether it actually did anything or not... This worked though: if(substr_count($key,'img_') == 1){ //if occurences of "img_" = 1 $key = substr($key, 4); //remove img_ echo $key."<br />"; //verify removal echo "Image ".$key." is ON!<br /><br />"; //party time } Thank you again!
  4. I always need "img_" replaced, but there are other things in the array that do not have img_ and I need them left alone... if(str_replace('img_', '', $key)){ The above piece of code didn't do as I wanted... whether it actually replaces anything or not, it carries out the following code.
  5. I ended up using a bit of both codes: if(str_replace('img_', '', $key)){ //to only change the $key when img_ is present $key = substr($key, 4); //remove img_ from each instance echo $key."<br />"; echo "<br />Image ".$key." is ON!<br />"; } Thank you!
  6. How would I keep only the numbers at the end when "img_" is a constant? img_63 img_65 img_67 Thank you
  7. <? $sql = mysql_query("SELECT * FROM departments ORDER BY name DESC"); //mysql database driven select menu sorted alphabetically by name //name form field echo "<select name=\"formfieldname\">\n"; echo "<option value=\"NULL\">Please Select</option>\n"; while($row = mysql_fetch_array($sql)){ //insert value echo "<option value=\"".stripslashes($row[department_id])."\">"; //insert display name echo stripslashes($row[name])."</option>\n"; } echo "</select>\n"; ?> In all fairness, I learned this method by a book written by a phpfreaks member or owner (I just remember seeing this website mentioned in the book).
  8. Assuming you can determine whether it's a zip file or rar file... You extract get zip contents following this straight forward example. I'd like to say you can follow the example's 1 or 2 for reading RAR's here... However... It appears reading rar's may not be so easy. I don't think that this is a normal bundled feature with php packages and may have to be installed on the server manually. Installation instructions can be found here, though. Let me know if these RAR functions work out for ya. Hopefully I'm wrong about the non being bundled thing!
  9. I'm thinking about storing some php arrays in mysql using serialize and unserialize... But I'm wondering if this is really a good idea... Does anyone have any light to shed on my situation? If necessary, I could break the arrays down into separate tables... but I really don't like having to access a bunch of different tables per page load. Thank you
  10. The overall goal is to have images organized. I've made the mistake of being "too organized" before though, and then not being able to find anything! Years ago I heard that it can be harder for a server to find one image in a folder of 100,000 images than finding it in an extra directory which only has 50,000 images in it. However, I don't really know if what "i heard" was true, considering the server would have to spend time finding the extra directory as well. For now, I assume that finding the extra directory would be worth the time if it broke the next significantly larger portion of the search down by 50%. However, if there were only a few files in the following folders, the extra folder depth incurred would be a waste of time.
  11. I've been trying to figure out the most efficient way to find out how much time is between point A entered using now() and point B also using now() but of course, at a different time. I'm also wondering if this is better done with PHP, but I know that's for a different forum, so I've asked this question there too. So, how do I efficiently figure out the distance between two points in time with mysql? Thank you!
  12. I've been trying to figure out the most efficient way to find out how much time is between point A entered using now() and point B also using now() but of course, at a different time. I'm also wondering if this can be done (and if it is better done) with mysql, but I know that's for a different forum, so I'll ask this question there too. So, how do I efficiently figure out the distance between two points in time? Thank you in advance.
  13. I had thought about that, but it wouldn't work the way I need it to unfortunately.
  14. If I had some PHP in an mysql table, how could I immediately run it after extracting it?
  15. The excess slashes appear to have been due to my use of mysql_real_escape_string. I removed its usage until the next PHP upgrade. stripslashes wasn't working because I was using it in the wrong place (on the right variable, but a similar looking location in the file). Thank you for your help!
  16. I want it to be like this when outputted: That's a great Joe's BBQ sandwhich! No slashes (of course, unless someone put them in there). I assume I can just make my own function str_replace("\'", "'", $string); but I still don't get why stripslashes isn't working... I hate to make a workaround when I could potentially fix the problem at its root. I did some research and found magic_quotes_sybase being on will disable stripslashes normal function and make it replace double stacked apostrophes '' but sybase is OFF.
  17. I'm getting 3 slashes when I use mysql_real_escape_string and then when I use stripslashes nothing happens. I still have 3 slashes. I turned off mysql_real... And am still getting a preceding slash, leading me to believe it's a server/php setting... However, stripslashes still does nothing so my sentences all look like this to users: That\'s a great Joe's BBQ sandwhich! Any advice is appreciated!
  18. I just recently found a good (AJAX-PHP) script here: http://www.plus2net.com/php_tutorial/php_drop_down_list.php Has good working example/sql dump for ez testing... I had to figure out for myself how to get the actual values to print in the second script though... if you need that info here's my post: http://www.phpfreaks.com/forums/index.php/topic,287884.msg1366082.html
  19. In consideration of performance: Is having a lot of folders ok? Like 500 in one folder? Or would it be best if broken down into multiple folders for performance factors? Like 100-300 folders per folder? Thank you in advance.
  20. Is htmlentities a necessity? I wonder if htmlspecialchars may be most fitting.
  21. turns out to ADD to a text box, using the javascript operator += adds/appends the text- i thought it would only work for numbers.
  22. Currently I'm using this method which just "sets" the value, replacing anything currently in there: document.getElementById("form").value = which; How do I make it "add" the value instead?
  23. Marking this puppy (thread) SOLVED! This SWFUpload has been great and is licensed under MIT! Fantastico! Thank you ym_chaitu! For others... You have to already know some JS/PHP or be ready to learn some to manipulate SWFUpload, but if you're willing to put a little time into it, it's well worth it.
  24. Looking into it now - Also, downloaded latest version [ http://code.google.com/p/swfupload/ ] Looks good so far! Thank you!
  25. I've been searching for a method/script to upload many files at once via PHP. The best solution I've found so far is an AJAX solution, but nothing else that even compares in quality/features and I don't really have the money for the $99 bucks they want to charge... Although it seems a fair price. I'm kind of curious if this script would time out like big PHP scripts scripts seem to on shared servers though... Anyone know any good way to upload a bunch of images at once?
×
×
  • 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.