Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
$results = mysql_query('SELECT fieldname1,fieldname2,fieldname3 FROM mytable');
while($row=mysql_fetch_array($results)
{
echo $row['fieldname1'];
}
<?php
[green]// Setup the connection Paramters: Host, (either an IP address, or a URL, or even localhost if mysql resides in the same physical server as the PHP processor and webserver.),database, user and password[/green]
$host ='localhost';
$database = 'dbname';
$user = 'username';
$pass ='pwasword';
[green]//Initiate the connection, usage of mysql_error in the die statement is suggetsed when in development to catch any potential mysql errors.[/green]
$conn = mysql_connect($host,$user,$pass) or die(mysql_error());
[green]// Select the database to be used [/green]
$db = mysql_select_db($database) or die(mysql_error());
[green]//Setup the query to be run [/green]
$query = 'SELECT * FROM mytable';
[green]// Execute the query[/green]
$result = mysql_query($query) or die (mysql_error());
[green]//Display the results. mysql_fetch_array, mysql_fetchAssoc, mysql_fetch_row etc... retrieve one row at a time from the result set returned by mysql_query.[/green]
echo "<table border=2>";
while($row = mysql_fetch_array($result))
{
echo "<tr><td>" . $row['idmytable'] . "</td><td>" . $row['myfield1'] . "</td><td>" . $row['myfield2'] . "</td></tr>";
}
echo "</table>";
?>
<?php
/* some php goes here */
?>
<form method="post" action="#" >
<input type="text" value="test" name="textbox"/>
</form>