Hi..
I have problem with my system which is the bar code image cannot been display after the bar code generate from the database.
can anyone show me the correct way to call the data from database to generate and display in my system?
when user click view card in list_contract_worker.php, the view_card.php display the information and also the bar code image so they can print the barcode image with the information in this page.
this is my code.
list_contract_worker.php
<head>
<script src="datetimepicker_css.js"></script>
</head>
<br> <script>
/*Current date script credit:
JavaScript Kit (www.javascriptkit.com)
Over 200+ free scripts here!
*/
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
document.write(" <small><font color='black' face='Tahoma'><b>"+dayarray[day]+", "+daym+" "+montharray[month]+" "+year+" </b></font></small>")
</script></br><p></p>
<?php
$con = mysql_connect("localhost","root","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("pqs", $con);
$result = mysql_query("SELECT * FROM contractworkerdb");
?>
<table width="694" border="0" align="center">
<tr>
<th height="48" colspan="7" scope="col">List of Contract Worker </th>
</tr>
<tr>
<th width="166" scope="row">Name</th>
<td width="94"><div align="center"><strong>Barcode ID </strong></div></td>
<td width="93"><div align="center"><strong>Company</strong></div></td>
<td width="93"><div align="center"><strong>View Card </strong></div></td>
<td width="87"><div align="center"><strong>View</strong> <strong>Profile</strong> </div></td>
<td width="62"><div align="center"><strong>Update</strong></div></td>
<td width="69"><div align="center"><strong>Delete</strong></div></td>
</tr>
<?php while($row = mysql_fetch_array($result))
{
?>
<tr>
<th scope="row"><div align="center"><?php echo $row['Name']; ?> </div></th>
<td><div align="center"><?php echo $row['barcode_id']; ?> </div></td>
<td><div align="center"><?php echo $row['Company']; ?> </div></td>
<td><div align="center"><a href="view_card.php?ref1=<?php echo $row['contract_id'];?>">view</a></div></td>
<td><div align="center"><a href="view_data.php?ref1=<?php echo $row['contract_id'];?>">view</a></div></td>
<td><div align="center"><a href="update_data.php?ref1=<?php echo $row['contract_id'];?>">update</a></div></td>
<td><div align="center"><a href="delete_data.php?id=<?php echo $row['contract_id'];?>">delete</a></div></td>
</tr>
<?php }?>
<tr>
<th colspan="7" scope="row"> </th>
</tr>
<tr>
<th colspan="7" scope="row"><input name="print" type="submit" id="print" value="Print" />
<input name="export" type="submit" id="export" value="Export" /></th>
</tr>
</table>
<?php
mysql_close($con);
?>
view_card.php
<?php
$con = mysql_connect("localhost","root","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("pqs", $con);
$ref1 = $_REQUEST['ref1'];
//$barcode_id = $_POST['barcode_id'];
$b = barcode_id[$ref1];
$result = mysql_query("SELECT Name, Ic_no, barcode_id, Department, filep FROM contractworkerdb WHERE contract_id = '$ref1' LIMIT 0,1");
?>
<form name="form1" method="post" action="index.php?page=view_card.php">
<p> </p>
<table width="636" border="0" align="center">
<tr>
<?php while($row = mysql_fetch_array($result))
{
?>
<input type="hidden" name="contract_id" value="<?php echo $ref1; ?>" />
<th colspan="3" scope="col"><img src="<?php echo $row['filep'];?>" alt="" /></th>
</tr>
<tr>
<th width="166" scope="row"><div align="right">Name</div></th>
<td width="10"><div align="center">:</div></td>
<td width="446"><?php echo $row['Name']; ?> </td>
</tr>
<tr>
<th scope="row"><div align="right">IC No. </div></th>
<td><div align="center">:</div></td>
<td><?php echo $row['Ic_no']; ?> </td>
</tr>
<tr>
<th scope="row"><div align="right">Barcode ID </div></th>
<td><div align="center">:</div></td>
<td><?php echo $row['barcode_id']; ?> </td>
</tr>
<tr>
<th scope="row"><div align="right">Department</div></th>
<td><div align="center">:</div></td>
<td><?php echo $row['Department']; ?> </td>
</tr>
<tr>
<th colspan="3" scope="row">
<?
echo "<div class=\"noscreen\" align=\"center\"><span class=\"bigtxt\">$b</span><br><img src=\"barcode.php?barcode=$b&width=300&height=80\"></div>";
?>
</th>
</tr>
<?php }?>
<?php
mysql_close($con);
?>
</table>
</form>
help me please.. :(