-4

Here is my code..here is error in my code is-- Warning: mysql_fetch_array() expects parameter 1 to be resource... pls resolve it

I just want to get the call status from id which is a get from stored procedure in my table.

           <?php
          echo "Result from SP procOutput_sum:::::$SP_VAL";
          $mysqli = mysql_connect("localhost", "root", "", "call_conference");
          if (!$mysqli) {
           die('Could not connect: ' . mysql_error());
            }

             ?>
           <?php
           $select="select call_status from tbl_call_origin where id='$SP_VAL'";
           while ($row = mysql_fetch_array($select)){
         echo 'Status: '.$row['call_status'];
            }
            ?>
pavel
  • 25,361
  • 10
  • 41
  • 58
user3192801
  • 1
  • 1
  • 3

2 Answers2

1

You are missing mysql_query function to get $select and return $result to be passed to mysql_fetch_array.

$select="select call_status from tbl_call_origin where id='$SP_VAL'";
$result = mysql_query($select);
if (!$result) {
    die('Invalid query: ' . mysql_error());
}
while ($row = mysql_fetch_array($result)) {
    ...
}
buff
  • 2,045
  • 10
  • 16
0
<?php
      echo "Result from SP procOutput_sum:::::$SP_VAL";
      $mysqli = mysql_connect("localhost", "root", "", "call_conference");
      if (!$mysqli) {
       die('Could not connect: ' . mysql_error());
        }

         ?>
       <?php
       $select="select call_status from tbl_call_origin where id='$SP_VAL'";
       $results = mysql_query($select);
       while ($row = mysql_fetch_array($results)){
     echo 'Status: '.$row['call_status'];
        }
        ?>
Torrezzzz
  • 297
  • 2
  • 13
  • It should be `$results = mysql_query($select);` but even if it was correct I still can't see what this adds to my answer... – buff Jul 15 '14 at 12:40
  • Warning: mysql_fetch_array() expects parameter 1 to be resource This error was caused because of that only . Now it should be working. – Torrezzzz Jul 15 '14 at 12:42