Tuesday, 9 June 2020

how to get the data from data base and it prints

how to get the data from data base and it prints
<?php

require 'dbconnect.php';

$query = 'SELECT `first` , `last` FROM `a_database` ORDER BY `id` ';
run the query


after connected to server, data base, run this query, if query runs, it indicates true
if($query_run = @mysqli_query($mycon, $query)){
while($row = @mysqli_fetch_assoc($query_run)){
store as associative array, with while It loops till all rows
$fname = $row['first'];
array[key]
$sname = $row['last'];
echo $fname .''.$sname .'</br></br>';

}
}else {
echo 'queryfailed';
}

?>

$students = array (

"vamsi" => array ( 100, 80, 75),
"krishna" => array ( 90,  100,  45),
"nvk" => array ( 80,  40,  25),

);





$students["vamsi"][0] = 100;

$students["vamsi"][1] = 80;

$students["vamsi"][2] = 75;


how to use the template, and theire variablles require
how to write what action wil impletment write query
how to run query against database
how to execute the query , if it iis conneted @mysqli_query
how to convert data to associative arrays @mysqli_fetch_assoc
how to access converted arrays $row['first']
how to access one record concatination
while
if while else 



ASC DESC condition
prints the rows in some order

No comments:

Post a Comment