Showing posts with label php script. Show all posts
Showing posts with label php script. Show all posts

Tuesday, March 24, 2026

Define constant in Php



If you're working with PHP, one of the most important concepts you should know is constants — and that’s where define() comes in 🚀

🔹 What is define()?
define() is a built-in PHP function used to create a constant value that cannot be changed during script execution.

🔹 Why use constants?
Constants are perfect for storing values that should remain fixed, like:

  • Website name
  • Database credentials
  • API keys
  • Company details

🔹 Basic Syntax:

define("CONSTANT_NAME", "value");


Check the video

Code 

<?php

define("channel","youtube@phpecho");
define("contact","+91-2221221221");
?>


<?php echo channel; ?>
<?php echo contact; ?>




Tuesday, April 8, 2025

Send  Multiple Email with Their Multiple Detail

index.php file

 <form  action="emailsendtoall.php" method="post" enctype="multipart/form-data">           

                   

                     

                      
<?php
include 'db.php';
$sql = mysql_query("select * from tablename");                       // here we are show all email form table , on which we want to send emails
while($result = mysql_fetch_array($sql))
{
?>
<?php echo $result['email']; ?>&nbsp;&nbsp;,&nbsp;&nbsp;
<?php
}
?>


                   

                      <input type = "submit"  class = "btn btn-primary btn-sm" value = "Send"  >

                 

                  </form>

send-email.php file

<?php
require 'db.php';   // database connection file
$sql = mysql_query("select * from  tablename");    // select All Email From Table Name
while($result = mysql_fetch_array($sql))
{

$email = $result['email'];

if($email)
{

$get =mysql_query("select * from member where email = '$email'");
$getr = mysql_fetch_array($get);
$emailuser = $getr['email'];                               // user email
$password = $getr['password'];                      // user password   or  // you can fetch multiple detail which you want to send  
$subject = 'Multiple Email With Their Multiple Details';

$message = "<html><head></head>

<body>
<p>Welcome Message Your Email is  ".$emailuser."<br>


And password is ".$password."<br>


(This is an auto-generated email. Please do not reply. Any further queries will be addressed at aoqr2019@gmail.com)


</body></html>";

 

mail($emailuser, $subject, $message);
?>
<script>
alert("Registration Details Send to All Member");
window.location='index.php';
</script>
<?php

}
else
{
?>
<script>
alert("None Email Remain to send");
window.location='index.php';
</script>
<?php

}

}
?>

MYSQL vs MYSQLI vs PDO

  <?php //mysql //$conn = mysql_connect("localhost","root",""); //$db = mysql_select_db(" Your_databas...