Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Mysql/PHP some problem in retrieving data from the database

Guest
Nov 07, 2007 Nov 07, 2007
Hi,

Hi I am new to php and dreamweaver. I am using dream weaver MX 2004 and the latest version of MySQL. I am making a login page and using the default server behavior of Dream weaver for it it there is a problem. The problem is that I have two types of users: admin and simple user. Now in the default server behavior we have only two options if it succeeds go one page other wise go to another and in my situation I have 3 pages, one for admin, one for simple users, and one if the users is unable to login. Following is the code I had edited so far by now.

mysql_select_db($database_connectDB1, $connectDB1);
$sql = mysql_query("SELECT username,password,type FROM users WHERE username = '$username'");
$fetch_em = mysql_fetch_array($sql);
//$numrows = mysql_num_rows($sql);

if($fetch_em["type"] == "Admin")
{
$MM_redirectLoginSuccess = "admin.php";
}
else if($fetch_em["type"] == "User")
{
$MM_redirectLoginSuccess = "nuser.php";
}
$MM_redirectLoginFailed = "index.php";
(username is primary key and there is no caps problem with the word Admin or User)
but it is not working. I am really stuck now and unable to do it. Can any please tell me where I am wrong or tell me any other easier way to do the same thing. Even a little hel will be really appreciated.
Thanks in advance.
TOPICS
Server side applications
342
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 08, 2007 Nov 08, 2007
Do not use PHP but would suggest writing your own process rather than using a built in server behaviour. Logic for the code would be pretty much what you have shared but replacing the MM_Redirect behavour with PHP code that loads a particular page.

Another option would be to pass the type in the URL to the success page and make the success page a PHP page that handles the redirect.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 09, 2007 Nov 09, 2007
LATEST
sheeda pahlawan wrote:
> Hi I am new to php and dreamweaver. I am using dream weaver MX 2004 and the
> latest version of MySQL. I am making a login page and using the default server
> behavior of Dream weaver

The PHP Log In User server behavior in MX 2004 uses deprecated code,
which results in failure on most recent installations of PHP. I
published details of the problem (and the solution) in the friends of ED
forum several years ago:

http://friendsofed.infopop.net/2/OpenTopic?a=tpc&s=989094322&f=8033053165&m=324102421

This problem doesn't affect Dreamweaver 8 or CS3.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines