mysql_num_rows() in pdo?
Posted: Fri Nov 19, 2010 5:06 am
Hi,
I was wondering if anyone can tell me the best practice for replacing mysql_num_rows() in pdo?
I just want to test if something exisits in a db, like an email for example.
I would normally have used something like:
what is the excepted way to achieve this in pdo?
Thanks in advance!
I was wondering if anyone can tell me the best practice for replacing mysql_num_rows() in pdo?
I just want to test if something exisits in a db, like an email for example.
I would normally have used something like:
Code: Select all
//make sure the email address is available
$query = "SELECT user_id FROM users WHERE email='$e'";
$result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error());
if (mysql_num_rows($result) == 0) { //available
//do whatever
}Thanks in advance!