Hello I'm not sure how to do this need help.
Trying to pull onto a web page from mysql. The last 10 id numbers that were inserted into the database but that also have something filled in a certain database column called 'category' as well. Doesn't matter what's in that other column named 'category' just as long as any text or numbers are in that column row, then it will pull their last entered ids into the database as well. So I have so far done all myself:
<?php
$link = mysql_connect('databasename', 'databaselogin', 'databasepassword');
if (!$link) {
die('Not connected : ' . mysql_error());
}
$db_selected = mysql_select_db('databaselogin', $link);
if (!$db_selected) {
die ('Can\'t use database : ' . mysql_error());
}
$query =
"SELECT category, link, entryname FROM addentry WHERE `category` has anything in its row and `id` also = 'something that pulls the 1st of the 10 last entries here'";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
{
print "<table border=3 class='' style='' cellspacing=0 cellpadding=0 width=545>
<tr><td colspan=2 style=''>
<table border=0 cellpadding=0 cellspacing=0 width=560><tr><td><a style='' href='$row[link]'><b>$row[entryname]</b></a></td></tr></table>
?>
<?php
$link = mysql_connect('databasename', 'databaselogin', 'databasepassword');
if (!$link) {
die('Not connected : ' . mysql_error());
}
$db_selected = mysql_select_db('databaselogin', $link);
if (!$db_selected) {
die ('Can\'t use database : ' . mysql_error());
}
$query =
"SELECT category, link, entryname FROM addentry WHERE `category` has anything in its row and `id` also = 'something that pulls the 2nd of the 10 last database entries here and so on below on through to ten of the last database ids that also have something in category'";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
{
print "<table border=3 class='' style='' cellspacing=0 cellpadding=0 width=545>
<tr><td colspan=2 style=''>
<table border=0 cellpadding=0 cellspacing=0 width=560><tr><td><a style='' href='$row[link]'><b>$row[entryname]</b></a></td></tr></table>
?>
I have highlighted the part I know I have wrong. Just explained there what I need there, don't know the code that will make it work. Why needed to come here because I'm stuck and need help. The rest of it not highlighted already works well. I'm not any expert programmer obviously only know some.
Please let me know how to do this or if you don't understand something in my detailed question. Thank you very, very, much for your help.