alexa-tracking

Minta Tolong banget ma Agan database ane gk mau muncul di table Php

Main Content

1024
1024
KASKUS
51
244
https://www.kaskus.co.id/thread/000000000000000016880114/minta-tolong-banget-ma-agan-database-ane-gk-mau-muncul-di-table-php
Minta Tolong banget ma Agan database ane gk mau muncul di table Php
Closed
coba ganti <? dengan <?php
- double post -
KASKUS Ads
Quote:

cek yg warna merah, apakah sama dengan yg ada di db nama2 rownya?
Quote:


yg bantuan agan diatas bener gak?

trus ini ente coba
PHP Code:
$sql="SELECT * FROM $tbl_name ORDER BY id DESC"

yang a"ORDER BY id DESC coba dilepas dulu, jangan dipake dulu.
cuma sekedar coba2 aja dulu.
nanti kalo hasilnya sama aja, balikin lagi.
maaf gan klu doubel post..
<?php yang di <?php echo $.....> yang gak ada
Script nya sih kelihatan nya udah bener gan ...
Coba di cek aja nama field yang mau di print sama gak dengan nama field di table database nya ...
Ato mungkin bisa pake ini : <? echo $rows[0]; ?> , <? echo $rows[1]; ?> ,dst ...
permisi....minta izin buat coba bantu2 ya agan2
Quote:


coba tanda kutip nya di ilangin gan jadi
mysql_connect($host, $username, $password)
mysql_select_db($db_name)

maap yee kalo udah di coba belum bisa emoticon-Shakehand2
PHP Code:
$tbl_name="forum_question"


apakah nama tablenya udah benar gan ?emoticon-Angkat Beer
$sql="SELECT * FROM $tbl_name ORDER BY id DESC";

$tbl_name ini kan variabel yang di define sebelumnya..
kalau ambil nama variabel di php gimana titik komanya emoticon-Big Grin

lagi ada kesalahan selanjutnya gan..

trimaksih gan ane chek dengan pendapat agan sekalian kesahalah di mysql.....= (" " ) an kasih kutip trus ane hapus dan di <? ane kasih php jadi <?php.. lancar dan keluar semua tp gan selanjunya keluar maslah di ancwer_forum yang isinya





Parse error: syntax error, unexpected $end in C:\xampp\htdocs\skripsi\forum\answer_forum.php on line 141


dengan script ane

<html>
<head>
<title>Memberi Komentar pada salah satu forum</title>
</head>
<body>
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="forum1"; // Database name
$tbl_name="forum_question"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// get value of id that sent from address bar
$id=$_GET['id'];
$sql="SELECT * FROM $tbl_name WHERE id='$id'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
?>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1"
bgcolor="#CCCCCC">
<tr>
<td><table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="1"
bgcolor="#FFFFFF">
<tr>
<td bgcolor="#F8F7F1"><strong><? echo $rows['topic']; ?></strong></td>
</tr>
<tr>
<td bgcolor="#F8F7F1"><? echo $rows['detail']; ?></td>
</tr>
<tr>
<td bgcolor="#F8F7F1"><strong>By :</strong> <? echo $rows['name']; ?>
<strong>Email : </strong><? echo $rows['email'];?></td>
</tr>
<tr>
<td bgcolor="#F8F7F1"><strong>Date/time : </strong><? echo $rows['datetime'];
?></td>
</tr>
</table></td>
</tr>
</table>
<BR>
<?php
$tbl_name2="forum_answer"; // Switch to table "forum_answer"
$sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id'";
$result2=mysql_query($sql2);
$no=1;
while($rows=mysql_fetch_array($result2)){
?>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1"
bgcolor="#CCCCCC">
<tr>
<td><table width="100%" border="0" cellpadding="3" cellspacing="1"
bgcolor="#FFFFFF">
<tr>
<td width="18%" bgcolor="#F8F7F1"><strong>NO</strong></td>
<td width="5%" bgcolor="#F8F7F1">:</td>
<td width="77%" bgcolor="#F8F7F1"><? echo $no; ?></td>
</tr>
<tr>
<td width="18%" bgcolor="#F8F7F1"><strong>Name</strong></td>
<td width="5%" bgcolor="#F8F7F1">:</td>
<td width="77%" bgcolor="#F8F7F1"><? echo $rows['a_name']; ?></td>
</tr>
<tr>
<td bgcolor="#F8F7F1"><strong>Email</strong></td>
<td bgcolor="#F8F7F1">:</td>
<td bgcolor="#F8F7F1"><? echo $rows['a_email']; ?></td>
</tr>
<tr>
<td bgcolor="#F8F7F1"><strong>Answer</strong></td>
<td bgcolor="#F8F7F1">:</td>
<td bgcolor="#F8F7F1"><? echo $rows['a_answer']; ?></td>
</tr>
<tr>
<td bgcolor="#F8F7F1"><strong>Date/Time</strong></td>
<td bgcolor="#F8F7F1">:</td>
<td bgcolor="#F8F7F1"><? echo $rows['a_datetime']; ?></td>
</tr>
</table></td>
</tr>
</table><br>
<?
$no=$no+1;
?>
<?
}
$sql3="SELECT view FROM $tbl_name WHERE id='$id'";
$result3=mysql_query($sql3);
$rows=mysql_fetch_array($result3);
$view=$rows['view'];
// if have no counter value set counter = 1
if(empty($view)){
$view=1;
$sql4="INSERT INTO $tbl_name(view) VALUES('$view'emoticon-Wink WHERE id='$id'";
$result4=mysql_query($sql4);
}
// count more value
$addview=$view+1;
$sql5="update $tbl_name set view='$addview' WHERE id='$id'";
$result5=mysql_query($sql5);
mysql_close();
?>
<BR>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1"
bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="add_answer.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td width="18%"><strong>Name</strong></td>
<td width="3%">:</td>
<td width="79%"><input name="a_name" type="text" id="a_name" size="45"></td>
</tr>
<tr>
<td><strong>Email</strong></td>
<td>:</td>
<td><input name="a_email" type="text" id="a_email" size="45"></td>
</tr>
<tr>
<td valign="top"><strong>Answer</strong></td>
<td valign="top">:</td>
<td><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input name="id" type="hidden" value="<? echo $id; ?>"></td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset"
name="Submit2" value="Reset"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<p align="center"><a href="main_forum.php">Batal dan Kembali Ke Forum Utama
</a></p>
</body>
</html> ====> bagian ini line 141


mohon pencerahannya lagi gan.. trimakasih gan
×