Hello everybody,
I have written some php script for mail confirmation script,After data inserted in to table the auto increment column value have to sent to customer along with confirmation mail. I have getting output for data insertion in table,confirmation mail but I didn't get the auto increment column value in the mail. Please see my code below.

****************************************************

$to = "sales@harvam.in";
 $subject = "Contact Us";
 $email = $_REQUEST['email'] ;
 $message = $_REQUEST['msg'] ;
 $quantity = "/Quantity " . $_REQUEST['quantity'] ;
 $path = "/Upload: " . $_FILES["file"]["name"];
 $message = $message . $path . $quantity;
 $headers = "From: $email";

$sent = mail($to, $subject, $message, $headers, $quantity) ;
 if($sent)
 {print "Your mail was sent successfully";
 }
 else
 {print "We encountered an error sending your mail"; }



                                                          //for confirmation mail


$to =  $_POST['od_email'];
$subject = 'Order Confirmation From Harvam Enterprises| : '.  $_SESSION['orderno.'] ;
$hostname = "localhost";
$db_user = "*********";
$db_password = "**********";
$db_table = "*********";
$database = "*********";
$db = mysql_connect($hostname, $db_user, $db_password);
mysql_select_db($database,$db);
if (isset($_REQUEST['send'])) {
 

                                          //for getting auto increment column value from database and then sent to customer along with confirmation mail

 
$ordersql = "SELECT MAX(orderno.) FROM hvm_order";
if($result = mysql_query($ordersql ,$db))
{
echo 'Your order number sent to your mail<br><br>';
}
else {
echo "ERROR: ".mysql_error();
}
}

$message = 'order confirmation from harvam(Make your own gift).You will get your order number shortly' . $result ; 

$from = "sales@harvam.in";
$headers .= 'To: ' .$to. "\r\n";
$headers .= 'From: ' .$from. "\r\n";
$mail_sent = @mail( $email, $subject, $message, $headers);
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

if ($_FILES["file"]["error"] > 0)
  {
  echo "Error: " . $_FILES["file"]["error"] . "<br />";
  }
else
  {

  }


if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 600000))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
  //  echo "Upload: " . $_FILES["file"]["name"] . "<br />";
   // echo "Type: " . $_FILES["file"]["type"] . "<br />";
   // echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
  //  echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    if (file_exists("upload/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "upload/" . $_FILES["file"]["name"]);
      }
    }
  }
else
  {
  echo "Invalid file";
  }



                                  //this is for inserting data into database


$hostname = "localhost";
$db_user = "**********";
$db_password = "********";
$database = "**********";
//$db_table = "custtable";
$order_table = "order";

$db_table = "hvm_order";

$db = mysql_connect($hostname, $db_user, $db_password);
mysql_select_db($database,$db);
if (isset($_REQUEST['send'])) 
{

$custsql = "INSERT INTO $db_table(name,phone,email,msg,quantity,producttype,status,dor) values ('".mysql_real_escape_string(stripslashes($_REQUEST['name']))."','".mysql_real_escape_string(stripslashes($_REQUEST['phone']))."','".mysql_real_escape_string(stripslashes($_REQUEST['email']))."','".mysql_real_escape_string(stripslashes($_REQUEST['msg']))."','".mysql_real_escape_string(stripslashes($_REQUEST['quantity']))."','".mysql_real_escape_string(stripslashes($_REQUEST['producttype']))."','".mysql_real_escape_string(stripslashes($_REQUEST['status']))."','".mysql_real_escape_string(stripslashes($_REQUEST['dor']))."')";

if($result = mysql_query($custsql ,$db))
 {
echo '<h1>Thank you</h1>Your information has been entered into our database<br><br>';

}
else {
echo "ERROR: ".mysql_error();
}
}
mysql_close();

*************************************

Thank you for spending valuable time for me.

Comments

mahesh kataari’s picture

Hello everybody,
Please support for this issue. I have worked for this issue from a long time. I have used LAST_INSERT ID command also it was not working. The ovarall task is I have a one autoincrement column and remaining some columns in database. A user fill the form the database updates and have to sent confirmation mail to user along with Autoincrement value as a order number for the user. Updation of database and confirmation mail also working fine but autoincrement column value only I am not getting. I have pasted my code above.

Thank you so much for your support,
Mahesh.

mahesh kataari’s picture

Assigned: mahesh kataari » Unassigned
thedut’s picture

Title: Drupal7 Theme Customization » Database issue
Project: Theme Editor » DataBase Email Encryption
Version: 7.x-2.x-dev » 7.x-1.0
Priority: Major » Minor
Status: Active » Closed (fixed)

Hi mahesh kataari,

This this not the right place to post your question. This area only concerns issues reported on the DataBase Email Encryption custom module.

The right place for your question is the forum : Module Development and Code Questions.

mahesh kataari’s picture

Priority: Critical » Minor
Status: Active » Closed (fixed)

Thanq somuch thedut.

mahesh kataari’s picture

Title: Database issue » Drupal7 Theme Customization
Project: DataBase Email Encryption » Theme Editor
Version: 7.x-1.0 » 7.x-2.x-dev
Priority: Minor » Major
Status: Closed (fixed) » Active

Hello,
I am developing one site using Drupal 7. I am using Corporateclean theme in that along with the slideshow there is a junk content is there. Where can I edit that content. Please send solution.

Thank you somuch for your valuable time.

Status: Closed (fixed) » Active
thedut’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)