#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Location
    Pierrefonds, QC Canada
    Posts
    205
    Rep Power
    11

    Unexpected return...


    Hi there!

    This query :

    PHP Code:
    SELECT img_name FROM $table WHERE email '$email' AND ok '1' ORDER BY id DESC LIMIT 0 3") or die("&error=Failed !"); 
    is supposed to return a 2 elements "array" (as I already know the content of $table satisfying to the query statements). I know it's not actually an array but a string with a "|" delimiter...

    "ok" is a column which content is 1 (valid image) or 0 (invalid image)
    there's 3 rows containing the required $email and only two where ok='1'

    Statement

    PHP Code:
    if ( mysql_num_rows($sql) > 0) {
        while (
    $row =mysql_fetch_array ($sql)) {
            
    $array .= $row['img_name']."|";
        }
        print 
    "&numberOfRows=".mysql_num_rows($sql)."&myArray=".$array;
    }
    else {
        print 
    "&error=No images found.";

    returns a wrong number of rows (3 instead of 2) but a right "array" !!!???

    Why?

    Many thanks for your advices, remarks and suggestions!
    Last edited by Germaris; January 15th, 2013 at 12:32 PM.

IMN logo majestic logo threadwatch logo seochat tools logo