-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
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).
-
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.
-
MySQL 5.5 UPDATE Syntax table_references is the same thing you might give to a SELECT.
-
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.
-
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.
-
PHP code not working on a certain server
requinix replied to ConfigureWEB's topic in PHP Coding Help
Could it be that it's working perfectly fine? Your script won't output anything if it works. -
[HELP] Unknown MySQL server host 'DB_SERVER' (11004)
requinix replied to Diether's topic in PHP Coding Help
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). -
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
-
And you're using the wrong quotes for the table and field names. They have to be backticks `, not quotes " or apostrophes '.
-
Simple PHP & Mysql Program ! Need your help
requinix replied to BinaryPax's topic in PHP Coding Help
$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? -
Simple PHP & Mysql Program ! Need your help
requinix replied to BinaryPax's topic in PHP Coding Help
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 / -
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) {
-
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.
-
PHP Download file to server and update a status bar
requinix replied to rukas's topic in PHP Coding Help
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. -
How do I delete an "aux" directory in Windows 7?
requinix replied to yoursurrogategod's topic in Miscellaneous
Have you tried deleting it in Cygwin? Otherwise, relevant KB article. -
Connecting to a database that stores the password in plain text
requinix replied to Eiolon's topic in Application Design
Unless you have to adhere to some specific guidelines, you don't need an SSL connection to the database. -
Add <?php Echo $_get["q"]; ?> In My Php Code
requinix replied to bondigor69's topic in PHP Coding Help
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. -
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?
-
How to generate PDF file so it can be downloaded?
requinix replied to exphp's topic in PHP Coding Help
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. -
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.