warning error message by using mysql_num in the mysql_fetch_array()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • santhanalakshmi
    New Member
    • May 2009
    • 147

    warning error message by using mysql_num in the mysql_fetch_array()

    Hi,


    Code:
    <?php
    mysql_connect('localhost','root','');
    mysql_select_db('test');
    $query="select * from phonedirectory";
    $result=mysql_query($query);
    echo "One Way To Print";
    echo "<br>";
    while($row=mysql_fetch_array($result,mysql_num))
    {
       echo $row[0]." ".$row[1]." ".$row[2]."<br>";
    }
    
    ?>

    Warning Error Message:

    One Way To Print

    Warning: mysql_fetch_arr ay() expects parameter 2 to be long, string given in F:\xampp installed\xampp \htdocs\mysql_f etch_demo1.php on line 8


    thanks in advance.i dont know ,why am i facing this error
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    PHP's constants are case-sensitive.

    Code:
    mysql_num != MYSQL_NUM
    Turn on error reporting to find problems like these.

    Code:
    error_reporting(-1);

    Comment

    • santhanalakshmi
      New Member
      • May 2009
      • 147

      #3
      Thanks its working.....in php.ini file ,we should on ERROR_REPORTING (-1).Is it.

      Comment

      • Gears of Codes
        New Member
        • Jul 2013
        • 1

        #4
        Code:
        $query = "SELECT Name,Mobile,Website,Rating FROM grand_table order by 4";
        
        
        // Passing Variables to execute and check
        
        $result = mysql_query($query);
        
        while( $data = mysql_fetch_array($result))
        {
          echo("<tr><td>$data[0]</td><td>$data[1]</td><td>$data[2]</td><td>$data[3]</td></tr>");
          
         }
        Hope by this query you can solve up your error...
        I was too suffering from that problem but instead of using regular sqlquery of WHERE i had replaced that and using ORDER BY and also its not necessary to use WHERE and ORDER BY query coz thats the query in which we are ordering and selecting a specified field...

        Thanks
        Last edited by Rabbit; Jul 21 '13, 11:53 PM. Reason: Link unrelated to question has been removed per forum policy.

        Comment

        Working...