Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004

    Unanswered: How to write it the right way?

    Hi there!

    This is a query of a PHP script I wrote which is supposed to return the number of rows for each different object present in the field nammed "list"
    PHP Code:
    $query="SELECT list, count( * ) AS n FROM $table GROUP BY list HAVING ( n > 1 )";
    //I don't know how to write the following
    print (
    // ? ? ? ? ? 
    The result returned by this query is, FOR EXAMPLE, something like this

    list n
    ai 72
    bg 325
    he 127

    I want to send this result to my Flash file


    but I don't know to write it the right way !!!

    Many thanks in advance for your help !

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    depending on which version of PHP (and waht method of accessing your database then you could do soemthing like:-

    PHP Code:
    $strSQL "SELECT list, count( * ) AS n FROM $table GROUP BY list HAVING ( n > 1 )";
    $ResultSet = @mysql_query($strSQL,$this->cnn);
    $MySQLStatus "MySQL ErrorNo:".mysql_errno()."; ".mysql_error();
    if (@
    $Row = @mysql_fetch_array($ResultSetMYSQL_ASSOC);
    $LineforFlashFile  $Row['list']." ".$Row['n'];
    } else 
    //no rows returned
    ErrorCode  = -110;
    StatusText "Cannot find details of blah<BR>".mysql_error(0)."<BR>The SQL was:$strSQL";

    you will then need to write this output to your 'flashfile'
    have a look at the PHP Manual for functions associated with file writing
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts