Changes

Jump to: navigation, search

HTML/PHP Database Dump

248 bytes added, 17:28, 23 October 2013
no edit summary
<pre>&lt;?php$con = mysqli_connect("computerlocalhost", "usergbs788db", "passwordpw", "databasegbs788db"); //This references the database. We store it as a variable only so that we don't have to keep writing it out.
if(mysqli_connect_errno())
{
/*If we made it this far, it means that we successfully connected and made it to the next line. By putting echo, we are including html now!!*/
echo '
<&lt;html>&gt; <&lt;head>&gt; <&lt;title>&gt;Ooga<&lt;/title>&gt; <&lt;/head>&gt; <&lt;body>&gt; <&lt;h1>&gt;It is Tims Fault<&lt;/h1>&gt; <&lt;table border="1">&gt; <&lt;tr>&gt; <&lt;th>&gt;Accession<&lt;/th>&gt; <&lt;th>&gt;Ordered By<&lt;/th>&gt; <&lt;th>&gt;Test<&lt;/th>&gt; <&lt;th>&gt;Turn Around Time<&lt;/th>&gt; <&lt;th>&gt;Result<&lt;/th>&gt; <&lt;/tr>&gt;
';
$sql = "SELECT * FROM `tabletest2`;";
$result = mysqli_query($con, $sql); //This does what we have been doing in SQL: connecting to the database, and then putting in the query.
while ($row=mysqli_fetch_array($result))//This command just looks at a table row by row.
{
echo '
<&lt;tr>&gt; <&lt;td>&gt;' . $row['col1accession'] . '<&lt;/td>&gt; <&lt;td>&gt;' . $row['col2ordering'] . '<&lt;/td>&gt; <&lt;td>&gt;' . $row['col3test'] . '<&lt;/td>&gt; <&lt;td>&gt;' . $row['col4tat'] . '<&lt;/td>&gt; <&lt;td>&gt;' . $row['result'] . '<&lt;/td>&gt; <&lt;/tr> &gt;
'; /*This closes out the echo*/
}
echo '
<&lt;/table>&gt; <&lt;/body>&gt;<&lt;/html>&gt;
';
?&gt;</pre>
347
edits

Navigation menu