-1

I just moved a script from a server to another and I am getting this error now.

Both servers have the same PHP versions.

The error :

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/www/94785434238541841303849314ba4fa5/web/webapp/screen_3.php on line 85

and here is the screen_3.php relevant error code :

<?php
                $sel="select * from user where sess_id='".$sess_id."' order by id desc"; 
                $res=mysql_query($sel);
                $val=mysql_fetch_array($res);
                //$seli="select * from "
                //echo $val['w1'];
                //echo $val['w2'];
                //echo $val['w3'];
        //$val['w1']= 'arrow';
                            ?>

Thank you for your replies.

achedeuzot
  • 3,956
  • 4
  • 42
  • 54
  • 2
    use mysql_error() to see whats happening after the $res=mysql_query($sel); – Abhik Chakraborty Mar 25 '14 at 15:10
  • You are using [an **obsolete** database API](http://stackoverflow.com/q/12859942/19068) and should use a [modern replacement](http://php.net/manual/en/mysqlinfo.api.choosing.php). – Quentin Mar 25 '14 at 15:11
  • @Touki I may request for forgiveness..I studied those duplicate...but didn't understand..that's why I asked... – user3460289 Mar 25 '14 at 15:13

1 Answers1

1

most probably your database connection failed... are you sure that mysql_connect is working with the correct db user and pass ?

alez007
  • 301
  • 1
  • 6
  • Thanks..for point outing...Cuz mysql details were wrong there...and Now..fixed...thanks..again.. – user3460289 Mar 25 '14 at 15:20
  • Still you are allways better of to analyse the actual error message instead of just fixing errors blindly. mysql_error() as suggested above would habe shown you exactly that. – ToBe Mar 25 '14 at 16:12