Jump to content

michaellunsford

Members
  • Posts

    1,023
  • Joined

  • Last visited

Everything posted by michaellunsford

  1. Odd. Checked a few places and it looks like you're right. It's an old habit of mine: if you open it, close it. Don't know that I can ever go back to the old HTML 4 methods.
  2. must have missed my edit -- does input no longer need to be closed in 5? It validates...
  3. ah hah! I knew there was a solution. I had searched for "default value" and a few other things -- the term "placeholder" escaped me for the moment. the space is pretty tight, so I had wanted to avoid the label. the placeholder is exactly what I was looking for. I am using HTML 5, btw. Validator says it's good. Why did you think I'm still on XHTML? 5 no longer requires closing the attribute?
  4. Sorry for the delay in replying. Phpfreaks notifications suddenly started going to the junk folder. ??? Anyway, you guys are both right. The ^/d{5}$ works fine. EXCEPT I was setting value="Zip Code" (it's not a five digit number, and it's not blank). That field has a javascript on it that blanks on focus or submit. Unfortunately, Firefox won't fire the submit script if the RegEx doesn't match. Sooo..... Is it possible to have a default value in an input field that doesn't match the RegEx? I'm thinking to just go all javascript and dump the pattern idea.
  5. <input type="text" maxlength="5" name="zip" value="Zip Code" pattern="(\d{5})?" /> So, if the zip code is filled, it should be a five digit number. If it's not filled it's optional. The above RegEx is forcing everyone to enter a zip code. Can HTML do this, or am I going to have to script it?
  6. hum. thought this was local and that's why it didn't cross over. But, your solution works great. Thanks!
  7. This little bit of code fires a database insert and gets the keyfield ID number back. Everything works, except the last part: assigning the returned number to the ID attribute of the table cell that was clicked. Looks like $.ajax knows what $(this) is, but forgets before getting to .complete. How do I get the "this" variable to be recognized inside the .complete function? $('table td').click(function() { //user clicks a table cell alert($(this).index()); //test case returns '9' $.ajax({ url: "update.php", type: "POST", data: { action: 'clicked', clicked: $(this).index(), //the column that was clicked row: $(this).parent().attr('id').substr(4) //the row that was clicked (tr has an ID attribute like "row22") } }) .complete(function(data) { alert($(this).index()); //test case should return '9', but returns '-1' instead. console.log(data.responseText); //console gets the assigned id from a database insert -- works fine. $(this).attr('id','ros'+data.responseText); //doesn't work. did .complete forget what $(this) is? }); } I thought about making a hidden element, or global variable to assign $(this) to, but that seems like the long way around. Any other ideas?
  8. I'm wanting to install plesk, which requires a LAMP server (or my version does, anyway). Also curious about uptime, and the (legendary?) scalability of these environments.
  9. I'm running about 50 domains on a private host that's going out of business, so I need to move providers soon. The Amazon or Google cloud platforms are intriguing. Does anyone have any experience using either for website hosting? My current solution is a Plesk management interface. So, I'm hoping to install the same wherever I go (because migrating 50 domains manually ...)
  10. Very nice, Jacques! I have never heard of filter_var(). Thanks for sharing
  11. It's just a text file. No comma separated list or anything complicated like that. Just one email address per line. If Zane is right, it looks like I will have to depend upon PHP to do the work and not RegEx. Not a problem, I was just hoping that RegEx would have some kind of solution.
  12. One email address per line, thousands of lines. I was hoping to just use a text editor to do the work, but I may have to make a php loop to do it. here's the regex: ^([a-z0-9-_\.]+@[a-z0-9-_]+\.[a-z]{2,3})$ Tested the RegEx, and it works great. It returns thousands of lines of matched email addresses. Problem is, I only want it to find the lines that don't match. How do you make RegEx return unmatched lines?
  13. I can't seem to get the right search phrase together to find this on google. So far, all that comes up is how to save a form's POST results to a database. Anyway, the goal is to create a page where a user can build their own HTML form using a web GUI. I can pull it all together with a little AJAX, but getting stuck on how to store it. Things like check boxes and text fields seem simple enough. It'd just require a form_id, field_name, label, type_of_field, and default_value. But how to store a radio group or select option group?
  14. It's not just "once in a while" this is a "just once" query. The data is being offloaded for a migration. By the way, all records (about 5,000) came through in under a second. For grins, I ran the EXPLAIN EXTENDED on it, but it looks like part of the answer was truncated by phpMyAdmin. I could run it from the command-line if you'd like. Also, I did check SHOW INDEX on both tables before running the query, and every field (including ones not called in the query) was indexed. id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE list ref PRIMARY PRIMARY 4 const 6422 100.00 Using index 1 SIMPLE subscriber eq_ref PRIMARY,idx_subscriber_confirmed,idx_s... PRIMARY 4 func 1 100.00 Using where edit: looks like the forum editor dropped the table the above was wrapped in :-/
  15. Tell me about it. It's nuts! Who does that? Barand, that inner join did the trick. The query was nearly instantaneous! Now to see how 500 or 1000 records will do.
  16. The problem is `subscriberid` in one table is a negative number, and positive in the other table. To get a match, MySQL has to do the math. (see first WHERE clause). Is there a better way to write this query? SELECT `name`, `email`, `subscribe_date`, FROM `subscriber`, `list` WHERE (`subscriber`.`subscriberid` + `list`.`subscriberid` = 0) AND `unsubscribe_date` = '0000-00-00 00:00:00' AND `confirmed` = 1 LIMIT 0, 20 This query, limited to 20 results, took 45 seconds to run. Note: I didn't design it -- just need the data, and can't break anything to get it.
  17. Interesting. Looking for a tutorial or example out there without much luck. Got a link / starting point?
  18. Well, the issue is more with the time than the processor, as a curl call isn't really that processor intensive. It's mostly just waiting on the internet to send the page. I didn't know about curl_multi... it looks like the same thing as doing a curl loop, no? Now, running it as a background daemon is an interesting idea. Are we talking about making a PHP script terminate and stay resident (TSR) or more of the cron daemon calling the php script every five minutes?
  19. Okay, I think I get it. The RESTful document sends the list, and the admin UI works through it. But I'd still have to use fork processes with cron, no?
  20. A php file whose job it is to check a website and update an index will take a long time. It uses curl to go out to a webpage and ping each individual article, compare to the local database, and then timestamp anything that's changed for sorting purposes. It works great for one or two things, but when confronted with a hundred, the curl script just can't handle all that and complete in a timely manner (although I haven't actually tried it yet). Forking the individual curl calls is a possibility (which I've never done before), but the script also needs to be manually called from a web browser. Is there a single solution for this, or do I build the fork page for cron and a separate ajax page for the browser?
  21. Thanks, guys. I'll go in and rewrite the query to include the alias and all the other fields I need for the summary page.
  22. Thanks for the quick replies. I suppose you guys are right. Now, I had thought the * was easier on the database than a long query with a score of field names written out. Not so? speaking of tedium, back-ticking everything is automatic, so it just goes in every query I write.
  23. SELECT * FROM `table1`,`table2` WHERE `table1`.`userid` = `table2`.`keyfield` LIMIT 30 they keyfield in `table1` and `table2` have the same name, so the database returns two identically named fields with different values. Should I rename one of the keyfields in the database, or is there a way to write the query to rename one of them without having to call every single other field? for example, I can rename the field like so, but it will only return the keyfield from the second table: SELECT `table1`.*, `table2`.`keyfield` AS `userkey` FROM `table1`,`table2` WHERE `table1`.`userid` = `table2`.`keyfield` LIMIT 30 To get around it, I'd have to add `table2`.`name`, `table2`.`address`, `table2`.`phone`, ...etc to the select portion of the query -- making it rather unwieldy. I run into this kind of problem occasionally, and permanently renaming one of keyfields in one of the tables would 'fix' the problem. However, I'm hoping there's another way (so I don't have to go back and debug a bunch of other queries across the whole site). Thoughts?
  24. Woah, Sen, that's just awesome! Hopefully with a few tweaks it'll find more than just the one space (if more than one exists, that is). To answer mac_gyver's question -- it's a photograph of one of the events listed in the table. I'll probably end up putting an in-line style in the spanned cell with a centered (and roughly scaled) background image so it doesn't push the table out of shape.
  25. By "large" I mean three or more empty rows and two or more empty columns clustered together in an HTML table. If all the columns in any particular location (displayed in rows) is completely empty for the entire week, it won't be displayed. So, each row has at least one column populated. The events and vacancies tend to cluster. The tough part is identifying clusters of empty cells in that HTML table (that the script is building from an array), so it can combine them using colspan and rowspan attributes. These areas will be populated with an image.
×
×
  • 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.