PHP Get the data from database follow the ID -
i cannot find out problems. mcreport.php display info key in before database. want display info in mcreport.php utilize id makemc.php. please help me find out way solve problem. give thanks you.
//makemc.php database if(isset($_post['btnsubmit'])){ $addmcq = "insert tblmc(id,name,fromdate,todate,reason) values('".$_post['txtno']."','".strtoupper($_post['txtname'])."','".$_post['txtfrom']."','".$_post['txtto']."','".strtoupper($_post['txtreason'])."')"; $addmcresult = mysql_query($addmcq,$link); if($addmcresult) { echo "<script language=\"javascript\">\n"; echo "alert('record added.');\n"; echo "window.location='mcreport.php'"; echo "</script>"; } //mcreport.php <?php include("database.php"); $data = mysql_query("select * tblmc") or die(mysql_error()); echo "<p align='center'><b>dr. ting ee medical clinic</b></p>"; echo "<p align='center'><font size='2'>medical certificate</font></p>"; while($row= mysql_fetch_array( $data )) { $old_from_date = $row['fromdate']; $old_from_date_timestamp = strtotime($old_from_date); $new_from_date = date('d/m/y', $old_from_date_timestamp); $old_to_date = $row['todate']; $old_to_date_timestamp = strtotime($old_to_date); $new_to_date = date('d/m/y', $old_to_date_timestamp); echo "<p align='center'>this certify <u>".$row['name']."</u> receiving medical</p>"; echo "<p align='center'>treatment , period <u>".$new_from_date."</u> <u>".$new_to_date."</u> inclusive</p>"; echo "<p align='center'>he unfit go on usual occupation</p>"; } ?>
you must utilize clause.
select * tblmc id='$id'
you need pass id $_post['txtno'] within makemc.php mcreport.php (i used $id).
edit::
makemc.php
if(session_id() == '') { session_start(); } $_session['id'] = $_post['txtno'];
mcreport.php
$id = $_session['id']; $data = mysql_query("select * tblmc id='$id'") or die(mysql_error());
php database
No comments:
Post a Comment