Jump to content

dalecosp

Members
  • Posts

    471
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by dalecosp

  1. dalecosp

    array

    $myArray = array(); foreach (range("a","z") as $letter) { $x=1; while ($x<1001) { $myArray[] = $letter.str_pad($x,4,"0",STR_PAD_LEFT).str_pad($x,4,"0",STR_PAD_LEFT); $x++; } }
  2. At registration, test a version of the proposed username with the spaces removed against the database. If it exists already, advise that the username is already in use and the user should select another.
  3. It looks like you need to read this: http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawed_README.htm and either set up or modify an array called $config at the top of whatever PHP file is processing the HTML. HTH,
  4. I'm afraid I can't help based on that alone. For example, what does "It does not work" mean? Do you see a blank page in the browser? Do you receive an error message? Do smoke pour out of the server and choke the SysOp? And, ouch, die() as your only error handler? I guess that depends on some other factors ... if it's in house or development only, that's a quick and dirty way to handle the failure, I guess. To help you with debugging, how about something more like? foreach($_POST['mid'] as $key=>$val) { $percent = $_POST['percent']; $detail = $_POST['detail']; $qty = $_POST['qty']; $rate = $_POST['rate']; $sql = "UPDATE val_mworks SET mworks_percent = '$percent[$key]', mworks_detail = '$detail[$key]', mworks_qty = '$qty[$key]', mworks_rate = '$rate[$key]' WHERE mworks_id = '$val' "; $result = mysql_query($sql); if (!$result) { echo "MySQL Query Failed! SQL was : $sql MySQL said : ".mysql_error(); die(); } }And if that doesn't get you any answers, I'd check logs and possibly open a ticket with your host? (Assuming you have a hosting service, of course).
  5. "free of cost" So, how will you be recompensed for your effort? By the knowledge you gain? That's valid, but you can't eat it, of course. At least, not *yet* I'm a big advocate for flow charting on paper. And not even so much flow charting at first, as just drawing pictures and writing important concepts in such a way that I can visualize a problem domain. If you don't have experience designing databases, I'd read up on that. It can make a big difference in how your application will work later. Do you need classes? Well ... I don't know ... have you ever written "OO" code? I typically find that "OO" code is fine if I think that I'm working with something that can be objectified ... and perhaps your problems can. Rooms could be objects, floors could be objects, and so on. But it may not be absolutely necessary to do it this way, and if you have little experience with it, it may make things more difficult. But get out your paper and pencil first ;-) My $0.02,
  6. I can't remember the last time I used the "main" page ... have the manual pages changed as well? They look the same to me so far ...
  7. That's normal. The cookie is placed in the browser's cache, but since the page has already been loaded, the cookie wasn't present at page load. Since you already know the "name", put it in another variable ... it will be usable there.
  8. I have an application that reads the Internet and makes "data widgets", that is, representations of things it has read. Part of the application inspects these "data widgets" and assigns various bits of metadata to each one ... a "category", a "source", and so on. The next step to to move these widgets from a local server to a server on the West Coast. But rather than loop through this entire process, making a connection to the remote box each time, we pack up each "data widget" using serialize() and put it in a DB table which serves as a queue for the next step. The final step reads the DB table, loops through the results, unserialize()ing them back into their original object form, and pushing them out to the West Coast server. Does that help at all? You serialize() data in order to store it more concisely (the holding queue is 3 fields, while the object itself, if stored in a database, has a few dozen fields). You unserialize this data blob to turn it back into a usable object.
  9. Hmm ... a couple suggestions, maybe. Try getting rid of the delete on each pageload and just write an admin script to run from cron every two hours. Are you just running reverse chronological chat? "Select * from some_table" is usually overkill. If you only want, for example, to show the most recent conversation, would something like "select time, chat_text from chat_table order by time desc limit 20;" work ?
  10. He isn't just outputting hours, though. I'm not sure if I understand the question, OP. Do you want the form to always start on "tomorrow morning"?
  11. I'd even go farther and say it's a problem with database design, or application design overall. But nothing's every quite perfect, is it? ginerjm makes some sense ... so you have too many rows ... just show the other info once and each photo in turn. Another thought, which might be expensive, is to do one query for the car data and a second query for all the photos; put them in an array and handle this array in your PHP logic. You generally would prefer to not hit the DB multiple times, but if you can't change the design of the data, you can change the design of the queries.
  12. Are you looking for text *along with* an image, that is, printed text near the image, or printed text *on* the image, as in a watermark? For watermarking, you need to get into the gd_ functions.
  13. dalecosp

    Hello!

    Welcome, fellow Freak!
  14. It would really help anyone who seriously wants to help if you would post the code as it exists right now, and the exact error message...
  15. I'm sure you're not Pathetic, Sam. The only parse error in what you've posted is 1] the lack of the opening PHP declaration, and 2] the "pointer" which should be a comment: If the parse error you quoted: is really what the server/debugger tells you, then you didn't cut and paste the code exactly as it exists in the problem installation....
  16. What does your debugger say? (F12, man, F12!)
  17. To elaborate a tad further, you often see this: select `something` from `someplace` where `some_condition` = 1234;Those are "backticks", and people that use them use them in order to make sure that their SQL server, (MySQL in this case, and especially) doesn't choke on any terms. For example, you can use a reserved word as a column name, but only if you enclose it in backticks. I tend NOT to use them, and to (properly, I believe) refrain from using SQL Reserved Words as column names. HTH,
  18. +1. Explain your data and perhaps someone can give you a good layout for a real *relational* database. Having a table for every user is a big no-no.
  19. Re-read my first post, it's been edited ... I flew off the handle a bit too soon, and that would cause the second error.
  20. And, actually, you'll probably want something besides "Oh noes, an error!" --- either debugging information (if you're in development), or a proper error handling routine if not.
  21. Check for $result before you call mysqli_fetch_array. It's apparently returning false. $result = mysqli_query($connection,"SELECT * FROM ".$myusername."-mail ORDER BY date ASC"); if ($result) { while($row = mysqli_fetch_array($result)) { echo "done"; echo "<br>"; } } else { echo "Oh noes, an error!"; }
  22. Welcome to PHPFreaks! (From another "newbie" who's really not-so-new)
  23. Why not just do it with Javascript? <script type='text/javascript'> window.open = function() { return; } </script>A dysfunctional function!
  24. Your first and second Pastebin links both go to the sidebar template; neither links to the jQuery script. What does your PHP script send as a response to the Ajax ... "ok", or "failed"?
×
×
  • 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.