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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  Sent: 14 August 2004 19:06
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  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>

Reply via email to