Jump to content


Photo

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


  • Please log in to reply
6 replies to this topic

#1 Monshery

Monshery
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 21 October 2006 - 09:22 PM

some kinda of post replay form .
it has a continuance in my page :-)
        $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 } ?>

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.

#2 kamasheto

kamasheto
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 21 October 2006 - 09:38 PM

just add DESC id at the end of your SQL query, should fix that for you

#3 Monshery

Monshery
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 21 October 2006 - 10:02 PM

just add DESC id at the end of your SQL query, should fix that for you

What mean DESC ID ?

#4 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 21 October 2006 - 10:44 PM

http://www.phpfreaks...mysqlref/16.php
	$MASSAGES_links = mysql_query("SELECT * FROM xxxxxx ORDER BY id DESC",$post_LINK);


#5 Monshery

Monshery
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 22 October 2006 - 12:36 AM

ok thanks just figure out how its working


#6 heckenschutze

heckenschutze
  • Members
  • PipPipPip
  • Advanced Member
  • 257 posts
  • LocationAustralia

Posted 22 October 2006 - 03:23 AM

PPL, FORMAT YOUR QUERIES.

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


#7 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 22 October 2006 - 06:01 AM

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.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users