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

Reply via email to