Professional Documents
Culture Documents
register_action.php
Selects the database
Step 4
register_action.php Executes the mysql query to
store the registered
mentee information into
database
Step 5
▪Mysql_fetch_array()
▪Mysql_fetch_row()
▪Mysql_fetch_assoc()
▪Mysql_fetch_object()
All of the above will return one row from table at a time and then the next row
and so on . So usually we use these functions along with a while loop
mysql_fetch_ro
w()
$query = mysql_query (“select * from tbl_baabtra_mentees");
while($fetch=mysql_fetch_row($query))
{
echo $fetch[0]; //prints first column the retrieved row
echo $fetch[1]; //prints second column the retrieved row
}
mysql_fetch_asso
c()
$query = mysql_query (“select * from tbl_baabtra_mentees");
while($fetch=mysql_fetch_assoc($query))
{
echo $fetch[‘vchr_uname’]; //prints first column the
retrieved row
echo $fetch[‘vchr_phone’]; //prints second column the
retrieved row
}
mysql_fetch_arra
y()
$query = mysql_query (“select * from tbl_baabtra_mentees");
while($fetch=mysql_fetch_array($query))
{
echo $fetch[0]; //prints first column the retrieved row
echo $fetch[‘vchr_phone’]; //prints second column the
retrieved row
}
mysql_fetch_obje
ct()
•$query = mysql_query (“select * from tbl_baabtra_mentees");
while($fetch=mysql_fetch_object($query))
•{
• echo $fetch -> ‘vchr_uname’; //prints first column the retrieved row
echo $fetch -> ‘vchr_phone’; //prints second column the retrieved
row
•}
mysql_fetch_obje
ct()
•$query = mysql_query (“select * from tbl_baabtra_mentees");
while($fetch=mysql_fetch_object($query))
•{
• echo $fetch -> ‘vchr_uname’; //prints first column the retrieved row
echo $fetch -> ‘vchr_phone’; //prints second column the retrieved
“Returns an object with properties that correspond to the fetched row and moves
row the internal data pointer ahead.”
•}
Okay…!!
So what are we waiting for now..??
Lets do it then
Let’s Get Back With Our
Task
Step 7: Set a header to redirect from
‘register_action.php’ to ‘view_baabtra_mentees.php’
header(‘Location: view_baabtra_mentees.php’);
Let’s Get Back With Our
Task