I have an error with the registration form, when someone registers or connects it gives me :

Warning: mysql_num_rows() expects parameter 1 to be resource, null given in \public_html\include\global.php on line 37 Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in \public_html\include\global.php on line 38 Warning: Cannot modify header information - headers already sent by (output started at \public_html\include\global.php:37) in \public_html\takesignup.php on line 137

thanks in advance if you can help me

global.php :

 function get_user_timezone($id) {
            $sql = "SELECT * FROM users WHERE id=$id LIMIT 1";
            $query = mysql_query($sql);
            if (mysql_num_rows($query) != "0") {
     $kasutaja = mysql_fetch_array($query);
     $timezone = $kasutaja["tzoffset"];
     return "$timezone"; } else {
             return "5"; } //Default timezone

takesigneup.php :

mail($email, "$SITENAME user registration confirmation", $body, "From: $SITEEMAIL", "-f$SITEEMAIL");

header("Refresh: 0; url=ok.php?type=signup&email=" . urlencode($email));

Recommended Answers

All 2 Replies

It means there’s a problem with the mysql_query() statement. It is returning NULL instead of a valid MySQL resource.

Are you sure the query is valid? Are your sure the users table has an id field? Are you sure $id is a valid integer?

At second glance, I don’t see where you are connecting to MySQL and passing that connection resource into the mysql_query() function. Where are you connecting to the database?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.