Jump to content

mysql fetch array


Daimler

Recommended Posts

I have installed a dating script and get the fallowing errors. Can someone help me please ? im a very beginner at php. Thank you :)

 

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\xampp\htdocs\x\include\site_functions.php on line 96

 

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\xampp\htdocs\x\include\site_functions.php on line 21

 

Warning: mysql_free_result() expects parameter 1 to be resource, boolean given in C:\xampp\xampp\htdocs\x\include\site_functions.php on line 22

 

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\xampp\htdocs\x\include\site_functions.php on line 21

 

Warning: mysql_free_result() expects parameter 1 to be resource, boolean given in C:\xampp\xampp\htdocs\x\include\site_functions.php on line 22

Table 'cristi.ifdate_users' doesn't exist

 

and this is the code:

 

<?

/////////////////////////////////////////////////////////////////////////

// iFdate v.2.0 Copyright                                              //

// By using this software you agree to the terms & conditions          //

// www.ifdate.com - www.ifusionservices.co.uk                          //

/////////////////////////////////////////////////////////////////////////

 

/////////////////////////////////////////////////////////////////////////

// iFdate Functions                                                    //

/////////////////////////////////////////////////////////////////////////

 

function getSqlRow($query) {

$result = mysql_query($query) or die(mysql_error());

$row = mysql_fetch_array($result);

mysql_free_result($result);

return $row;

}

 

function getSqlNumber($sqlQuery) {

$query=mysql_query($sqlQuery);

$result=mysql_num_rows($query);

mysql_free_result($query);

return $result;

}

 

function getSqlField($sqlQuery,$field) {

$isQuery = getSqlNumber($sqlQuery);

$query = mysql_query($sqlQuery);

if ($isQuery>0) {

$result=mysql_result($query,0,$field);

} else $result="n/a";

mysql_free_result($query);

return $result;

}

 

function uploadFile($file,$fileName,$destDir,$overwrite=FALSE) {

$success = FALSE;

if ($file!=""&&$file!="none") {

if(file_exists($destDir.$fileName)) unlink($destDir.$fileName);

$success = TRUE;

$copyPath = $destDir.$fileName;

if (!copy($file, $copyPath)) {

print ("Error: Failed to copy $file...<br>");

$success = FALSE;

}

}

return $success;

}

 

function paginate($start,$limit,$total,$filePath) {

global $lang;

 

if ($start>0) {

$newLimit = $start-$limit;

$pagination = "<a href=\"".$filePath."?start=".$newLimit."\">Prev</a> ";

}

$pageCounterLink=0;

$pageCounter=1;

while ($pageCounterLink<$total) {

$pagination .= "<a href=\"".$filePath."?start=".$pageCounterLink."\">".$pageCounter."</a> ";

$pageCounterLink += $limit;

$pageCounter++;

}

$tempVar = $start+$limit;

if ($tempVar<$total) {

$newLimit = $start+$limit;

$pagination = "<a href=\"".$filePath."?start=".$newLimit."\">Next</a> ";

}

echo $pagination;

}

 

 

function get_age($birth_day,$birth_month,$birth_year)

{

$d_stamp = date("d.m.Y",mktime());

list($cur_day,$cur_month,$cur_year) =

explode(".",$d_stamp);

$year_diff = $cur_year-$birth_year;

if(($birth_month > $cur_month) ||

($birth_month == $cur_month && $cur_day < $birth_day))

{

$age = $year_diff-1;

} else {

$age = $year_diff;

}

return $age;

}

 

// Timeout

if ($_COOKIE['iFdate']=="Active"){

mysql_query("UPDATE ifdate_users SET account_timeout='".time()."' WHERE id='".$_COOKIE['iFdate_id']."'");

}

 

$get_logged_users = mysql_query("SELECT * FROM ifdate_users WHERE active_status='Online'");

 

while ($got_logged_users = mysql_fetch_array($get_logged_users)){

 

$logged_users = getSqlField("SELECT account_timeout FROM ifdate_users WHERE id='".$got_logged_users['id']."'",'account_timeout');

 

if ($logged_users<time()-1800){

mysql_query("UPDATE ifdate_users SET active_status='Offline' WHERE id='".$got_logged_users['id']."'");

}

}

?>

Link to comment
https://forums.phpfreaks.com/topic/207866-mysql-fetch-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.