Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. You can't make php show "live output." The script always gets parsed and then output is sent. There are a couple of ways you can approximate "live output" though, with ob_flush or with ajax
  2. The better way would be to not store formatted info in your database in the first place. Database data should be as raw and unformatted as possible, so that you don't have issues like this come up, when you are wanting to use the info for something else that requires a different format. For the stuff between the span tags $regexp = "<span[^>]*>(.*?)<\/span>";
  3. well you still didn't answer a lot of important questions in there...
  4. Is he going to be putting the products into the database, or are you going to have to do that? Does he expect you to make some kind of admincp so he can add/move/edit/delete categories/products? Does he want the customer product display page to be some simple dump or are you expected to paginate it? Keep track of products checkboxed to be passed and sent with the request a quote form? Does he want the request a quote form to be a simple form that sends him an email or also database driven? Does he expect you to do the site design or just the coding and someone else will be doing the design? Does he expect you to host the site? Maintain it? Finally, how much do you think your worth, an hour? Doesn't really matter though. In my experience, when someone says keywords and phrases like "doesn't have a great budget," that usually means they can't afford or don't want to pay reasonable rates.
  5. I think he probably did try it and failed and that's why he was here, and he was simply wondering if his current attempt was even on the right track.
  6. well if it's sometimes working and sometimes not, that more than likely means its a problem with conditions.
  7. If the judge were able to accurately judge who had the best answer, they probably wouldn't be asking the question in the first place. The only thing it would really be measuring (accurately) was that the question was answered, and we already have a system in place for that: the solved button.
  8. Do not try to bend the spoon, for that is impossible. Instead, try to realize that there is no spoon.
  9. cola your example won't work. function2 is not calling function1 so it's not receiving that returned info. It gets returned to wherever function1 was called. Also, your example has the return before the function2 call, so that call never gets made.
  10. I keep trying to figure out what's going wrong, but that whole "urgent" thing puts too much pressure on me. I'm too nervous to think straight.
  11. You can only return something once. When a return is triggered, everything past that return is not executed. return means that's it, function is done, this is being returned. So when it reaches that first 'return $id', all those other returns never get executed, and your function2 does not get called. If you want to return more than one variable, put all your variables into an array and return the array. If you want to execute another function inside the function, put it before the return.
  12. We have a debugging tutorial. Why don't you go to the main site and look at what tutorials are there...
  13. Okay so after converting space to underscore, you want to strip out everything except for numbers, letters, hyphens, parenthesis, and underscores. I'm assuming by those concats in your OP that we're talking about the filename itself, and not the extension, as well? $this->name = preg_replace("~[^-\w\(\)]~", '', $this->name).'.'.$this->getExt();
  14. well in OP he said he just wanted numbers and dots.
  15. If that's the only thing in your string, drisate's method is most efficient option. Though he forgot to allow for dots and \d allows for exponents, so you can make that stricter by using 0-9 range instead: // $string is the string holding the number $string = preg_replace('~[^0-9.]~','',$string);
  16. what exactly are you wanting to do with the 2nd regex?
  17. they represent the captured data. (['\"]) is the first capture, and (templ\/) is the 2nd capture. The parenthesis mark the capture start and end.
  18. google ajax file upload
  19. Or file_get_contents and use preg_replace or str_replace.
  20. But still a random number. Sweet! If you are wanting a 10 digit unique number and it doesn't matter if someone figures out the pattern etc.. then yes, time() will work for you. But your OP was talking about "converting" a string to a number, which to me sounds like you are wanting to encrypt it. If that is the case, simply picking a random number to take the place of the string does not encrypt it, all by itself. You would have to keep a table of string => number to know what the number stands for. Perhaps if you posted what your goal here is, you might get an optimal solution.
  21. nevermind I don't think that will work, I tested it, and I never got anything that started with a 2+ You are right; it won't work. rand generates a random 32 bit integer.
  22. shot in the dark, but maybe if you create an image resource from your file with imagecreatefromjpeg and send the image resource... dunno what they are doing on their end, but you would normally have a resource from something like that function and then output it with imagejpeg as raw file
  23. How about using ajax to submit files one at a time? (or onclick loop through, submitting them one at a time)
  24. You can use ajax to send multiple requests without actually submitting a form and reloading the whole page. Moving topic to ajax forum.
  25. $string = "rock,country,folk,blues,jazz,techno,alternative"; $string = "'" . str_replace(",","','",$string) . "'"; // or $string = "rock,country,folk,blues,jazz,techno,alternative"; $string = "'" . implode("','",explode(",",$string)) . "'"; Dunno which one is necessarily faster. Probably the str_replace.
×
×
  • 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.