mehidy
-
Posts
28 -
Joined
-
Last visited
Posts posted by mehidy
-
-
please see below full code
require("connect.php"); if (isset($_POST['tbl_color_id'])) $ints = implode(', ', $_POST['tbl_color_id']); $message = ""; $message .= " <p>Dear All<br>Please find below the comments for your ref </p>"; $message .="<table> <tr> <th>Booking ref</th><th>Color</th><th>Shade%</th><th>Lab Sub no</th><th>Lab sub date</th><th>Lab Ref</th><th>Apvd Shade</th><th>Dyeing Fact</th><th>Remarks</th> </tr>"; $details4p = "SELECT col_fab_bkng_ref, col_color_name, col_shade_percent, col_ld_sub_no, col_ld_sub_date, col_ld_ref, col_ld_shade, col_dying, col_color_rmks FROM tbl_color WHERE tbl_color_id IN ($ints) AND col_ld_shade IS NOT NULL"; $details_result4p = mysql_query( $details4p) or die ( "Couldn't get Products: ".mysql_error() ); while ( $det_row = mysql_fetch_array ( $details_result4p ) ) { // message $message .= " <tr><td> ".$det_row[ 'col_fab_bkng_ref' ]."</td> <td> ".$det_row[ 'col_color_name' ]."</td> <td> ".$det_row[ 'col_shade_percent' ]."</td> <td> ".$det_row[ 'col_ld_sub_no' ]."</td> <td> ".$det_row[ 'col_ld_sub_date' ]."</td> <td> ".$det_row[ 'col_ld_ref' ]."</td> <td> ".$det_row[ 'col_ld_shade' ]."</td> <td> ".$det_row[ 'col_color_rmks' ]."</td> </tr>";} $message .="</table>"; $message .= "<p>This is an auto generated mail, no need to reply.</p><p>Thanking you<br>noreplay@yahoo.com<br>C</p>"; $to = 'mehidy@yahoo.com' . ', '; // note the comma //$to .= 'sultan@yahoo.com'; // subject $subject = "hi"; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: mehidy@yahoo.com>' . "\r\n"; // Mail it mail($to, $subject, $message, $headers);
-
Hi Every one
Please see below query, its getting all the check box selected row from my table, but i want to get only if col_ld_shade is not null.
$details = "SELECT col_fab_bkng_ref, col_color_name, col_shade_percent, col_ld_sub_no, col_ld_sub_date, col_ld_ref, col_ld_shade, col_dying, col_color_rmks FROM tbl_color WHERE tbl_color_id IN ($ints) AND col_ld_shade IS NOT NULL";
Kindly advise. Where is the probelm?
-
Hi thanks everyone for your help. I have got the solution myself.
Cheers.
-
Hi I am trying to get the solution in another way. Please see below,
if ( $smpl_typ == "PPS" && $smpl_cmnts == "Approved" ){ require("connect.php"); $buyh = $_POST['buyh']; $buyr = $_POST['buyr']; $artstyl_no = $_POST['artstyl_no']; $tbl_orderid = $_POST['tbl_orderid']; $details = "SELECT smpl_col, smpl_subno, smpl_senton, cmnts_rcvon, smpl_cmnts, smpl_rmks FROM tbl_smpl WHERE smpl_tbl_order_id='$tbl_orderid' AND smpl_typ='PPS' AND smpl_cmnts='Approved'"; $details_result = mysql_query( $details) or die ( "Couldn't get Products: ".mysql_error() ); while ( $det_row = mysql_fetch_array ( $details_result ) ) { // message $message = " <p>Dear All<br>Please find below the sample comments for your ref of styel $artstyl_no!</p> <table> <tr> <th>Color</th><th>Sub no</th><th>Sub Date</th><th>Comments Date</th><th>Comments</th><th>Remarks</th> </tr> <tr><td> ".$det_row[ 'smpl_col' ]."</td> <td> ".$det_row[ 'smpl_subno' ]."</td> <td> ".$det_row[ 'smpl_senton' ]."</td> <td> ".$det_row[ 'cmnts_rcvon' ]."</td> <td> ".$det_row[ 'smpl_cmnts' ]."</td> <td> ".$det_row[ 'smpl_rmks' ]."</td></tr> </table><p>This is an auto generated mail, no need to reply.</p><p>Thanking you<br>noreplay@yahoo.com<br>C</p> "; $to = 'mehidy@yahoo.com' . ', '; // note the comma //$to .= 'sultan@yahoo.com'; // subject $subject = "$smpl_typ comments of Buyer:$buyr Style:$artstyl_no"; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers //$headers .= 'To: reza@yahoo.com, liton@yahoo.com' . "\r\n"; $headers .= 'From: C <mehidy@yahoo.com>' . "\r\n"; //$headers .= 'Cc: zahir@yahoo.com' . "\r\n"; //$headers .= 'Bcc: mehidy1984@gmail.com' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); } }
By using above script, after updating. i am getting two mail for two row from my mysql table. but i want to get two row details in one mail. Plz see my requirement as attached.
-
In that case you'll need a
foreach ()
loop on$_POST['tbl_smpl_id']
, where you extract both the key and the value. Then you'll need to use the key to reference the correct row from the other arrays you've created, to get the correct value from them.Please show me an example.
-
You need to take this bit:
<tr> <td>$artstyl_no</td><td>$smpl_col</td><td>$smpl_senton</td><td>$cmnts_rcvon</td><td>$smpl_cmnts</td><td>$smpl_rmks</td> </tr>
Put a loop around it, where you go through every matched row. Then you only need to adjust the variables to use the current row, before you add it all to the
$message
variable.Since I don't know where you're getting your rows from, or even the structure of that data, I cannot give you any more details on how to do this. I recommend checking out the PHP manual on control structures, if you're having problems understanding how to set this up.
Hi thanks for your information.I am getting all the data from a update form. Here is my update form.
<?php require("connect.php"); // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); print "<table width='100%' border='0' cellspacing='1' cellpadding='0'><tr><td>"; print "<form name='namestoupdate' method='post' action='update5.php'> <input type='hidden' name='buyr' value='$f005' /> <input type='hidden' name='artstyl_no' value='$f003' /> <table width='100%' border='0' cellspacing='1' cellpadding='1'> <tr bgcolor='#FDEEF4'> <td align='center'>*</td> <td align='center'><strong>SAMPLE TYPE.$f005.</strong></td> <td align='center'><strong>SAMPLE SIZE</strong></td> <td align='center'><strong>SAMPLE COLOR</strong></td> <td align='center'><strong>SAMPLE QTY</strong></td> <td align='center'><strong>SUB NO</strong></td> <td align='center'><strong>RTS/TTS</strong></td> <td align='center'><strong>SENT ON</strong></td> <td align='center'><strong>C.RCV ON</strong></td> <td align='center'><strong>COMMENTS</strong></td> <td align='center'><strong>REMARKS</strong></td> </tr>\n"; $result = mysql_query("SELECT * FROM tbl_smpl WHERE smpl_tbl_order_id='$id'"); $size = count($_POST['tbl_smpl_id']); $i = 0; while ($Update = mysql_fetch_array($result)) { print "</tr>\n"; print "<td align='center'><input type='hidden' name='tbl_smpl_id[$i]' value='{$Update['tbl_smpl_id']}' /></td>"; print "<td align='center'><input type='text' size='8px' name='smpl_typ[$i]' value='{$Update['smpl_typ']}' /></td>"; print "<td align='center'><input type='text' size='20px' name='smpl_size[$i]' value='{$Update['smpl_size']}' /></td>\n"; print "<td align='center'><input type='text' size='30' name='smpl_col[$i]' value='{$Update['smpl_col']}' /></td>\n"; print "<td align='center'><input type='text' size='10' name='smpl_qty[$i]' value='{$Update['smpl_qty']}' /></td>\n"; print "<td align='center'><input type='text' size='10' name='smpl_subno[$i]' value='{$Update['smpl_subno']}' /></td>\n"; print "<td align='center'><input type='text' size='15' name='smpl_rtstts[$i]' value='{$Update['smpl_rtstts']}' /></td>\n"; print "<td align='center'><input type='text' size='15' name='smpl_senton[$i]' value='{$Update['smpl_senton']}' /></td>\n"; print "<td align='center'><input type='text' size='8' name='cmnts_rcvon[$i]' value='{$Update['cmnts_rcvon']}' /></td>\n"; print "<td align='center'><input type='text' size='15' name='smpl_cmnts[$i]' value='{$Update['smpl_cmnts']}' /></td>\n"; print "<td align='center'><input type='text' size='15' name='smpl_rmks[$i]' value='{$Update['smpl_rmks']}' /></td>\n"; print "</tr>\n"; // add 1 to the count, close the loop, close the form, and the mysql connection ++$i; } print "<tr> <td colspan='13' align='center'><input type='submit' value='submit' />"; print"</td> </tr> </table> </td> </tr> </form> </table>"; mysql_close(); ?>
-
Hi I am sending mail using following script & its working.
if ( $smpl_typ == "PPS" && $smpl_cmnts == "Approved" ){ $buyh = $_POST['buyh']; $buyr = $_POST['buyr']; $artstyl_no = $_POST['artstyl_no']; $to = 'mehidy@yahoo.com' . ', '; // note the comma $to .= 'sultan@yahoo.com'; // subject $subject = "$smpl_typ comments of Buyer:$buyr Style:$artstyl_no"; // message $message = " <p> Dear All<br>Please find below the sample comments for your ref of styel $artstyl_no!</p> <table> <tr> <th>Style</th><th>Color</th><th>Sub Date</th><th>Comments Date</th><th>Comments</th><th>Remarks</th> </tr> <tr> <td>$artstyl_no</td><td>$smpl_col</td><td>$smpl_senton</td><td>$cmnts_rcvon</td><td>$smpl_cmnts</td><td>$smpl_rmks</td> </tr> </table> <p>This is an auto generated mail, no need to reply.</p> <p>Thanking you<br>noreplay@yahoo.com<br>C</p> "; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: rayhan@yahoo.com, liton@yahoo.com' . "\r\n"; $headers .= 'To: reza@yahoo.com, bikash@yahoo.com' . "\r\n"; $headers .= 'From: Crosswear <mehidy@yahoo.com>' . "\r\n"; $headers .= 'Cc: zahid@yahoo.com, zahir@yahoo.com' . "\r\n"; $headers .= 'Cc: ajay@yahoo.com' . "\r\n"; $headers .= 'Bcc: mehidy1984@gmail.com' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); }
My probelm is here, because there will be multiple row, but its only contain the las row in the mail, $smpl_typ can be double row or more. Please see picture for better undersatnding.Kindly advise.
<tr> <td>$artstyl_no</td><td>$smpl_col</td><td>$smpl_senton</td><td>$cmnts_rcvon</td><td>$smpl_cmnts</td><td>$smpl_rmks</td> </tr>
-
Hi
I am using belo scrip to update my data & its working fine. But i need to send auto mail after updating the data.
Here is my code
Code>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>
<style type="text/css">
body {
margin:50px 0px; padding:0px;
text-align:center;
font:13px Tahoma,Geneva,sans-serif
}
#content {
width:1200px;
margin:0px auto;
text-align:left;
padding:15px;
border:0px dashed #333;
background-color:#eee;
}
</style>
<link rel="icon" href="http://www.mysite.com/favicon.ico" type="image/vnd.microsoft.icon" />
</head>
<body>
<div id='content'><h3><center>Success! </center></h3>
<table width='100%' border='0' cellspacing='1' cellpadding='0'>
<tr>
<td>
<table width='100%' border='0' cellspacing='1' cellpadding='1'>
<tr>
<td align='center'><strong>ID</strong></td>
<td align='center'><strong>SAMPLE TYPE</strong></td>
<td align='center'><strong>SAMPLE SIZE</strong></td>
<td align='center'><strong>SAMPLE COLOR</strong></td>
<td align='center'><strong>SAMPLE QTY</strong></td>
<td align='center'><strong>SUB NO</strong></td>
<td align='center'><strong>RTS/TTS</strong></td>
<td align='center'><strong>SENT ON</strong></td>
<td align='center'><strong>C.RCV ON</strong></td>
<td align='center'><strong>COMMENTS</strong></td>
<td align='center'><strong>REMARKS</strong></td>
</tr>
<?php
error_reporting(0);
require("connect.php");
// find out how many records there are to update
$size = count($_POST['tbl_smpl_id']);
// start a loop in order to update each record
$i = 0;
while ($i < $size) {
// define each variable
$tbl_smpl_id = $_POST['tbl_smpl_id'][$i];
$smpl_typ = $_POST['smpl_typ'][$i];
$smpl_size = $_POST['smpl_size'][$i];
$smpl_col = $_POST['smpl_col'][$i];
$smpl_qty = $_POST['smpl_qty'][$i];
$smpl_subno = $_POST['smpl_subno'][$i];
$smpl_rtstts = $_POST['smpl_rtstts'][$i];
$smpl_senton = $_POST['smpl_senton'][$i];
$cmnts_rcvon = $_POST['cmnts_rcvon'][$i];
$smpl_cmnts = $_POST['smpl_cmnts'][$i];
$smpl_rmks = $_POST['smpl_rmks'][$i];
// do the update and print out some info just to provide some visual feedback
$query = "UPDATE `tbl_smpl` SET
`smpl_typ` = '$smpl_typ',
`smpl_size` = '$smpl_size',
`smpl_col` = '$smpl_col',
`smpl_qty` = '$smpl_qty',
`smpl_subno` = '$smpl_subno',
`smpl_senton` = '$smpl_senton',
`cmnts_rcvon` = '$cmnts_rcvon',
`smpl_cmnts` = '$smpl_cmnts',
`smpl_rmks` = '$smpl_rmks',
`smpl_rtstts` = '$smpl_rtstts'
WHERE `tbl_smpl_id` = '$tbl_smpl_id' LIMIT 1";
mysql_query($query) or die ("Error in query: $query");
print "
<tr>
<td align='center'><p>$tbl_smpl_id</p></td>
<td align='center'>$smpl_typ</td>
<td align='center'>$smpl_size</td>
<td align='center'>$smpl_col</td>
<td align='center'>$smpl_qty</td>
<td align='center'>$smpl_subno</td>
<td align='center'>$smpl_rtstts</td>
<td align='center'>$smpl_senton</td>
<td align='center'>$cmnts_rcvon</td>
<td align='center'>$smpl_cmnts</td>
<td align='center'>$smpl_rmks</td>
</tr>
";
++$i;
}
mysql_close();
?>
<tr>
<td colspan='13' align='center'>
<input value="HOME" type="button" onclick="window.location.href='dano.php'">
<input value="GO2 ALL VIEW" type="button" onclick="window.location.href='vod0011.php'">
<input value="del" type="button" onclick="window.location.href='ddcolupdateano.php?col_tbl_order_id=<?php echo $id; ?>'">
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
code>
My requiremnet is, if $smpl_typ=pps and $smpl_cmnts=Approved then it will send auto mail to the user.
Kindly advise any suggestion or any example to achive my requirement.
Not Null Query In Mysql And Php Is Not Working.
in PHP Coding Help
Posted
Thanks Sir, Its working fine now. Thank you very much.