1). Write a PHP
script to generate an XML in the following format
<?xml
version = “1.0” ?>
<BookStore>
<Books>
<PHP>
<title>Programming
PHP</title>
<publication>O’RELLY</publication>
</PHP>
<PHP>
<title>Beginners
PHP</title>
<publication>WROX</publication>
</PHP>
</Books>
</BookStore>
Bookstore.xml
<?xml version
= "1.0" ?>
<BookStore>
<Books>
<PHP>
<title>Programming
PHP</title>
<publication>ORELLY</publication>
</PHP>
<PHP>
<title>Beginners
PHP</title>
<publication>WROX</publication>
</PHP>
</Books>
</BookStore>
Bookstore.php
<?php
$xml=simplexml_load_file('Bookstore.xml')or
die("cannot die");
print_r($xml);
$xmlstring=$xml->asXML();
echo $xmlstring;
?>
2) Consider the following entities and their relationships
BillMaster(billno, custname, billdate )
BillDetails(itemname, qty, rate, discount)
BillMaster and BillDetails are related with one-to-many relationship.
Create a RDB in 3 NF for the above and solve following
Write PHP script to print the bill in following format Accept the Bill number from user.
BillNo : BillDate :
Customer Name :
Sr. No.
|
Particular
|
Quantity
|
Rate
|
Discount
|
Total
|
Slip23.html
<html>
<body>
<form action="slip23.php"
method="get">
Enter the Bill No.:<input type=text
name=bno1><br>
<input type=submit value=SUBMIT>
</form>
</body>
</html>
Slip23.php
<?php
$database="archana";
//database name
$b_no=$_GET['bno1'];
$con=@mysql_connect("localhost","root"
,"");//for wamp 3rd feild is balnk
if(!$con)
{
die('Could
not connect: ' . mysql_error());
}
mysql_select_db("$database",$con);
$result=mysql_query("select
* from billdetails,billmaster where billdetails.bno=$b_no and
billdetails.bno=billmaster.bno")or die(mysql_error());
echo"<table
border='1'>";
echo"<tr><th>bno</th><th>CustomerName</th><th>Bill
Date</th></tr>";
while($row=mysql_fetch_array($result))
{
echo"<tr><td>";
echo
$row['bno'];
echo"</td><td>";
echo
$row['custname'];
echo"</td><td>";
echo
$row['billdate'];
echo"</td></tr>";
}
$result1=mysql_query("select
* from billdetails,billmaster where billdetails.bno=$b_no and
billdetails.bno=billmaster.bno")or die(mysql_error());
echo"<tr><th>Billno</th><th>Itemname</th><th>Quantity</th><th>Rate</th>
<th>Discount</th><th>Total</th></tr>";
while($row=mysql_fetch_array($result1))
{
echo"<tr>
<td>";echo
$row['bno'];echo"</td>
<td>";echo
$row['iname'];echo"</td>
<td>";echo
$row['qty'];echo"</td>
<td>";echo
$row['discount'];echo"</td>
<td>";echo
$row['rate'];echo"</td>
<td>";echo
$row['total'];echo"</td></tr>";
}
echo"</table>";
mysql_close($con);
?>