I have this error when I run my system in XAMPP but it works succ on WAMP..

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\xxx\xxx.php on line 29

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\xxx\xxx.php on line 38

My coding:

7 $query = "SELECT * FROM projek2 WHERE KOD_CTPRO='$KodPro'";
8 $result=mysql_query($query);
9
10while($row = mysql_fetch_array($result))
11{
12$NoRekod=$row;
13 $KodProjek=$row;
14 }


what thats mean on that? i really dun know.. :(

sorry, the error was in line 10.

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\xxx\xxx.php on line 10

problem is line no 7, that is ur query either ur table name is wrong or column name is wrong. You try to run this query in phpmyadmin then find out the syntax error.

ok, thanx.. i will check my Database connection.. tq for your info.

Member Avatar for rajarajan2017

Just try your query in your phpmyadmin with sql editor. If it is not return any rows that would be your problem. So always check your queries in your sql editor and get the confirmation about your query results. That would be a good practice too.

I would suggest that you add the following piece of code in line 8. It will give you the precise error:

$query = "SELECT * FROM projek2 WHERE KOD_CTPRO='$KodPro'";
8 $result=mysql_query($query) or die(mysql_error());
9
10while($row = mysql_fetch_array($result))
11{
12$NoRekod=$row;
13 $KodProjek=$row;
14 }

I would suggest that you add the following piece of code in line 8. It will give you the precise error:

$query = "SELECT * FROM projek2 WHERE KOD_CTPRO='$KodPro'";
8 $result=mysql_query($query) or die(mysql_error());
9
10while($row = mysql_fetch_array($result))
11{
12$NoRekod=$row;
13 $KodProjek=$row;
14 }

ok, thanx. its work now. there are something wrong with my database connection. But now, suddenly i found new error while calling a data from sql database.

ERROR
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '619''' at line 1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.