-
Posts
15,266 -
Joined
-
Last visited
-
Days Won
431
Everything posted by requinix
-
Why do you need a database? Why do you need anything more complicated than something like function get_months() { return ["January", "February", "March", etc]; }Internationalization/support for different languages is an acceptable answer, but doesn't seem to be the case here.
-
Not sure you understood what I said... What is installed on your system that is sending the email? It's probably not PHP, rather PHP is telling the thing to send the email.
-
Do you know it's the mb_send_mail() and underlying mail() that's slow? Could it be the machine's MTA that's being slow - perhaps trying to send the email immediately instead of queueing it up locally to send later?
-
Use strptime to read in the date string, then date to output it in whatever format you want. Or DateTime::createFromFormat followed by ->format.
-
How To Ask Questions The Smart Way When you come back to fill in the missing details, include your code inline in your post - attachments are annoying to deal with.
-
How To Ask Questions The Smart Way When you come back to fill in the missing details, include your code inline in your post - attachments are annoying to deal with.
-
It's easy to make PHP look bad when you don't try to use it well. <?php foreach ($data as $eid => $cdata) { ?> <tr> <td class="eid"><?=html_escape($eid)?></td> <?php foreach ($cdata as $content) { ?> <td> <ul> <?php foreach ($content as $file) { ?> <li><a href="#"><?=html_escape($file)?></a></li> <?php } ?> </ul> </td> <?php } ?> </tr> <?php } ?> First of all, do you understand what the code you have already is doing? How it works?
-
If you can turn the string A.pdf; B.pdf; C.xlsx into a prefix A.pdf separator B.pdf separator C.xslx suffixformat, all with the same "separator", then it fits into the code you already have. Do you see how you can do that?
-
Thank you page? Where is that? I don't see any message in the PHP: if everything works then you should get a blank page.
-
PHP script for downloading mp4 and mp3 files
requinix replied to ZakEzekiel's topic in PHP Coding Help
Given how you're borrowing Youtube videos for the playback, we are not going to help you. -
You also need a line of code that adds the month category into the array. Outside of the loop. $out[$element['category']]['category'] = $element['category'];Take a look at the documentation for array_values. Do you see what it does to arrays? It strips off the custom keys and replaces them with regular numeric keys. You need to do that to your array before you json_encode() it - those custom keys vs numeric keys are what makes the difference between getting {} objects or [] arrays in the JSON.
-
Adding a index.html does not automatically forbid access so I think there's something else going on there. IIS is IIS. It's not Apache. It works differently. Just because doing one thing with IIS gets you the result you want doesn't mean that doing the same thing on Apache will too. But I'm still not clear on what you're doing. How are you forbidding access? Is it definitely Apache's 404 page and not its 403 page? If it is the former, have you tried either of the things I said?
-
When Apache serves a 404 it uses the ErrorDocument setting. You have two options: 1. Use URL rewriting to rewrite non-existent requests to the framework, thus bypassing the 404 mechanism entirely. This is best. RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ whatever.php [L]2. Use ErrorDocument to make the framework also serve as the 404 page. You say 404 but you're describing 403s. Is that what you mean? You've explicitly forbidden access to something (with an Order/Allow/Deny) and need CI to take over?
-
Start by building { "November": { "A": 7, "B": 8, "C": 3, "D": 4, "category": "November" }, "December": { "A": 1, "B": 2, "C": 1, "category": "December" } }You're close to that already: $out[$element['category']][] = array($element['trainFunction']=> $element['value1']);Move the trainFunction value into the empty [] to specify a key, then remove the array() part so that it's just value1. Then use array_values() on $out to strip off the outermost keys and turn it into a regular array.
-
You have curly braces {} between a1 and a2 instead of parentheses ().
-
Look closer at those parentheses you thought you typed.
-
Searching through serialized data... ugh. AND has higher precedence than OR, just like how multiplication has higher mathematical precedence than addition. That means writing a OR b AND c 2 + 4 * 5is equivalent to a OR (b AND c) 2 + (4 * 5)Applying that to your query we discover you've effectively written matches q1 OR matches q2 OR (matches q3 AND is not shop manager AND is subscriber)Use parentheses to force evaluation the way you want: (matches q1 OR matches q2 OR matches q3) AND is not shop manager AND is subscriberBut I fear you may discover other problems.
-
Oh, I missed something that would have been nice to point out. Remember how you made joke_text sticky? "If the joke_text is present in $_POST then output it"? Start with the same concept except with the author if(isset($_POST['author'])) { echo $_POST['author']; } then add a condition that the POSTed author matches the author in $data (remembering that what's in $_POST will be the author ID and not the name) if(isset($_POST['author']) && $_POST['author'] == $data['id']) { echo $_POST['author']; } then change the output to be not the value from $_POST but "selected". if(isset($_POST['author']) && $_POST['author'] == $data['id']) { echo 'selected'; }
-
Huh? The results you want are the inactive users, and the query you described will return the inactive users. Where's the problem?
-
That's a step in a direction that will not take you away from where you need to go. You still need the comparison: output the "selected" if the ID in $data matches the ID from the form. That means there's going to be a == in there.
-
Try it and find out No really: a great thing about PHP is that if you're not sure about whether something will work or not then you can just try it and see what happens. Though I'll say you should just do "selected" and not the whole "selected=selected" thing - it's more modern.
-
To make an option selected, add a "selected" attribute to it. As in WhateverBe sure to only mark the right one as selected - the name will match what's in $_POST. Try that out, and if you have a problem then post what you have.
-
o7 There's also the simpler foreach loop: foreach ($corpid as $id) { $url="https://api.eveonline.com/corp/CorporationSheet.xml.aspx?corporationID=" . $id;And SimpleXML supports loading directly from a URL so you can skip the file_get_contents() step and do $list = new SimpleXMLElement($url, 0, true); // true=first argument is a url
-
Sounds like you're asking for plain ol' form-processing-in-PHP code. Since your form is already pointing to predictor.php, make the code in there look like <?php if (isset($_POST["submit"])) { // submit button was pressed /* process the form data however you want */ } else { /* form was not submitted. you can display the form here or redirect back to the form page or whatever. */ }To get the values you need to pass to your predictor() function, use $_POST. The function will return a value that you can output however you want.
-
Showing mele or female and brith date from entered personal id number
requinix replied to HaxorNab's topic in PHP Coding Help
Take a look at substr. Write some code and if you have problems then come back and post what you have and a description about what is happening.