Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. If you don't want AJAX (I applaud your decision to not rely on it) then you'll have to settle for a page refresh, in which case it's basically just a normal PHP page with a form that submits to itself. That could very well be fine for your purposes - it just wasn't what you initially described. Well... there's also vanilla Javascript, but it sounds like your objection is less about AJAX and more about Javascript. What I said about mocking up the page still stands except now it's a lot easier to make it work. For the textboxes on the right you do a loop according to whatever number came from the form, but only if the form was submitted and if the number is a valid choice (a positive number within reason, that kind of thing).
  2. Unless you want to drive it entirely with Javascript, AJAX is your best option. Your tasks are: 1. Make a page (doesn't have to be PHP) that outputs the right HTML. Put some placeholder content in the right DIV so you can see what it looks like. 2. Remove that placeholder stuff. 3. Make a PHP script, or reuse the one from before, that outputs only the HTML needed to replicate that placeholder HTML. Doesn't need the and and all that, just the DIV content.4. Learn how to use AJAX, maybe get yourself a Javascript framework along the way. Use that to call your PHP script: pass in the value from the SELECT and fill that DIV with whatever HTML it returns. 5. Other stuff, because I'm pretty sure you want to do more than just make it look that way.
  3. MySQL 5.5 UPDATE Syntax table_references is the same thing you might give to a SELECT.
  4. Have a careful read over the documentation for include() - require() and include() and the like all behave exactly the same when it comes to locating files.
  5. You set the error array to be empty, then check if there's something in it (spoiler: there won't be), then add errors to it, then completely ignore whether there were errors and continue on regardless. It also seems like you have something which looks for a change-success message and, if present, ignores any change-err messages. [edit] Also, $pass = substr(sha1($_POST['password3'])); Don't know what that's supposed to do but since you didn't give a second argument to substr() $pass will be null or false, and $_SESSION['msg']['change-success']='Your existing password has been changed. '.$pass; I assume you add in the $pass for debugging? Which won't work because of the whole "null or false" thing.
  6. Could it be that it's working perfectly fine? Your script won't output anything if it works.
  7. What you've shown aside, DB_SERVER is not defined. That must mean the config.php you've posted was not included. Is it in the same folder as your index.php? That's where PHP is looking. Whatever file is there is the one that was included. The other error is because the syntax for getting to class variables is $this->connection Note how there's only one $ in there - you don't put it on the "connection" as well. You've done that a few times (and inconsistently).
  8. DISTINCT there will apply to all the columns combined. Your query is nonsensical. SELECT fname, lname FROM registration -- ORDER BY yards ASC if it's in the registration table
  9. And you're using the wrong quotes for the table and field names. They have to be backticks `, not quotes " or apostrophes '.
  10. Not if it's a number it doesn't. Numbers should never get quotes.
  11. The only possible way I see that query failing is if the $id doesn't contain the right value. Echo out the $sql and see what's wrong.
  12. $RsultE1 Perhaps, but that's not what I'm talking about. This exact purpose aside and focusing just on the tables specifically, don't they all contain the same type of data? All have ID numbers, names, dates, and so on? Or put another way do all the tables have the same columns and structure? If so then you have a bunch of unnecessary tables: you can put all the same data into one table and add a column that lets you keep track of what mission each row is for. Having just one table would make this all a lot easier, right?
  13. You typoed one of the variable names (in the first part of the script). But really you shouldn't have 6 tables for what sounds like the same type of data. You only need one table: it looks exactly the same as your A-F tables but it has a column indicating what type of mission it is. And if you think the missions could ever change then there's a second table with the list of possible missions (and the other table has a foreign key off to it). In fact that's just a good idea anyways. list of missions id | mission ---+-------- 1 | A 2 | B 3 | C 4 | D 5 | E 6 | F the new table fields... | mission ----------+-------- ... | 1 \ ... | 1 \_ All "A" missions ... | 1 / ... | 1 / ... | 2 \ ... | 2 \_ All "B" missions ... | 2 / ... | 2 /
  14. Posting the code inline will get a lot more people looking at it. I don't see anything unusual in the XML so a quick example using SimpleXML would be $xml = new SimpleXMLElement("http://www.tfl.gov.uk/tfl/syndication/feeds/cycle-hire/livecyclehireupdates.xml", 0, true); foreach ($xml->station as $station) { echo "At {$station->name} there are {$station->nbBikes} bikes and {$station->nbEmptyDocks} of {$station->nbDocks} empty docks\n"; } [edit] You can target specific nodes with XPath. foreach ($xml->xpath("station[id=51 or id=123 or id=344]") as $station) {
  15. Re: IDs in the URL (which I think has already been addressed) What's to stop two people from creating threads with nearly identical titles? Especially something like "HELP" http://www.example.com/forums/php/help and the more urgent "HELP!!!" http://www.example.com/forums/php/help The title alone isn't unique. The ID is a very easy and low-impact solution: stick it somewhere in the URL so that you can pull it out and make the rest look as pretty as you want. (meanwhile the forum name is probably unique enough to be by itself, but there's something to be said about the consistency of "name-id" for both the forum and the thread) Re: Friendly URLs They're one more thing search engines can look at. Certainly relevant, though I don't think they matter as much as some people think they do. It's not like changing the structure of your URLs will suddenly bump you up in the rankings. Page content matters a helluva lot more than the URL (which the prevalence and effectiveness of phishing demonstrates). "Oh but that's what the user sees, not the search engine!" The whole point of a search engine is to get people to the pages they want to see when they don't actually know where it is. They have to rank pages according to how real people see them; if they ranked otherwise then they would be pointless because they'd be so ineffective that nobody would use them. Quite logically, the most effective search engine will be one that sees pages the same way users do. Blah blah blah.
  16. Easiest way would be with APC, second most with a database. The script doing the download needs to know how far it's gone and possibly how much further it needs to go (if you want that). As it's downloading it updates whatever location you want with its progress. The progress bar and corresponding AJAX read that data. Note you can't use copy() or file_get_contents() for this - has to be a fopen/fread/fclose loop. Although cURL is powerful, it might have something relevant.
  17. Have you tried deleting it in Cygwin? Otherwise, relevant KB article.
  18. Maybe they can't find their posts because the font is so small.
  19. MLM? Not sure if I want to help... What did you try to do? What problem(s) did you have with it?
  20. Unless you have to adhere to some specific guidelines, you don't need an SSL connection to the database.
  21. 1. If the "q" is set then use it, otherwise use a default value. 2. Validate it. It should be one of "news" or whatever else is valid for that feed. If it's not valid then do something besides ignore the problem. 3. Stick it in the string. There are many ways to do this and if you know even the smallest amount of PHP then you can do it.
  22. Keep track of the last time they did it and don't let them to it again if it's been within 24 hours. Yeah, I know, pretty obvious. What else are you expecting us to say?
  23. Depends: has anyone really been far even as decided to use even go to want to do look more like? On a more serious note, What?
  24. Except in IE, and hopefully just the older versions, the filename you link to doesn't matter. Along with the header() that says it's a PDF file, include a header("Content-Disposition: attachment; filename=report.pdf"); That will make the browser prompt to download and will use the filename "report.pdf" by default.
  25. mysql_fetch_array() returns the data duplicated: one array item for each numeric key (0, 1, 2) and one for each string key ("product_supplier_reference", "price", "wholesale_price"). Use mysql_fetch_assoc() to get just the string keys or mysql_fetch_row() to get just the numeric keys. Also, please try to switch to PDO or mysqli. Those two are more efficient, can make your code much safer, and offer more functionality.
×
×
  • 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.