Jump to content

mysql_ to pdo and making functions work


brown2005

Recommended Posts

The only thing that might change in how you call the function is you may need to pass in a handle for the PDO connection, if it's not available via some other means (ie class variable).  You just have to update the code within it to use PDO rather than the mysql_* functions.

 

 

 

 

Link to comment
Share on other sites

class Selmgec {

function website_url($url){
global $db;
    $stmt = $db->query("SELECT selmgec_id FROM selmgec INNER JOIN domains ON selmgec_domain=domains_id WHERE domains_url='$url'");
while($row = $stmt->fetchAll(PDO::FETCH_ASSOC)){
return $row['selmgec_id'];
}
   }

 function website_id($id){
global $db;
    $stmt = $db->query("SELECT domains_url FROM domains INNER JOIN selmgec ON selmgec_domain=domains_id WHERE selmgec_id='$id'");
while($row = $stmt->fetchAll(PDO::FETCH_ASSOC)){
return $row['domains_url'];
}
   }

}

$network = $selmgec->website_url('http://www.richardbrown.name');

 

so why is this not working?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.