So, I am working on a webpage that needs to display a single value from a SQL database and display it wrapped into an html page. I have a SELECT statement that pulls the value I want:
SELECT amount FROM jackpot_table
My issue is getting this to display properly on an html page... the best I can do is something similar to
$results=array();
$sql="SELECT amount FROM `jackpot_table`"
$result = mysql_query($sql, $link) or die('Error: ' . mysql_error());
while($a_row = mysql_fetch_array($result, MYSQL_ASSOC)) array_push($results, $a_row);
if(count($results)){
echo('<a href="single.php?id='.$results[0][id].'">'.$results[0][field_name1].'</a> <br> '.$results[0][field_name2].' <br> '.$results[0][field_name3]);
}else{
echo('Sorry - no result found');
}
?>
Now, I know little to nothing about PHP and this is actually the first implementation of SQL. I have the db working and the SELECT statement works fine in PHPmyadmin... For some reason, when I run the above PHP script, it returns 'no results found'
Now, this is a third party script that was part of a tutorial that I used tog et going on this project, and have modified it to meet my needs, so please be a tad forgiving 🙂