Jump to content

Mysql_result() , Error


TottoBennington

Recommended Posts

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/tottoswd/public_html/iuw/func/user.func.php on line 4

 

<?php
function user_exists($email) {
$email = mysql_real_escape_string($email);
$query = mysql_query("SELECT COUNT(´user_id´) FROM ´users_vu´ WHERE ´email´ = '$email'");
return (mysql_result($query, 0) == 1) ? true : false;    (THIS IS THE LINE WITH THE ERROR)
?>

Link to comment
https://forums.phpfreaks.com/topic/259687-mysql_result-error/
Share on other sites

Whether you use the slanted apostrophe or not shouldn't matter. The correct syntax and good practice is to use the apostrophe;  but as I said, is not required.

 

I believe the error is due to your "COUNT" function. Try putting am as statement and accessing the alias: "COUNT(*) AS Total".

 

$query = mysql_query("SELECT COUNT(´user_id´) AS `User` FROM ´users_vu´ WHERE ´email´ = '$email'");
return (mysql_result($query, 0, 'User') == 1) ? true : false;    (THIS IS THE LINE WITH THE ERROR)

 

Link to comment
https://forums.phpfreaks.com/topic/259687-mysql_result-error/#findComment-1331043
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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