Jump to content
Larry Ullman's Book Forums


Popular Content

Showing content with the highest reputation since 08/10/19 in all areas

  1. 1 point
    Thanks for the question! I'm not terribly worried about this. Microsoft said they're not going to provide builds of PHP for Windows anymore. Certainly someone else will pick up the torch. Also, to me, this is more of an issue for people learning or developing on Windows. I don't have hard numbers but I assume the vast majority of servers using PHP are running Linux.
  2. 1 point
    Yes, both versions are comparable with respect to validating the gender. To use the NULL coalescing operator in Script 2.4, you'd probably just write it like your version of Script 2.3 (note that you don't need the $gender = NULL in there though).
  3. 1 point
    I wouldn't say that line is necessary. The $gender variable is already assigned a value before being used so assigning it a "false" value has no impact.
  4. 1 point
    Thanks for the interest in more books! Much appreciated! The "PHP Advanced" book would be the logical one after "PHP & MySQL". Or the e-commerce book that Necuima recommended.
  5. 1 point
    Re reading a PDF - you could have a look at: https://www.pdfparser.org/ but I have not used it. Cheers
  6. 1 point
    Hi Jai, Mr Ullman has a great book on e-commerce - "Effortless E-Commerce" - 2nd edition with PHP and MySQL. Cheers
  7. 1 point
    Ok, the following is how I send emails from PHP. Uses PHPMailer. In XAMPP you need to tell it where your normal email connection is. $host = substr($_SERVER['HTTP_HOST'], 0, 5); if (in_array($host, array('127.0', '192.1', 'local'))) { $local = TRUE; // echo "Local is true, HOST is $host"; } else { $local = FALSE; // echo "Local is false, HOST is $host"; } if ($local) { // tests for using XAMPP locally ini_set('sendmail_from', 'your email address'); // needed for Win 10 localhost (Development) ini_set('SMTP', 'your email service SMTP server'); // needed for Win 10 localhost (Developmemt) } require './includes/PHPMailer/PHPMailerAutoload.php'; // available as a free download $mail = new PHPMailer(true); $mail->setFrom(EMAIL, 'Whoever'); $mail->addAddress(EMAIL, 'Whoeverr'); if ($local) $mail->Subject = 'The email subject'; else $mail->Subject = 'The email subject'; $mail->Body = 'The email body'; $mail->addAttachment($report_file); // optional if(!$mail->send()) { echo '<p>Message was not sent.</p>'; echo '<p>Mailer error: ' . $mail->ErrorInfo . '</p>'; } The EMAIL constant has the email address that I want to show the email was sent from/to - in this case the receiver and the sender are the same email address - just change them to whatever you want to use. Hope it helps. P.S., assumes that you are logged in to your email service. PPSS, I use PHPMailer as it lets you attach a file to an email if you want/need to.
  • Create New...