Documente Academic
Documente Profesional
Documente Cultură
Database Structure:
Database View:
Data Input:
<?php
$name=$_POST["st_name"];
$tel=$_POST["st_tel"];
$id=$_POST["st_id"];
$course=$_POST["st_course"];
$sex=$_POST["st_sex"];
$linkz=mysql_connect("localhost","root","") or die ("sorry didnot"); //connecting
mysql_select_db("test") or die("No_ DB_Found");//selecting Database
$sql="INSERT INTO student(ida,st_name,st_tel,st_id,st_course,st_sex) VALUES
(' ','$name','$tel','$id','$course','$sex')";
//echo $sql.mysql_error();
mysql_query($sql,$linkz); //passing sql
echo "student ".$name." was entered.";
echo "<hr>";
mysql_close($linkz);
?>
<html>
<body>
<h1 align="center">Student Details Entry</h1>
ii
Data Output:
iii
<?php
$linkz=mysql_connect ("localhost","root","") or die("sorry didnot");
//connecting
mysql_select_db("test",$linkz) or die("No_db_found"); //selecting Database
$sql="select * from student"; //sql to count columns / rows
$result=mysql_query($sql,$linkz); //passing sql
echo "<table border=1>";
$numofrows=mysql_num_rows($result);
for($fld=0; $fld<mysql_num_fields($result);$fld++) {
echo "<th>";
echo " ".mysql_field_name($result,$fld);
echo "</th>";
}
while ($row=mysql_fetch_assoc($result)) {
echo"<tr>";
echo"<td>".$row["ida"]."</td><td>".$row["st_name"]."</td> <td>".
$row["st_tel"]."</td><td>".$row["st_id"]."</td> <td>".$row["st_course"]."</td><td>".
$row["st_sex"]."</td>";
echo"</tr>";
}
echo"</table>";
?>
iv