Alright, here is the deal.
I was asked, several months ago, to make a simple job database. They didn't want any sorting or anything like that. So, ok gotcha that's easy. I popped it out in a few days for them. Fast forward to last week. They asked me to flop the way the database info displays (lastest entry first). So. I think... no problem. BZZZT.
Since I haven't touched MySQL or php since then, I've forgotten everything!! Can anyone help me? This is the script I have running now:
Code:
//Connect to the server and select the db
$link = mysql_connect("localhost", "root") or die("Can not connect to the server. If you continue to see this error, please contact the Administrator.\n");
mysql_select_db("joblistings",$link) or die("Can not select the database. If you continue to see this error, please contact the Administrator.\n");
//Pull info from the table.
$query = "select * from shortJobs";
$result = mysql_query($query) or die("Could not query the database. If you continue to see this error, please contact the Administrator.");
//Display jobs that are currently showing.
while($line = mysql_fetch_array($result, MYSQL_ASSOC)){
if($line[visible]){
echo "<p class=\"body\">\n";
echo "<strong><center>Job Announcement</center></strong><p>";
echo "<strong>Location:</strong> $line[location]<br>\n";
echo "<strong>Date Received:</strong> $line[dateReceived]<br>\n";
echo "<strong>Job Title:</strong> $line[jobTitle]<br>\n";
if($line[firm]){ echo "<strong>Firm:</strong> $line[firm]<br>\n"; }
echo "<strong>For Class Years:</strong> $line[forYears]<br>\n";
echo "<strong>Salary:</strong> $line[salary]<br>\n";
echo "<strong>Deadline:</strong> $line[deadline]<br>\n";
echo "<strong>Contact:</strong> $line[contact]<br>\n";
echo "<strong>Submit:</strong> $line[submit]<br>\n";
echo "<strong>Notes:</strong> $line[notes]<br>\n";
echo "</p>\n";
}
}
All I need is to have the records displayed last record to first record.
Also, here are the fields of the DB:
Code:
+--------------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------+------+-----+---------+----------------+
| id | int(11) | | PRI | NULL | auto_increment |
| location | text | YES | | NULL | |
| dateReceived | text | YES | | NULL | |
| jobTitle | text | YES | | NULL | |
| forYears | text | YES | | NULL | |
| salary | text | YES | | NULL | |
| deadline | text | YES | | NULL | |
| contact | text | YES | | NULL | |
| submit | text | YES | | NULL | |
| notes | text | YES | | NULL | |
| firm | text | YES | | NULL | |
| visible | tinyint(1) | YES | | NULL | |
+--------------+------------+------+-----+---------+----------------+
12 rows in set (0.00 sec)
Thanks in advance!
Brandon