Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old March 24th, 2003, 09:31 PM
irishstudent irishstudent is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 irishstudent User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
problem wit log in

Could anyone help me with this problem. I'm new to php so dont really know wot i'm doing!! I'm trying to log on

My code is below
<?PHP

print_r($HTTP_POST_VARS);
$username = $HTTP_POST_VARS['username'];
$password = $HTTP_POST_VARS['password'];


$connection=mysql_connect("localhost","pp","mm")
or die('Could not connect to the database server');
$rs = mysql_select_db("test", $connection)
or die ("Unable to select database.");
$sql="select from firsttimevoter where username='" . $HTTP_POST_VARS['username'] . "' and password= password('" . $HTTP_POST_VARS['password'] . "')";

print $sql;

$rs = mysql_query($sql, $connection) or die (mysql_error());

#get number of rows that match username and password
$num=mysql_numrows($rs);

#if there is a match the log in is authenticated
if($num!=0)
{ $msg="Welcome $username - your log-in succeeded!"; }
else #return to login page
{ header("Location:$HTTP_REFERER"); exit();}

?>
<HTML>
<HEAD><TITLE>Log-In authenticated</TITLE></HEAD><BODY>
<?php echo($msg); ?></BODY>
</HTML>


THe following is coming up
Array ( [username] => bob [password] => bob ) select from firsttimevoter where username='bob' and password= password('bob')You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'from firsttimevoter where username='bob' and password= password

Any help would be greatly appreciated

Reply With Quote
  #2  
Old March 25th, 2003, 10:57 AM
xs0 xs0 is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Ljubljana, Slovenia
Posts: 760 xs0 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: problem wit log in

You need to tell MySQL which field you want to select. For example

> select username, password from ...

or

> select * from ...

I think that should fix your problem...

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > problem wit log in


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway