Hello,
What I am looking to do is have a series of buttons laid out and when the user 'onClick', a table from my MySQL database will load into a scrollable textbox within the same webpage.
I figure I need to go about this using AJAX, which unfortunately I have basically no experience in.
For example purposes here is what I have going:
This php code basically just displays the table we want to tie the button click to.
<?php
include("connect.php");
//Query of facebook database
$facebook = mysql_query("SELECT * FROM facebook")
or die(mysql_error());
//Output results
if(!$facebook)
{
echo "There was an error running the query: " . mysql_error();
}
elseif(!mysql_num_rows($facebook))
{
echo "No results returned";
}
else
{
$header = false;
echo "<table border='1'>\n";
while($row = mysql_fetch_assoc($facebook))
{
if(!$header)
{
echo "<tr>\n";
foreach($row as $header => $value)
{
echo "<th>{$header}</th>\n";
}
echo "</tr>\n";
}
echo "<tr>\n";
foreach($row as $value)
{
echo "<th>{$value}</th>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
}
mysql_close();
?>
I'd really like to make this as easy as possible. After doing research, I figured that just Javascript would not be enough because it is client-side.
It would be great if someone could point me in the right direction.
Thanks in advance to anyone who replies.