Answers for "diplay data stored mysql in php"

PHP
2

showing database table in php

$connection = mysql_connect('localhost', 'root', ''); //The Blank string is the password
mysql_select_db('hrmwaitrose');

$query = "SELECT * FROM employee"; //You don't need a ; like you do in SQL
$result = mysql_query($query);

echo "<table>"; // start a table tag in the HTML

while($row = mysql_fetch_array($result)){   //Creates a loop to loop through results
echo "<tr><td>" . $row['name'] . "</td><td>" . $row['age'] . "</td></tr>";  //$row['index'] the index here is a field name
}

echo "</table>"; //Close the table in HTML

mysql_close(); //Make sure to close out the database connection
Posted by: Guest on August-29-2020
0

print data that will be inserted in the database

$key = strtoupper(c_security::random_string(22));
$c_con->query("INSERT INTO keys(key, days, used) VALUES ('$key',".c_security::anti_sql_string($_POST["daysammount"])."', '0')");
echo $key;
i think like that
Posted by: Guest on May-25-2020

Browse Popular Code Answers by Language