Jump to content

Archived

This topic is now archived and is closed to further replies.

Monshery

trying to use mysql_fetch_array but diffrant way Help :-)!!

Recommended Posts

some kinda of post replay form .
it has a continuance in my page :-)
[code]
        $INSERTD = mysql_query("INSERT INTO xxxxxx (id, name, email, massage, show_mail) VALUES                ('$f','$_POST[name]', '$_POST[email]', '$_POST[massage]', '$_POST[show_email]')",$post_LINK);
$post_LINK=mysql_connect('xxxxx','xxxxxx','xxxxxx') or die("Connection fail");
mysql_select_db('xxxxxx',$post_LINK);
$MASSAGES_links = mysql_query("SELECT * FROM xxxxxx",$post_LINK);
/* basicaly here i start showing the table */
while($MASSEGES=mysql_fetch_array($MASSAGES_links))
{
?>
            <table width="427" height="54" border="0">
              <tr>
                <td width="26" height="23"><?php echo $MASSEGES['id'];?></td>
                <td width="117"><span class="style2"><strong>Name:</strong> <?php echo $MASSEGES['name'];?></span></td>
                <td width="250"><span class="style2">
                  <?php if ($MASSEGES['show_mail'] == "show_email") { echo "<strong>Email: </strong> ". $MASSEGES['email']; }?>
                </span></td>
              </tr>
              <tr>
                <td height="23" colspan="3"><p><span class="style2"><strong>Massage: </strong><?php echo $MASSEGES['massage'];?></span> </p>
                    <p>-----------------------------------------------------------------</p></td>
              </tr>
            </table>
          <?php } ?>
[/code]

what i am trying to do and dont know how it
i want it to show the resualt in backward order instead it will show newest raw as last i want it to show the newest as first in page and go on down the table to the oldes

This suppost to be some kinda of post replay form . you have a window to post a replay after you do its just add it to database and then show it in table with fatch array. but its showing me the oldest replay as first in page instead of doing it like a forum which the first replay show's first in the page ..

if anyone will help i will realy much appricate it thanks in advanced.

Share this post


Link to post
Share on other sites
[quote author=kamasheto link=topic=112280.msg455610#msg455610 date=1161466694]
just add DESC id at the end of your SQL query, should fix that for you
[/quote]
What mean DESC ID ?

Share this post


Link to post
Share on other sites
http://www.phpfreaks.com/mysqlref/16.php
[code]
$MASSAGES_links = mysql_query("SELECT * FROM xxxxxx ORDER BY id DESC",$post_LINK);
[/code]

Share this post


Link to post
Share on other sites
PPL, FORMAT YOUR QUERIES.

[code]$MASSAGES_links = mysql_query("SELECT * FROM `xxxxxx` ORDER BY `id` DESC", $post_LINK);[/code]

Share this post


Link to post
Share on other sites
backticks are not necessary unless you are using mysql reserved words..and you shouldn't be using reserved words as table/field names in the first place.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.