I want to execute two queries at a time by using single script. My code is executing only the first query, and the second query shows an error.
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\hms\getpatient.php on line 29 Notice: Undefined variable: json_output in C:\xampp\htdocs\hms\getpatient.php on line 32
can any one please help why both the queries not executing but separately they will execute.
php
<html>
<head>
<title>Paging Using PHP</title>
</head>
<body>
<?php
mysql_connect("localhost","root","");
mysql_select_db("hms");
?>
<?php
$q1=mysql_query("SELECT * FROM initial_master");
while($row1=mysql_fetch_assoc($q1))
$json_output1[]=$row1;
print(json_encode($json_output1));
mysql_close();
?>
<?php
$q=mysql_query("SELECT * FROM patient_main_category");
while($row=mysql_fetch_assoc($q))
$json_output[]=$row;
print(json_encode($json_output));
mysql_close();
?>
</body>
</html>