Postingan lainnya
error mssql_fetch_assoc() expects parameter 1 to be resource, string given in
bagaimana menyelesaikan masalah ini ?
<?php
include "conection.php";
if($_POST['id']) {
$id = $_POST['id'];
$sql = ("SELECT * from [cust_pric] where cp_cid='$id'");
while($row = mssql_fetch_assoc($sql) ){
echo'
<table class="table">
<tr>
<td>cp_cid</td>
<td>:</td>
<td>'.$row['cp_cid'].'</td>
</tr>
<tr>
<td>cp_mate</td>
<td>:</td>
<td>'.$row['cp_mate'].'</td>
</tr>
<tr>
<td>cp_hues</td>
<td>:</td>
<td>'.$row['cp_hues'].'</td>
</tr>
</table>
';
}
}
?>
0
2 Jawaban:
coba seperti ini gan
<pre> <?php
include "conection.php";
if($_POST['id']) {
$id = $_POST['id'];
$sql = mysql_query($koneksi,"SELECT * from [cust_pric] where cp_cid='$id'");
while($row = mysql_fetch_assoc($sql) ){
echo'
&lt;table class="table"&gt;
&lt;tr&gt;
&lt;td&gt;cp_cid&lt;/td&gt;
&lt;td&gt;:&lt;/td&gt;
&lt;td&gt;'.$row['cp_cid'].'&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;cp_mate&lt;/td&gt;
&lt;td&gt;:&lt;/td&gt;
&lt;td&gt;'.$row['cp_mate'].'&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;cp_hues&lt;/td&gt;
&lt;td&gt;:&lt;/td&gt;
&lt;td&gt;'.$row['cp_hues'].'&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
';
}
}
?> </pre>
1
Kamu kurang querynya <pre> //contoh $result = mssql_query($koneksiDb,$sql); while($row = mssql_fetch_assoc($result)) { //code here } </pre> semoga membantu ^^
1