Your sql statement is generating an error. You can test for this using mysql_errno and mysql_error to test for and view the error, respectively. The likely cause of the SQL error is that you are not putting quotes (') around your string for the email query, the proper query would look like:
$chk = "select id, fname from contact_info where email = '$email'"; Hope that helps! -----Original Message----- From: Kirk Babb [mailto:[EMAIL PROTECTED] Sent: Saturday, October 04, 2003 5:28 PM To: [EMAIL PROTECTED] Subject: [PHP] returning a variable from a class function? plus other probs I'm new at OO and still a newbie at PHP despite hacking away at it for a while (admittedly off and on). I'm creating a signup form for alumni of our department, and I'm trying to verify that they have not signed up previously before allowing their data to be inserted. Trouble has ensued! :) In the following code: class alumnus { function addAlum($fname,$lname,$tel,$address,$city,$state,$zipcode,$country,$email) { $conxn = mysql_connect('localhost','root','redtail.7') or fail("Could not connect: ".mysql_error()); $dbSelect = mysql_select_db("alumni", $conxn) or fail("Could not select database: ".mysql_error()); $chk = "Select id, fname from contact_info where email =" . $email; $result = mysql_query($chk); $dataSet = mysql_fetch_array($result); $fields = mysql_num_fields($dataSet); if ($fields=="0") { $insertData = "INSERT into contact_info (fname,lname,tel,address,city,state,zipcode,country,email) VALUES ('$fname','$lname','$tel','$address','$city','$state','$zipcode','$country', '$email')"; $query = mysql_query($insertData); if ($query) { $bool="true"; return $bool; } } } I keep getting "supplied argument is not a valid MySQL result resource" for the lines using mysql_fetch_array and mysql_num_fields - I've looked up the functions but it doesn't seem like I'm misusing them. PLUS my $bool doesn't show up outside like I'd like it to. Can somebody guide me on the right path here? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php