In Revo, are there any best practices for taking information from my custom database table and displaying that information within a html table on a web page?
I'm very new to PHP,mySQL,phpMyAdmin and have found a few php scripts online which I tried to use within a snippet.
$connection = mysql_connect('localhost', 'my-username', 'mydbpassword'); //The Blank string is the password
mysql_select_db('my-databasename');
$query = "SELECT * FROM my-database-tablename"; //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
I also wondered if I even needed to be specifying usernames and passwords in the first place as I'd assume my Revo resource already has permissions to connect with the database?
Then I came across something caled PDO and XPDO and I think thats a bit advanced for me.
If anyone can point me in the right direction, I'd be grateful.