-
Posts
15,266 -
Joined
-
Last visited
-
Days Won
431
Everything posted by requinix
-
Fatal error: Cannot redeclare PHPMailerAutoload()
requinix replied to VanityCrush's topic in PHP Coding Help
"Fatal error" means your script is crashing. That is not good. The fact that it crashes after sending the email is fortunate but still not acceptable. Whatever file that contains the PHPMailerAutoload function is being included twice. That's a problem because you're telling PHP that you want to define this function twice. Which is bad. Use include_once() or require_once() instead (the latter is better for a dependency) to tell PHP that those files should only be included once. Do that everywhere you include files which define classes or functions or autoloaders. -
And now what happens if you put that all into a literal string and call the API with it directly? You should get the same error. The next question is what did you put in the "a string here" that made the API call work, and how does it differ with $yaml?
-
Ignore HTML tag in one section but parse in another
requinix replied to codeinphp's topic in PHP Coding Help
Sounds like you should be locating //div[@class=prog_cols] first, then within each of those locating the three parts you want. -
You mean which style is better, quotation marks or named placeholders? There's no difference technically, but if you use named placeholders then it's easier to make sure your variables are lined up correctly and less risk of accidentally putting variables in the wrong place.
-
You are definitely passing a string, so the problem must lie within the value of $yaml itself.
-
First, get rid of all that crazy parsing stuff you have there and just use parse_str. You'll end up with an array that looks like array( "nfl_s_delay" => "120", "nfl_s_stamp" => "0805040635", "nfl_s_left1" => "Minnesota at Pittsburgh (8:00 PM ET)", "nfl_s_right1_count" => "0", "nfl_s_url1" => "http://sports.espn.go.com/nfl/preview?gameId=400761517", "nfl_s_count" => "1", "nfl_s_loaded" => "true" )Are you saying your problem is that you're seeing PHP code instead of XML? Or, exactly what are you seeing?
-
PHP mail, Where is the password for from address?
requinix replied to colap's topic in PHP Coding Help
Yes. The configuration for the thing you have installed on your system which provides a "sendmail" program. Remember this subject from your other threads? -
*thrice Code inside a loop executes once for every time in the loop. Code inside a loop inside a loop executes once for every time in one loop and again for every time in the other loop. 3 fruit * 3 other things = 9 times total. PHP doesn't have a loop you can use for multiple arrays at once, so you have to do it yourself. The job is easier with functions like reset, key, current, and next. (There are other ways too.) $first = "apple,carrot,pine"; $second = "fruit,veggie,tree"; $array1 = explode(",", $first); $array2 = explode(",", $second); reset($array1); reset($array2); while (key($array1) !== null && key($array2) !== null) { $number1 = current($array1); $number2 = current($array2); echo $number1, $number2, "<br>"; next($array1); next($array2); } 3v4l.org/gmc2T
-
Help with adding an auto-reply type of message
requinix replied to Chrisj's topic in PHP Coding Help
I'm not sure what you mean there. You'll probably want to edit the subject line of the email. Right now it's some "email_new_email" value, which sounds generic so you may not need to do anything with the subject after all. but I don't know how to change $members_email to "the sender". $to is the email address to send to. Initially it was the $members_email which is (apparently) the person you were trying to send to at first, but now you need to make it be the sender's email address instead. I don't know where you will need to get that value from because it's not referenced in the code you posted. -
Umm, well, $found = false;and then // if found the file { $found = true; // }and then later if (!$found) { echo "Not found"; }
-
Since you're using a form with method="post" then the information you want will be in the $_POST superglobal array. if ($_SERVER["REQUEST_METHOD"] == "POST") { // if you submitted the form echo $_POST["first_name"];
-
Help with adding an auto-reply type of message
requinix replied to Chrisj's topic in PHP Coding Help
1. Add an else, like you said. 2. Copy the code you have now into the else branch. You're copying it because that's how it sends emails already, not because you want to send the same email. 3. Modify the appropriate parts: - Email template, probably both $email_template and $inner_template1 - Subject too - The $to email should be the sender (the $from doesn't change as that's the system email) Everything else looks the same as it deals with templating and with sending emails in general. -
Use a variable to track if any files were found. It starts with the value false and you set it to true when you find the file. After the loop you check the variable.
-
Could it have something to do with the fact that you're trying to use CSV parsing on data that is not CSV? Should your regular expression be more specific, to match "blog" and "xx yy" and "zz" separately?
-
PHP mail, Where is the password for from address?
requinix replied to colap's topic in PHP Coding Help
Obviously not in there. Depends on your sendmail program's configuration. -
Update MySQL data with some math, using phpMyAdmin.
requinix replied to strago's topic in MySQL Help
Have you tried to figure it out yourself? It's really straight-forward. I mean, it's not like MySQL can't do basic addition. -
The from address will be whatever the mail client is configured to use, which may also vary further if the email is sent through an email provider (like Gmail). You can install anything that claims to be a "sendmail" client. There are many to choose from, and while none of them are particularly better than others, some may be better suited to your needs.
-
i am trying to add this ID aceptoterm but something i am missing
requinix replied to cpljv2's topic in PHP Coding Help
People will not read code unless the code itself is readable. Use tags around your code. I added them for you this time but you need to do it next time yourself. What you're missing is how to post a question. What are you talking about? What ID? What "aceptoterm"? Use multiple sentences to explain what you're trying to do, why, what you've tried so far, what the code is doing, and what you want the code to be doing. -
regex to remove entire line when word is present
requinix replied to sandy1028's topic in Regex Help
Match an entire line and make sure your pattern has "23456" in it. Give it a shot - it isn't particularly tricky. -
Look at the getNBest() method. Is there documentation for this stuff? If not, look at the code. It probably does not take any arguments and it probably returns that _NBest object. Apparently that class has getHypothesis() and getResultText() methods, so you need to call them. Not on the response but on the NBest object. $response->getNBest()->getHypothesis()
-
That the return value from getNBest is not a string? Well what is it then? I bet you it's an object and that you'll have to call a method on it...
-
All of those properties are private. You can tell because every single one says "private". Look for a method on the object that you should call.
-
Make your code check that the form was submitted before it tries to get values from the form. One way would be to look for the submit button in $_POST as that indicates the user clicked it and thus submitted the form.
-
You cannot simply add an 'i'. They are different functions. You need to actually learn about mysql (so you know what you have now) and mysqli (so you know what you need to have).