Hello, I am fairly new to OOP programming but it's all working so far except one little thing (which is possibly the most important part). I have tested the count_rows_in_database method and that works fine. The update/insert calls also work perfectly, however select is not working. Below is the code required. Thanks in advance I call the function like so: $isValidated = validateEmail($email); Code (markup): This is the function validateEmail: function validateEmail($email) { require_once("class_database.php"); $dbHandler = new database(); $dbHandler->connect_to_database(); $emailQuery = $dbHandler->do_query("SELECT email FROM farmers WHERE email = '".$email."'"); $emailVal = $dbHandler->count_rows_in_database($emailQuery); if($emailVal == 1) { return $dbHandler->do_query("UPDATE farmers SET status = '2' WHERE email = '".$email."'"); } else { return 0; } } Code (markup): And this is class_database.php: class database { public function connect_to_database() { $dbConnect = mysql_connect("localhost", "Ashley456","4xLogin!%58S2f4") or die(mysql_error()); if($dbConnect) { mysql_select_db("4xtrahands", $dbConnect) or die(mysql_error()); } return $dbConnect; } public function close_connection_to_database($connection) { mysql_close($connection); } public function do_query($query) { return mysql_query($query); } public function count_rows_in_database($countQuery) { return mysql_num_rows($countQuery) or die(mysql_error()); } } Code (markup):
..and where dose the email come from is it a form and how do you get it to $email . Can you show us that part ?
Select is not working means what error you are having? For me, the same code works well. put die(mysql_error() ) near mysql_query() function. so you can know the error.
Fixed it. Had a minor problem with one of my other functions that makes the data database-safe. Thanks