this is 'pemaju_semakan2.php' coding

<?php include("db.php"); ?>

<?php
$IDSykt=$_POST['IDSykt'];

$query = "SELECT * FROM pemaju WHERE PJ_SYKT_NO='$IDSykt'";
$result=mysql_query($query);

while($row = mysql_fetch_array($result))
{
    $IDSykt=$row['PJ_SYKT_NO'];
    $NamaSykt=$row['PJ_SYKT_NAMA'];
}

this is 'db.php' coding

<?php
$hostname_connection = "localhost";
$database_connection = "zaza";
$username_connection = "root";
$password_connection = "";
$connection = mysql_pconnect($hostname_connection, $username_connection, $password_connection) or trigger_error(mysql_error(),E_USER_ERROR); 
?>

and this is the error

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\pkpkr 09072010\pemaju_semakan2.php on line 9

I have this problen when i running in xamp.. But it was run succ in WAMP5.. is there anything error on my code or there have another setting in xampp?

Recommended Answers

All 3 Replies

1 <?php include("db.php"); ?>
2
3 <?php
4 $IDSykt=$_POST;
5
6 $query = "SELECT * FROM pemaju WHERE PJ_SYKT_NO='$IDSykt'";
7 $result=mysql_query($query);
8
9 while($row = mysql_fetch_array($result))
10 {
11 $IDSykt=$row;
12 $NamaSykt=$row;
13 }

Member Avatar for rajarajan2017
$query = "SELECT * FROM pemaju WHERE PJ_SYKT_NO='$IDSykt'";
echo $query;
$result=mysql_query($query);

The above code echo your query in browser, copy and paste the result in phpadmin sql editor and check whether it returing rows.

According to the error message your query return false, which indicates failure. Are you sure you've copied your database and tables, and created the same user ?

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.