php - SQLSTATE[HY093]: error But i dont see why -


so here code: try{

        $db->begintransaction();         $ipaddress = getenv('remote_addr');         $stmt2 = $db->prepare("insert members (username, email, password, signup_date, ipaddress) values (:username, :email1, :bcrypt, now(), :ipaddress)");         $stmt2->bindparam(':username', $username, pdo::param_str);         $stmt2->bindparam(':email1', $email1, pdo::param_str);         $stmt2->bindparam(':bcrypt',$bcrypt, pdo::param_str);         $stmt->bindparam(':ipaddress', $ipaddress, pdo::param_int);         $stmt->execute();         //get last id inserted db users id activation , member folder creation///         $lastid = $db->lastinsertid();         $stmt3 = $db->prepare("insert activate (user, token) values (:lastid , :token)");         $stmt3->bindvalue(':lastid', $lastid, pdo::param_str);         $stmt3->bindvalue(':token', $token, pdo::param_str);         $stmt3->execute();         //send email activation new user///         $from = "from: auto responder @ geekifyme <admin@geekifyme.org>";         $subject = "important: activate geekifyme account";         $link = "http://www.geekifyme.org/scripts/activate.php?user='.$lastid.'$token='.$token.";         //strt email body////         $message = "         registering account @ geekifyme!  there 1 last step in setting account.  please click link below confirm identity , started.  if link below not active please copy , paste browser bar.          $link         ";         //set headers////         $headers = 'mime-version: 1.0' . "rn";         $headers .= "content_type: textrn";         $headers .=  "from: $fromrn";         //send email now/////         mail($email1, $subject, $message, $headers);         $db->commit();         echo 'thanks joining! check email in few moments activate account may log in.';         $db = null;         exit();     }     catch(pdoexception $e){         $db->rollback();         echo $e->getmessage();;         $db = null;         exit();     } 

what cause this?

sqlstate[hy093]: invalid parameter number: number of bound variables not match number of tokens

i don't see of basic forgetting ':' or other basic mess ups. can see anything?

you're creating statement object stmt2

that gets referenced on next 3 lines.

but next 2 lines following reference stmt, not stmt2.

we don't see sql text or prepare stmt in code example, , don't see execute stmt2.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -