You are here: Re: php and MySQL « PHP Programming Language « IT news, forums, messages
Re: php and MySQL

Posted by Sandman on 11/18/80 11:43

In article <1143383987.691175.32830@j33g2000cwa.googlegroups.com>,
"comp_guy" <gingercrock@hotmail.com> wrote:

> hey guys, i have been working on a simple form which validates if a
> user is valid or not. i am a newbie and just want to deny unauthorised
> access to a 'members' page. I wish to compare the password entered by
> the user with that they entered into their submitted registration
> form.. however i keep getting a mySQL error message 'query was empty'.
> i was hope someone would know my failings! here is my code:
>
> <?php
>
> $connection = mysql_connect("sentinel.cs.cf.ac.uk","scm5sjc","my
> password here");
>
> $password=$_POST['password'];
>
> mysql_select_db("sjcdb",$connection) or die("failed!");
>
> $sql = mysql_query("SELECT * FROM users WHERE password = '$password'");
>
> $result = mysql_query($sql)or die(mysql_error());

This should be:

$sql = "SELECT * FROM users WHERE password = '$password'";

$result = mysql_query($sql) or die(mysql_error());




--
Sandman[.net]

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация