GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 02-Nov-2005, 12:25
djd@n djd@n is offline
Awaiting Email Confirmation
 
Join Date: Oct 2005
Posts: 21
djd@n is on a distinguished road

There is an error on this line what is it? if($row['password'] !=$userpass $rows == 0


on this line there is an error what is it?
PHP Code:

if($row['password'] !=$userpass $rows == 0) 


  #2  
Old 03-Nov-2005, 01:54
fallen_samurai fallen_samurai is offline
Awaiting Email Confirmation
 
Join Date: Oct 2005
Location: Wisconsin, USA
Posts: 29
fallen_samurai is on a distinguished road

Re: There is an error on this line what is it? if($row['password'] !=$userpass $rows == 0


PHP Code:

if($row['password'] !=$userpass $rows == 0) 



I hope my answer with help you with this, because I'm going to assume what you are trying to do. If what I say doesn't help you, be sure to reply and I'll see what I can do more specifically.

With an if statement there are two things you can do, depending on whether or not you wish to execute multiple commands in PHP.

In your statement there you set $rows = 0 inside of the if statement, and also leave the if statement open (causing the error in the line because no code is actually being executed and the script faults). Here is one thing you can do to fix this (assuming this is what you want to do).

PHP Code:

if($row['password'] != $userpass) { $rows = 0 } 



The {} brackets contain what code will be executed upon the if statement returning 'true'.

You could also do this:
PHP Code:

if($row['password'] != $userpass) $rows = 0 



It depends on how you like to format your script, personally I like to get in the habit of using {} because when you do multiple functions under one if statement you can run into numerous problems you will have to debug (a waste of your time).

I hope this helps!
  #3  
Old 03-Nov-2005, 10:02
djd@n djd@n is offline
Awaiting Email Confirmation
 
Join Date: Oct 2005
Posts: 21
djd@n is on a distinguished road

Re: There is an error on this line what is it? if($row['password'] !=$userpass $rows == 0


ok and there is another error here on this line
PHP Code:

$query = "INSERT INTO user ('username, password, joindate, email') VALUES ('$username','$userpass','$today','$useremail')"; 


  #4  
Old 05-Nov-2005, 00:15
fallen_samurai fallen_samurai is offline
Awaiting Email Confirmation
 
Join Date: Oct 2005
Location: Wisconsin, USA
Posts: 29
fallen_samurai is on a distinguished road

Re: There is an error on this line what is it? if($row['password'] !=$userpass $rows == 0


PHP Code:

user ('username, password, joindate, email') 



Ok, with this just remove those quotations, that would be the only problem I see.

It should be:

PHP Code:

user(username, password, joindate, email) 



Just a quick pointer: When you are dealing with inserting values into a MySQL database, the first section (aka 'user') should be raw and undefined. This means that all you list is the raw table structure that you wish to supply values for in a new row of the SQL table.

When making the first section you just need to say the row name, no quotes, no brackets, nothing. Just as shown above . As far as a the second section is concerned, that looks perfect to me, nice clean code, once again though (as I previously posted) it is a good idea to attach user and values to the brackets.

PHP Code:

$query = "INSERT INTO tablename() values()"; 



Your final (hopefully working) code should look like (assuming that all variables are correctly set, in which case SQL would return another error):

PHP Code:

$query = "INSERT INTO user(username, password, joindate, email) values('$username','$userpass','$today','$useremail')"; 



For future references, and so GIDForums can help you better, it is good practice to post the error you are getting from the code (including personal debugging errors), and the line of code in which the error took place. That helps us so we can help you better .
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CD Burner Help - Power Calibration Error.... JonBoy420 Computer Hardware Forum 111 19-Feb-2009 04:54
burning problems PLEASE PLEASE HELP kelticeire Computer Hardware Forum 4 01-Dec-2006 16:39
CD burner wont burn!! robertli55 Computer Hardware Forum 1 18-Jun-2004 11:53
Yet another CD burner problem: Lite-On LSC-24082K Erwin Computer Hardware Forum 1 22-May-2004 12:28
CD Buring Failed skanth2000 Computer Hardware Forum 1 15-Nov-2003 04:52

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 16:07.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.