Professional Documents
Culture Documents
Web lab N-SCHEME(11-15)pgm and op
Web lab N-SCHEME(11-15)pgm and op
Web lab N-SCHEME(11-15)pgm and op
NO : 11
PROGRAM :
<?php
// Using strlen()
echo "<br>";
// Using strrev()
$s="God is Great";
echo "<br>";
// Using strtolower()
echo "<br>";
// Using strtoupper()
echo "<br>";
// Using str_word_count()
echo "<br>";
?>
OUTPUT :
EX.NO : 12
PROGRAM :
<?php
$ceu=array("India"=>"Delhi",
"United States"=>"Wasington",
"France"=>"Paris",
"Germany"=>"Berlin",
"Greace"=>"Athens",
"United Kingdom"=>"London",
"cyprus"=>"Nicosia",
"Lithunania"=>"Vilnius",
"Hungary"=>"Budapest",
"Austria"=>"Vienna",
"Poland"=>"warsaw");
asort($ceu);
?>
OUTPUT :
EX.NO : 13
PROGRAM :
<?php
echo date("Y/m/d")."<br>";
echo date("d-m-y")."<br>";
echo '<br>';
echo time().'<br>';
print_r(getdate());
?>
OUTPUT :
EX.NO : 14
PROGRAM :
<?php
$connect=mysqli_connect("localhost:3307","root","");
if($connect->query($sql)===true)
else
$connect=mysqli_connect("localhost:3307","root","","items");
if($connect->query($sql)=== TRUE)
else{
}
if(isset($_POST["add_to_table"]))
$name=$_POST["name"];
$quantity=intval($_POST["quantity"]);
$rate=intval($_POST["rate"]);
// echo $sql;
if($connect->query($sql)===TRUE){
else
echo "Error:".$sql."<br>".$connect->error;
if(isset($_GET["delete"]))
$item_name=$_GET["item_name"];
$delete=$_GET["delete"];
if($_GET["delete"]==1)
if($connect->query($sql)==TRUE)
{
else
?>
<!DOCTYPE html>
<html>
<head><title>Edwin Daya</title></head>
<body>
<br/>
<div class="container"style="width:700px;">
<?php
$result=$connect->query($sql);
?>
<div style="clear:both:></div>
<br/>
<h3>Items</h3>
<div class="table-responsive">
<tr>
<th width="20%"></th>
</tr>
<?php if($result->num_rows> 0) {
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$ii=1;
while($row=$result->fetch_assoc()){ ?>
<tr>
<td style="text="text-align:center">
</tr>
<?php
}
?>
<tr><td> </td>
<td>
</tr>
</table>
</div>
</form>
</div>
</body>
</html>
OUTPUT :
EX.NO : 15
PROGRAM :
<?php
$connect=new mysqli("localhost","root","");
if($connect->query($sql)===True){
} else {
$connect=new mysqli("localhost","root","","scart");
if ($connect->connect_error){
if($connect->query($sql)===TRUE){
} else {
} else {
if(isset($_post["add_to_cart"])){
if(isset($_session["shopping_cart"])){
$item_array_id=array_column($_session["shopping_cart"],"item_id");
if(!in_array($_FET["id"],$item_array_id)){
$count=count($_session["shopping_cart"]);
$item_array=array(
'item_id' =>$GET["id"],
'item_name' =>$_post["hidden_name"],
);
$_session["shopping_cart"][$count]=$item_array;
else {
echo "<script>window.location='index.php'</script>";
else {
$item_array = array(
);
$_SESSION["shopping_cart"][0]=$item_array;
if(isset($_GET["action"])){
if($_GET["action"]=="delete"){
if($values["item_id"]==$_GET["id"]){
unset($_session["shopping_cart"][$keys]);
echo "<script>window.location='index.php'</script>";
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body align="centre">
<br>
<div class="container"style="width:7--px;margin-left:200px">
<?php
$result=mysqli_query($connect,$query);
if(mysqli_num_row($result)>0){
while($row=mysqli_fetch_array($result)) { ?>
<div class="col-md-4">
border-radius:5px; padding:10px"align="centre">
</form>
</div>
<?php
?>
<div style="clear:both"></div>
<br/>
<div class="table-responsive">
<tr>
<th width="10%">Quantity</th>
<th width="20%">Price</th>
<th width="15%">Total</th>
<th width="5%">Action</th>
</tr>
<?php
if(!empty($_session["shopping_cart"])){
$total=0;
?>
<tr>
$values["item_price"],2); ?>
</td>
</tr>
<?php
$total=$total+($values["item_quantity"]*$values["item_price"]);
?>
<tr>
<td></td>
</tr>
<?php } ?>
</table>
</div>
</div>
<br/>
</body>
</html>
OUTPUT :