Jump to content

Class+MySQL query problem


guyfromfl

Recommended Posts

For some reason the result keeps comming up null. All the echos are there to see if the values are there at certain points and ill take out once it works...

 

The checkClockIn function is called from another file but I know its ok because $emp has a value so i know i declared the class in the other file correctly.

 

<?php
public function checkClockIn($emp, $pin)
{
	$sql = "SELECT PIN FROM tblEmployees WHERE empId='$emp'";

	$pof = $this->dbQuery($sql);

	echo $pof;

	if ($pin == $pof)
	{
		return true;
	} else {
		return false;
	}

public function dbQuery($query)
{
	$result = mysql_query($query);

	$row = mysql_fetch_array($result);
	$answer = $row[0];
	echo $row;	
	return $answer;
}
?>

Link to comment
https://forums.phpfreaks.com/topic/51218-classmysql-query-problem/
Share on other sites

I have a file /includes/dblib.php that contains about 2 dozen functions for querys to the database but i thought putting all that on here would annoy people :)

 

$pof is the value of the employee's pin number in the database and $pin is the number the employee entered in the login form. $emp has its value but $pof (the result from the db) is null so all the echos dont return anything at all.

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.