Jump to content

Mahngiel

Newly Registered
  • Posts

    1,068
  • Joined

  • Last visited

Everything posted by Mahngiel

  1. You can get it for free if you contribute to / lead an open source project
  2. jrw4 last visited these forums in december of 2009. i don't think he'll be responding to your help.
  3. Here's my method for such, using objects and ternary for brevity: <select name="class"> <?php foreach($available_classes as $class):?> <option // Compare the user's class id with the available class id's, if there's a match, establish it selected (($user->class->class_id == $class->class_id) ? 'selected=selected' : '' ) // create the option's value value= "<?php echo $class->class_id;?>" > // create the option's text <?php echo $class->class_title; ?> </option> <?php endforeach; ?> </select>
  4. You have no disaster reporting. place "echo "fail"; " inside of your }else{ } conditional. if you see fail, there's something wrong with your request.
  5. If you're only going to be displaying one to a few images at a time, then just resize with CSS. You could even set up a modal box using the same image source - which reduces HTTP requests. Using CSS means you will not have to carry multiple copies of the same file. Depending on your layout, you need to maintain aspect ratio. #main .image_div > img { width: 500px; height: auto; } #sidebar .images > img { height: 100px; width: auto; }
  6. Just as CPD showed you $SOURCE = http://path.to.xml; // remote file $SOURCE = "xml string you wish to iterate through"; // local string $xmlObj = new SimpleXMLElement($SOURCE);
  7. to expand on what CPD said, You will need to run a foreach with conditionals to meet your criteria. $lines =& $xmlObj->line; foreach( $lines as $line ): { if( $line->ProductGroup == 'S01' && $line Availability != '0' ) { echo 'meets condition'; } } [/code]
  8. quite the script there lite - could very well be overkill, depending on OP's needs. Lots of variability comes into play, depending on what, where, how, and why the images are displaying.
  9. if you just want to loop through some results with a lot of images for display (like in a gallery), you should be using CSS to do this. #this_div > img { width: 150px; height: auto; }
  10. @ redsmurph: My lack of coffee this morning hid the true question. Yes, I agree merylvingien will best be suited to run a select and newly formatted insert query. The largest issue in this is how to identify the "major" city from the from table and place it appropriately in the to table. There would need to be some sort of array to check values against to determine this.
  11. @redsmurph OP wants a single table row per zip code, not per city. Therefore your "merge cities and zips in realtime" would no be effective, whereas it would be quite simple to maintain a text type cell for `cities` and create an explode-able array for the values to check against. ie id | zip | cities | state | row | row 1 | 07677 |woodcliff lake, westwood, woodcliff lk | new jersey | 41.02 | -74 // explode array to check for city exists $cities = explode(', ', $row[cities]); // if not, add value ( !in_array($_POST['city'], $cities) ? array_push($cities, $_POST['city']) : '' ); // implode before resending $cities = implode(', ' $cities); // update db
  12. String parsing is relevant because you're attempting to send strings contained within variables to mysql. Double quoting php variables ensures the literal parsing.
  13. in my suggestion, the zip code does remain unique. Let me try to flow-chart this for you: User submits form ->Script checks if submitted zip exists in table ->-> If zip does not exists in table ->->-> Insert zip and city ->-> If zip exists in table ->->-> Append city name to existing 'city' (as it was inserted initially when the zip did not exist) You now have a table with this format id | zip | cities | state | row | row 1 | 07677 |woodcliff lake, westwood, woodcliff lk | new jersey | 41.02 | -74
  14. http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing
  15. Because you stated in your original post you wanted to retrieve ALL the records for a player. If you wanted to only display the results requiring conditionally met circumstances (such as black and white) then AND would be appropriate.
  16. Shouldn't you use the $key, since the value he's trying to compare is the key for the value?
  17. If i understand correctly and In my opinion, what you're asking to do is silly because you're wanting to dynamically add rows to a table, and that can and will get out of hand quickly. Now, understandably, there can be many variations of spelling and multiple cities sharing the same zip code. My personal approach would be to change the row type for 'city' in your table to text type. Then have the form submission script check for the existence of the zip code submitted, if it exists, you could return the value of the 'city' row and append the new submission to the cell. You could avoid redundant city inputs by exploding the cell content and conditionally checking for the existence of said city before appending.
  18. So we do not have to count, can you post the relevant lines surrounding the parsed errors? (lines 58, 64, and 71)
×
×
  • 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.