Jump to content

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


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;
}}
?>

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.