I'm new to php.I tried to connect db use php mysqli and query multiple values and then assign to new variable.
Code:
<?php
$con=mysqli_connect('127.0.0.1','name','password','database name');
mysqli_query($con, "SET character_set_results=utf8,character_set_client='utf8'");
mysqli_query($con, "SET NAMES 'utf8'");
$sql="SELECT store_web,store_email,store_address1,store_city,store_state,store_zip,store_phone,store_time FROM mystore";
if ($result = mysqli_query($con, $sql)) {
// Fetch one and one row
while ($row = mysqli_fetch_row($result)) {
printf ("%s (%s)\n", $row[0], $row[1]);
}
mysqli_free_result($result);
}
mysqli_close($con);
?>
My question is how should I modify the code so that I can assign new variable name to the value(store_web,store_email,store_address1,store_city,store_state,store_zip,store_phone,store_time) I have queried out?
for example, after query out and get the value of store_address1,$address = store_address1