Jump to content

[SOLVED] Works on one server error on the other...


Foser

Recommended Posts

I made a script for a friend and one my wamp server it works fine but on his server he gets this messge:

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in register.php on line 14

 

<?php // Includes!
require('includes/mysql.php');
session_start();?>
<?php
if (isset($_POST['reg_submit'])){
$user = mysql_real_escape_string($_POST['reg_user']);
$pw = md5($_POST['reg_pw']);
$email = $_POST['reg_email'];
$location = $_POST['reg_location'];
$webpage = $_POST['reg_url'];
$avatar = $_POST['reg_avatar'];

$check_username_valid = mysql_query("SELECT * FROM user_info WHERE username = '{$user}'");
if (mysql_num_rows($check_username_valid) >= 0){   // line 14

mysql_query("INSERT INTO user_info (username,password,email,location,url,avatar_url) VALUES ('$user','$pw','$email','$location','$webpage','$avatar')");
header("Location: regf.php?user={$user}");
}
else { echo "Username is already in use."; exit;
}}
?>

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.