Hallogan maaaf nanya lagi ini abisnya dh buntu banget ,,maklum masih tahap pembelajaran ..
ane ingin menampilkan databese user yang sudah login tapi hasilnya gini.
Quote:
Warning: mysqli::query(): Couldn't fetch mysqli in /home/u369834712/public_html/testing/list-data.php on line 32
Fatal error: Call to a member function fetch_array() on a non-object in /home/u369834712/public_html/testing/list-data.php on line 50
ini codingannya gan
koneksi.php
Spoiler for koneksi.php:
Code:
<?php
// buat koneksi dengan MySQL
$koneksi = new mysqli("localhost", "username", "password","databese");
$koneksi->close();
?>
list-data.php
Spoiler for list-data.php:
Code:
<?php
include'koneksi.php';
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "varchar":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
// jalankan query
$result = $koneksi->query("SELECT * FROM tablename");?>
<table width="1500" height="69" border="1" cellpadding="0" cellspacing="0">
<tr>
<td>Username</td>
<td>Password</td>
<td>Email</td>
<td> </td>
</tr>
<tr>
<?php do { ?>
<td width="600"><?php echo $row['user']; ?></td>
<td width="200"><?php echo $row['password']; ?></td>
<td width="150"><?php echo $row['email']; ?></td>
<td><div align="center"><span class="style6"><a href="update-data.php?id=<?php echo $row_Raywhite['id']; ?>">Edit </a> <a href="del-data.php?id=<?php echo $row_Raywhite['id']; ?>"> Delete</a></span> </div></td>
</tr>
<?php }
while ($row=$result->fetch_array(MYSQLI_ASSOC)); ?>
</table>
<?php
mysql_free_result($koneksi);
?>
<form name="form1" method="post" action="insert-data.php">
<label>
<input type="submit" name="Insert Data" id="Insert Data" value="Insert Data">
</label>
</form>
Mohon bantuannya suhu ykesalahannya dmnaaa