Username:
Password:
Remember me:
Register

Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)


Search forums via Google


0 Users appreciate this thread.

PHP / MySQl help
Started by NINTENDO64
(2013-01-05 01:25:56)
NINTENDO64 (2013-01-05 01:25:56)
Hi.
Can anyone tell me what "Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/n64/public_html/sign_up.php " means and how you can fix it? Thank you.
"If today were the last day of my life, would I want to do what I am about to do today?"
-Steve Jobs

DBS
NINTENDO64 (2013-01-05 19:56:38)
It didn't work. The problem is in this code:
<?php
//We check if the form has been sent
if(isset($_POST['username'], $_POST['password'], $_POST['passverif'], $_POST['email'], $_POST['avatar']) and $_POST['username']!=''
{
//We remove slashes depending on the configuration
if(get_magic_quotes_gpc())
{
$_POST['username'] = stripslashes($_POST['username']);
$_POST['password'] = stripslashes($_POST['password']);
$_POST['passverif'] = stripslashes($_POST['passverif']);
$_POST['email'] = stripslashes($_POST['email']);
$_POST['avatar'] = stripslashes($_POST['avatar']);
}
//We check if the two passwords are identical
if($_POST['password']==$_POST['passverif'])
{
//We check if the password has 6 or more characters
if(strlen($_POST['password'])>=6)
{
//We check if the email form is valid
if(preg_match('#^(([a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+\.?)*[a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+)@(([a-z0-9-_]+\.?)*[a-z0-9-_]+)\.[a-z]{2,}$#i',$_POST['email']))
{
//We protect the variables
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
$email = mysql_real_escape_string($_POST['email']);
$avatar = mysql_real_escape_string($_POST['avatar']);
//We check if there is no other user using the same username
$dn = mysql_num_rows(mysql_query('select id from users where username="'.$username.'"');
if($dn==0)
{
//We count the number of users to give an ID to this one
$dn2 = mysql_num_rows(mysql_query('select id from users');
$id = $dn2+1;
//We save the informations to the databse
if(mysql_query('insert into users(id, username, password, email, avatar, signup_date) values ('.$id.', "'.$username.'", "'.$password.'", "'.$email.'", "'.$avatar.'", "'.time().'"')
{
//We dont display the form
$form = false;
?>

Thanks anyway
"If today were the last day of my life, would I want to do what I am about to do today?"
-Steve Jobs

DBS
(Capt.)Orb (2013-01-06 14:55:13)
Do you have a MySQL table set up?
If so do you have the rows id,username,password,email,avatar and signup_date in the table?
Aviation fact: The a380 is the largest commerical aircraft in service!

Go to Splashiverse! Splashiverse
NINTENDO64 (2013-01-06 20:03:51)
Yes I do
"If today were the last day of my life, would I want to do what I am about to do today?"
-Steve Jobs

DBS
(Capt.)Orb (2013-01-08 21:15:12)
Shall I check your script from the cpanel?-N64
Aviation fact: The a380 is the largest commerical aircraft in service!

Go to Splashiverse! Splashiverse
NINTENDO64 (2013-01-08 23:04:20)
Shure. Know the login info?
"If today were the last day of my life, would I want to do what I am about to do today?"
-Steve Jobs

DBS
(Capt.)Orb (2013-01-09 02:14:16)
Think so.
Aviation fact: The a380 is the largest commerical aircraft in service!

Go to Splashiverse! Splashiverse
NINTENDO64 (2013-01-09 03:06:31)
Ok. PM me if you need help.
"If today were the last day of my life, would I want to do what I am about to do today?"
-Steve Jobs

DBS
NINTENDO64 (2013-01-10 22:17:39)
Exactly.
"If today were the last day of my life, would I want to do what I am about to do today?"
-Steve Jobs

DBS
(Capt.)Orb (2013-01-12 13:50:18)
I'll fix it today
Aviation fact: The a380 is the largest commerical aircraft in service!

Go to Splashiverse! Splashiverse
(Capt.)Orb (2013-01-12 14:09:11)
Your database is very insecure.....
Anyways I fixed your signup script.
Aviation fact: The a380 is the largest commerical aircraft in service!

Go to Splashiverse! Splashiverse
NINTENDO64 (2013-01-12 23:43:42)
Ya... but anyway thanks allot, Orb!

CLOSED!
"If today were the last day of my life, would I want to do what I am about to do today?"
-Steve Jobs

DBS
(Capt.)Orb (2013-01-14 21:24:13)
Ummm.. It's not closed
Aviation fact: The a380 is the largest commerical aircraft in service!

Go to Splashiverse! Splashiverse
NINTENDO64 (2013-06-05 17:36:46)
Fixed, closed.
"If today were the last day of my life, would I want to do what I am about to do today?"
-Steve Jobs

DBS
 

This topic is closed, so you can not post a comment.

This topic's ID: 39587

Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)




Total registered users: 8322
New registered users today: 8
Newest registered user: Dolce21dsisBack

©  Copyright 2026 3DSPlaza. All Rights Reserved