PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<TABLE align="center" border="1" cellpadding="2" cellspacing="0" bordercolor="000000" width="80%">
<?php
//connect to the database "localhost" using the supplied
//username and password and assign it the variable $db
$db = mysql_connect("localhost", "mjar81", "******");
//select the database "prayer" from mySQL
mysql_select_db("prayer",$db);
//assign the variable $result to everything from the "prayer_content" table
$result = mysql_query("SELECT * FROM prayer_content",$db);
//this outputs html to format the table and input some text
echo"<TR><TD><B>Name:</B><TD><B>Request:</B><TD><B>Date Submitted:</B><TD><B>Email:</B></TR>";
//while loop assigning $myrow to the $result array
while($myrow = mysql_fetch_array($result))
{
echo "<TR><TD>";
echo $myrowї"name"];
echo "<TD>";
echo $myrowї"request"];
echo "<td>";
echo $myrowї"date"];
echo "<br \>";
echo $myrowї"time"];
echo "<TD>";
//if statement to decide whether or not to display the email
if($myrowї"displayemail"] == 1)
{
//email display function
//html code
echo "<a href=mailto:";
echo $myrowї"email"];
echo ">";
echo $myrowї"email"];
echo "</a>";
}
else
{
//don't display the e-mail
echo "Hidden.";
}
}
//close the table
echo "</TABLE>";
?>
Urm...dont exactly follow your question there. Are you wanting help with the query?
SELECT * FROM prayer_content ORDER BY `FIELD` DESC
Would do what you want. That'll pull all the records and in decending order based on the field you specify. Just replace 'FIELD' with your primary key field.
woah, more replies than i could hope for in such a short time!
i'm sorry that my question sounded vague... it seemed OK to me, but i know what i'm talking about!
i'm looking to display ALL results from the table, in descending order.
anyways, the solution you guys offered to me worked for sorting the list, but when i refer to another php file and then refresh the first page (the one i'm having the problem with) i get a "parse error" on the line that i've modified from: