3/10/19

PHP Questions | DB Connection | Array | Past Paper Questions


University, SLIATE, UNIVOTEC and Technical Education Students.. Every year past papers are asking  PHP MYSQL. This post have frequently asked php questions such as DB Connectivity, Array, ... ect..

Question Paper Download Link :
 https://drive.google.com/open?id=0B0GVLHA5uLWXXy1NMkYzbWFqbnFwWXp4U25VVGhTYkZDeDlv 

If you click the link that has a document file. It's some question.


Answer:

Question 1.

$name_one = array(1=>"SWT12032", 2=>"SWT15100",  
                  3=>"SWT13030", 4=>"SWT14050",  
                  5=>"16020");

a. echo $name_one["oop"];
b. asort($name_one);

    foreach( $name_one  as $x => $x_value) {
    echo "Key=" . $x . ", Value=" . $x_value;
    echo "<br>";


Question 2.

<?php
$i;
$p=100000.00;
$t=60;
$r=0.015;

a. echo $i=$p*$t*$r;
b. echo $i=pow((1+$p),($t*$r));


Question 3:

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>


<form method="post">
<input type="text" name="text" placeholder="Enter something"><br><br>
<input type="Submit" name="Submit">
</form>
<?php
if(isset($_POST['Submit']))
{
$name=$_POST['text'];
echo $name;
}
?>
</body>
</html>


Question 4:

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>


<form method="post">
<input type="text" name="text1"><br><br>
<input type="text" name="text2"><br><br>
<select name="cal">
<option value="add">ADD</option>
<option value="sub">SUB</option>
<option value="mul">MUL</option>
<option value="div">DIV</option>

</select>
<input type="Submit" name="Submit">
</form>
<?php
if(isset($_POST['Submit']))
{
$no1=$_POST['text1'];
$no2=$_POST['text2'];


echo $no1+$no2;
}
?>
</body>
</html>


Question - 5


<?php
$con = mysqli_connect("localhost","root","","test") or die("database not connected");
echo "database connected";
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>


<form method="post">
<input type="text" name="name"><br><br>
<input type="Submit" name="Submit">
</form>
<?php
if(isset($_POST['Submit']))
{

$no2=$_POST['name'];
$sql ="INSERT INTO enp(name) VALUES('$no2')";

$result = mysqli_query($con,$sql);
if($result){
echo "data inserted successfully";
}
else{
echo "data not inserted";
}


}
?>
</body>
</html>

No comments:

Post a Comment

About

Hi, I'm Najathi.
I've started entrepreneurial company, Twin Brothers.Inc.
One is self-funded & the other is venture backed. I also send a weekly. where I share relevent, curated links.

Every Week I Publish a short post on writing, publishing, or content of IT Related

Contact Form

Name

Email *

Message *