Have an account? Sign in
Login  Register  Facebook
cannot view data from MySQL
hello jooria

i'm beginner in php. last time i modify php script that need to set register_global ON
but last week my website was hack by someone. so i turn OFF register_global. but now i cannot view data from MySQL. i try to modify but still not appear.

here is my website link
http://www.adap.com.my/infox.php?id=239

TQ for your time and for your help. i really appreciate.

AZMI

<?php

include ("include/dbconnect.php");
//==================================================
$sql = "SELECT * FROM $table WHERE id = '$id'";
$q = mysql_query($sql);
$f = mysql_fetch_array($q);

$sql = "UPDATE $table	SET klik = klik+'1'	WHERE id = '$id'";
mysql_query($sql);
//==================================================




if ('$id') {

   $result = mysql_query("SELECT * FROM $table WHERE id='$id' ",$db);
   $links = mysql_fetch_array($result);
   
$id = $links["id"]; 
$tajuk = $links["tajuk"];
$kategori = $links["kategori"];
$tarikh = $links["tarikh"];
$penuh = $links["penuh"];
$tag = $links["tag"];
$linktag = $links["linktag"];
$sumber = $links["sumber"];
$tarikhkemaskini = $links["tarikhkemaskini"];
$klik = $links["klik"];
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
//FILTER BAD WORD
//http://www.weberdev.com/get_example-3991.html
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
include('filter.php');
// This will replace all bad words with their replacements.$any is 1 if it found any
$result = Filter($penuh,1);
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//

echo "<span class=titleadap>$tajuk </span><br>";
echo "<table width=97% border=0 cellspacing=0 cellpadding=0>";
echo "<tr>";
if ($tag=="" || $tag=="<br>") {  
echo "<td><span class=footer>$oleh $tarikh | <a href='segmen.php?kategori=$kategori' class='navblue'>$kategori</a></span></td>";
} else {
echo "<td><span class=footer>$oleh $tarikh | <a href='$linktag' class='navblue'>$tag</a></span></td>";
}
echo "</tr>";
echo "<tr>";
echo "<td><br><span class=content>$penuh<br><br></span></td>";
echo "</tr>";
if ($sumber=="") {  
echo "";
} else {
echo "<tr>";
echo "<td><span class=content><b><font color=#FF0000>Penafian:</font> Artikel/Info ini disalin dari laman web <a href='$sumber' target='blank' class='navblue'>$sumber</a>. Pihak Portal Pendidikan tidak bertanggungjawab terhadap isi kandungannya.</b></span></td>";
echo "</tr>";
}
echo "</table>";

echo "<br><font face=tahoma color=#666666 size=1><a href='javascript:back();' class='nav'>kembali ke laman utama</a></font>";
echo "<br><br><font face=tahoma color=#666666 size=1>entri ini sudah $klik kali dibaca</font>";
if ($tarikhkemaskini=="0" || $tarikhkemaskini=="") {  
echo "";
} else {
echo "<br><font face=tahoma color=#333333 size=1>dikemaskini pada $tarikhkemaskini</font>";
}
} else {
	echo "Mungkin ada kesilapan pada laman web ini.";
	echo "<a href='index.php'>Sila kembali ke bahagian utama.</a>";
}


?>
Started: September 22, 2011 Latest Activity: September 22, 2011 canoot data register global mysql

are you sure that $table variable is set?
September 22, 2011

1 Answer
alhamdulillah. problem solved
i add this code. before this cannot detect id number.
$id = $_GET[\'id\'];

TQ for your help
AZMI

Posted: miecreation
In: September 22, 2011

good word "alhamdulillah", and sorry for the long time you wait any help we here
September 22, 2011

and use intval($_GET['id']) for more Security
September 22, 2011

Your Answer

xDo you want to answer this question? Please login or create an account to post your answer