| Author |
PHP session variable in MySQL statement
|
|
| bethan81 2005-03-14, 6:17 pm |
| How would i go about selecting information from the database that are eqal to
the contents of my session variable? I have kind of assumed that i would have
to do this in the mysql bit. I have a column in the table called email, which
the session variable is equal to when a user logs in. Here is the code that i
currently have, but this doesnt seem to work:
$query_memberviewquery = "SELECT * FROM artistmembers WHERE email
='$_SESSION['validuser']' ORDER BY membername ASC";
any help would be great
many thanks bethan
| |
| Jeff North 2005-03-14, 6:22 pm |
| On Mon, 14 Mar 2005 13:38:48 +0000 (UTC), in macromedia.dreamweaver
"bethan81" <webforumsuser@macromedia.com> wrote:
>| How would i go about selecting information from the database that are eqal to
>| the contents of my session variable? I have kind of assumed that i would have
>| to do this in the mysql bit. I have a column in the table called email, which
>| the session variable is equal to when a user logs in. Here is the code that i
>| currently have, but this doesnt seem to work:
>|
>| $query_memberviewquery = "SELECT * FROM artistmembers WHERE email
>| ='$_SESSION['validuser']' ORDER BY membername ASC";
Try:
$query_memberviewquery = "SELECT * FROM artistmembers WHERE email
='" . $_SESSION['validuser'] . "' ORDER BY membername";
ASC is not needed because it is the default.
>| any help would be great
>|
>| many thanks bethan
---------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
| |
| Ross Riley 2005-03-14, 6:25 pm |
| try..
$user=$_SESSION['validuser'];
$query_memberviewquery = 'SELECT * FROM artistmembers WHERE email LIKE '%$user%' ORDER BY membername ASC';
|
|
|
|
| Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |