0

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.. :(

4
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by faizabest
0

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

Edited by faizabest: n/a

0

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.

0

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

0

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.

0

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 }

0

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 }

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.