-1

I was writing php code to fetch out data from two different tables from mysql database using php . I write following code given below it generate a error :

Warning: mysql_num_rows() expects parameter 1 to be resource, object given in C:\xampp\htdocs\thisone\name2.php on line 27

When i am doing it with any key constraint this is working well but when i am trying to do it from two different tables using constraint it is generating error .

Please Help and tell me how can i modify this code in correct form

<?php
include'ConnectDetail.php';
    $level=$_POST['level'];

    $language= $_POST['language'];

    //c language
    if($language=="c")
    {

        if($level=="beginner")
        {

    $sql="SELECT a.question,b.content
                    from createscript a, programdata b
                    where a.csid=b.prid";

                    $result=mysqli_query($conn,$sql);



                            if(mysql_num_rows($result)>0)

                                    {

                                        while($row = mysql_fetch_array($result))
                    {

                         echo $row['question'];
                         echo $row['content'];

                    }




                                    }

                        }

1 Answers1

1

You are using different connection functions

Change to mysqli_num_rows and mysqli_fetch_array

Mike Miller
  • 3,071
  • 3
  • 25
  • 32