Swytchcraft
Technical User
Below is my code:
When I open the page, it pulls my information asceding in order of input, how do I get them to pull in descending order? Mysql sais to put a DESC somewhere, but where?
<?php
include "faq_config.php";
$result = mysql_query("SELECT * FROM faqs WHERE category_id = '$category_id'");
while ($row = mysql_fetch_array($result)) {
if (($answer == "$row[id]") || ($print == "true")) {
print "<tr>
<td class=\"QA\" valign=\"top\">Q <a name=\"$answer\"></a></td>
<td><pre class=\"question\"><a href=\"$PHP_SELF?answer=0&cat_name=$cat_name&category_id=$category_id\">$row[question]</a></pre></td>
</tr>\n";
print "<tr>
<td class=\"QA\" valign=\"top\">A</td>
<td><pre class=\"answer\">$row[answer]</pre>
<br>
<a href=\"$PHP_SELF?answer=0&cat_name=$cat_name&category_id=$category_id#$answer\">× close</a><br></td>
</tr>\n";
}
else {
print "<tr>
<td class=\"QA\" valign=\"top\">Q <a name=\"$row[id]\"></td>
<td><pre class=\"question\"><a href=\"$PHP_SELF?answer=$row[id]&cat_name=$cat_name&category_id=$category_id#$row[id]\">$row[question]</a></pre></td>
</tr>\n";
}
}
mysql_close($link);
?>
When I open the page, it pulls my information asceding in order of input, how do I get them to pull in descending order? Mysql sais to put a DESC somewhere, but where?
<?php
include "faq_config.php";
$result = mysql_query("SELECT * FROM faqs WHERE category_id = '$category_id'");
while ($row = mysql_fetch_array($result)) {
if (($answer == "$row[id]") || ($print == "true")) {
print "<tr>
<td class=\"QA\" valign=\"top\">Q <a name=\"$answer\"></a></td>
<td><pre class=\"question\"><a href=\"$PHP_SELF?answer=0&cat_name=$cat_name&category_id=$category_id\">$row[question]</a></pre></td>
</tr>\n";
print "<tr>
<td class=\"QA\" valign=\"top\">A</td>
<td><pre class=\"answer\">$row[answer]</pre>
<br>
<a href=\"$PHP_SELF?answer=0&cat_name=$cat_name&category_id=$category_id#$answer\">× close</a><br></td>
</tr>\n";
}
else {
print "<tr>
<td class=\"QA\" valign=\"top\">Q <a name=\"$row[id]\"></td>
<td><pre class=\"question\"><a href=\"$PHP_SELF?answer=$row[id]&cat_name=$cat_name&category_id=$category_id#$row[id]\">$row[question]</a></pre></td>
</tr>\n";
}
}
mysql_close($link);
?>