Jump to content

mysql_fetch_array(): supplied argument is not a valid MySQL result resource in


Recommended Posts

Hi friends,

 

In these lines I'm getting the following errors, If you help? ok I'll be happy.

 

sozluk.php

 

<?
session_start();
ob_start();
include "inc/baglan.php";

if ($verified_user) {
$sorgu1 = "SELECT * FROM user WHERE `nick` = '$verified_user'";
$sorgu2 = mysql_query($sorgu1);
$kayit2=mysql_fetch_array($sorgu2);
$tema=$kayit2["tema"];
if (!$tema)
$tema = "default";
}
else {
$tema = "default";
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
<SCRIPT src="images/top.js" type=text/javascript></SCRIPT>
<SCRIPT language=javascript src="images/sozluk.js"></SCRIPT>
<LINK href="favicon.ico" rel="shortcut Icon"><LINK href="favicon.ico" rel=icon>
<LINK href="images/sozluk.css" type=text/css rel=stylesheet>
<LINK href="images/<? echo $tema ?>.css" type=text/css rel=stylesheet>
</head>

<body>
<?

$verified_user = $_SESSION['verified_user'];
$verified_kat = $_SESSION['verified_kat'];
$verified_durum = $_SESSION['durum'];
$kat = $_SESSION['kat'];

$user_ip = getenv('REMOTE_ADDR');
$sorgu1 = "SELECT ip FROM ipban WHERE `ip` = '$user_ip'";
$sorgu2 = mysql_query($sorgu1);
$kayit2=mysql_fetch_array($sorgu2);
$ip=$kayit2["ip"];
if ($ip and $verified_user != "yalowa")
header("Location: bakim.php");

$sorgu1 = "SELECT nick,durum FROM user WHERE `nick` = '$verified_user'";
$sorgu2 = mysql_query($sorgu1);
$kayit2=mysql_fetch_array($sorgu2);
$durum=$kayit2["durum"];
$nick=$kayit2["nick"];
if ($durum == "sus")
header ("Location: logout.php");

$sorgu1 = "SELECT * FROM ayar";
$sorgu2 = mysql_query($sorgu1);
mysql_num_rows($sorgu2);
$kayit2=mysql_fetch_array($sorgu2);
$site=$kayit2["site"];
$reg=$kayit2["reg"];
if ($site == "off" and $verified_kat == "admin" and $process != "top") {
echo "<font color=red>Uyarı!: Site şuan kapalı konumda.</font>";
}
if ($site == "tech" and $verified_kat == "admin" and $process != "top") {
echo "<font color=red>Uyarı!: Site şuan bakım konumunda.</font>";
}
if ($site == "off" and $verified_kat != "admin" and $process != "top") {
include "kapali";
die;
}
if ($site == "tech" and $verified_kat != "admin" and $process != "top") {
include "bakim.php";
die;
}

if ($verified_user) {       // kontrol
$son_zaman = time() - 1800;
$sorgu = "DELETE FROM online WHERE islem_zamani < $son_zaman";
mysql_query($sorgu);
$simdikizaman = time();
if ($verified_kat == "admin") {
$gnick = "&$verified_user";
$sorgu = "UPDATE online SET islem_zamani=$simdikizaman WHERE nick='$gnick'";
mysql_query($sorgu);
}
else if ($verified_kat == "mod") {
$gnick = "+$verified_user";
$sorgu = "UPDATE online SET islem_zamani=$simdikizaman WHERE nick='$gnick'";
mysql_query($sorgu);
}
else if ($verified_kat == "gammaz") {
$gnick = "$verified_user*";
$sorgu = "UPDATE online SET islem_zamani=$simdikizaman WHERE nick='$gnick'";
mysql_query($sorgu);
}
else {
$sorgu = "UPDATE online SET islem_zamani=$simdikizaman WHERE nick='$verified_user'";
mysql_query($sorgu);
}
} // kayitli online kont


if ($process) {
if ($process == "privmsg" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "cp" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "add" and !$verified_user) {
Header ("Location: logout.php");
die;
}
if ($process == "adm" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "msjoku" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "msjana" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "yenimsj" and !$verified_user) {
Header ("Location: logout.php");
die;
}
if ($process == "adm" and !$verified_user) {
Header ("Location: logout.php");
die;
}

if ($process == "onlines" and !$verified_user) {
Header ("Location: logout.php");
die;
}

// echo $process;
if (file_exists("inc/$process.php"))
include "inc/$process.php";
else if (file_exists("adm/$process.php"))
include "adm/$process.php";
else
echo "
<LINK href=\"images/$tema.css\" type=text/css rel=stylesheet>
Bu b?l?m ge?ici olarak servis dışı.";


if ($process == "word") {
function mtime(){
    list($usec, $sec) = explode(" ",microtime());
    return ((float)$usec + (float)$sec);
    }
$basla = mtime();
for ($i=0; $i < 10000; $i++){
    }
$bitir = mtime();
echo "<br><br><br><center><a href=sozluk.php?process=word&q=sayfa+uretim+suresi target=main><font size=1>sayfa ?retim s?resi</font></a>:<a class=link><font size=1>".round($bitir-$basla,5)."</font></a>";

echo "
<hr>
<font size=1>Lafmacun.Org S?zl?k<br>
Copyright by 2006 (c)
";
}

}
ob_end_flush();
?>
</body>
</html>

 

lines that failed

 

$kayit2=mysql_fetch_array($sorgu2);

$kayit2=mysql_fetch_array($sorgu2);

mysql_num_rows($sorgu2);

$kayit2=mysql_fetch_array($sorgu2);

 

always the same error in this line of your script starts with four errors

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in

When a query to MySQL fails, then MySQL throws an error, PHP's function mysql_query will return FALSE.  The functions that rely on mysql_query() will then fail, because they are NOT designed to handle a FALSE resource.

 

This is why I can be confident in telling you: your query is failing with an error.

 

There are a couple of ways to handle this.

 

1. echo out your query, and run it in a database console, or software (phpMyAdmin).

 

2. code in a de-bugger that will show what the error is.

Like:

$sorgu2 = mysql_query($sorgu1) or trigger_error( $sorgu1 . ' has encountered an error. <br />' . mysql_error() );

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.