Page 1 of 1

sql query problem

Posted: Wed May 07, 2003 10:02 am
by speedamp
hello!

Here is what i'm having problems with:

I need to write a user access query that will go into my database, view a field, and depending on the result forward the user to one of four html pages (forms).

I have the username/password table setup, however I'm having a problem with the query dependencies, returning the value, and then forwarding to a dependent html form.

Can anybody offer me any assistance?

-Michael

Posted: Wed May 07, 2003 10:22 am
by twigletmac
Do you have some code you could show us?

Mac

Posted: Wed May 07, 2003 12:31 pm
by speedamp
definately. I'm sorry about that. I am new to this.

I think i might have simplified it a bit.

What i need to work on is a php/sql script that will query a database and verify a username/password. Then it will return a Category field of this username/password. Depending on that field, i need to write a series of IF statements which will forward to an html page.

Does this seem like the most effective way to accomplish this?

THANKS,
-michael

sql issue

Posted: Thu May 08, 2003 9:10 am
by speedamp
Here is what I cannot get to return properly.

I am trying to return the value of the 4th column (category) which corresponds to the username given.

---------------------------------------------------------------
$query="SELECT category FROM users WHERE username='$username'";
$result=mysql_query($query);
echo $result;
---------------------------------------------------------------



The output is simply: Resource id #4

How can i get it to return the value of field 4 corresponding to the given $username (defined during login)?

THANKS
-michael

Posted: Thu May 08, 2003 9:17 am
by twigletmac
You can't directly echo the result of a mysql_query() call, have a look at:
http://www.php.net/manual/en/ref.mysql. ... l.examples

Mac

Posted: Thu May 08, 2003 9:23 am
by speedamp
thank you!