0

Hi,

Red line below generates error "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource". I have checked sql string too. Thanks

<?php
ob_start(); 
$dbhost = "localhost"; 
$dbuser = "root"; 
$dbpass= ""; 
$dbname = "test"; 
@mysql_connect($dbhost,$dbuser,$dbpass) or die ("No connection."); 
@mysql_select_db($dbname) or die ("No database!"); 

$page = $_SERVER['PHP_SELF']; 
$limit = "2"; 

if(empty($_GET['paged'])) { $paged ="1"; } 
if(!is_numeric($_GET['paged'])) { header("location:$page?paged=1"); } 

$girdi = mysql_query("select * from kullanicilar"); 
$sayi = mysql_num_rows($girdi); 
$kac_tane = $sayi / $limit; 

if($kac_tane%$limit!="0") { $kac_tane++; } 
$son = ($paged-1)*$limit; 

$veri = mysql_query("select * from kullanicilar order by id limit $son, $limit"); 
while($cikart = mysql_fetch_array($veri)) { 
$id = $cikart['id']; 
$isim = $cikart['name']; 
$mesaj = $cikart['surname']; 
echo("$id $isim $mesaj"); 
} 

for($i=1; $i < $kac_tane; $i++) { echo("<a href=$page?paged=$i>[$i]</a>"); } 

ob_end_flush(); 
?>
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Shanti C
0

just put echo before$v and execute that query in your database sql query..
it tells you where will be the error...

$v ="select * from kullanicilar order by id limit $son, $limit";
$veri= mysql_query($v);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.