List:General Discussion« Previous MessageNext Message »
From:Sunmaia Date:August 14 2004 6:19pm
Subject:RE: MYSQL RECORDS AND ALPHABETICAL ORDER
View as plain text  
Hi

replace alphabetical_field with the name of the field you are ordering by.

If you are not sure, post your table structure and I will add it for you :)

bfn

Peter
  -----Original Message-----
  From: Remember14a@stripped [mailto:Remember14a@stripped]
  Sent: 14 August 2004 19:06
  To: pjln1@stripped; mysql@stripped
  Subject: Re: MYSQL RECORDS AND ALPHABETICAL ORDER


  Dear friends,
  In this query what precisely needs to be added at  alphabetical_field
following ORDER BY

  SELECT * FROM mytable ORDER BY alphabetical_field
  so that I get output in alphabetical order.

  guidance, please.
  --------------------------------------------------------------------------
  My Php script
  -------------------------------------------------------------------------
  <?php

  include 'menufile.php';
  ?><center>
  <?php
  // open the connection
  $conn = mysql_connect("localhost", "", "");

  // pick the database to use
  mysql_select_db("b",$conn);

  // create the SQL statement
  $sql = "SELECT * FROM euemails ORDER BY alphabetical_field ";

  // execute the SQL statement
  $result = mysql_query($sql, $conn) or die(mysql_error());

  //go through each row in the result set and display data
  while ($newArray = mysql_fetch_array($result)) {
          // give a name to the fields
      $id  = $newArray['id'];
      $email = $newArray['email'];
      //echo the results onscreen between ""can also //type$id is and &email
is
      echo " $email <br>";
  }
  ?></center>


Thread
MYSQL RECORDS AND ALPHABETICAL ORDERRemember14a14 Aug
  • Re: MYSQL RECORDS AND ALPHABETICAL ORDERMartijn Tonies14 Aug
  • RE: MYSQL RECORDS AND ALPHABETICAL ORDERPeter Lovatt14 Aug
  • Re: MYSQL RECORDS AND ALPHABETICAL ORDERPeter  Brawley14 Aug
Re: MYSQL RECORDS AND ALPHABETICAL ORDERRemember14a14 Aug
  • RE: MYSQL RECORDS AND ALPHABETICAL ORDERSunmaia14 Aug
  • Re: MYSQL RECORDS AND ALPHABETICAL ORDERMartijn Tonies14 Aug