I am trying to fetch results using ajax,php and MySql. However I am getting following errors on my server side script.
Warning: mysqli_select_db() expects parameter 1 to be mysqli, resource given in D:\htdocs\classes\xxx on line 10
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource
The server side code is as follows:
<?php
$q = intval($_GET['q']);
$con= mysqli_connect("localhost","root","abcd123") or die ("could not connect to mysql");
mysqli_select_db($con,"payrolldb001") or die ("no database");
$sql="SELECT substationid,substationcode FROM wms_substation WHERE assemblylineid = '".$q."'";
$result = mysqli_query($con,$sql);
echo "<select>";
while($row = mysqli_fetch_array($result))
{
echo "here";
echo "<option>". $row['substationcode'] . "</option>";
}
echo "</select>";
mysqli_close($con);
?>
I can not figure out where am i going wrong.Please help.