...

View Full Version : showing users data e.g profile but gtting errors



runnerjp
11-26-2007, 03:40 PM
hey im using the following code to attemp to get the users data from the db


<?php $query="SELECT * FROM users WHERE Username = '$_GET[username]' LIMIT 1";
$result=mysql_query($query);
while($array=mysql_fetch_assoc($result)){
$pID=$array['ID'];
$puser=$array['username'];
}


?>


<?php echo $puser . " " . $ID;&#160; ?>to get a users data by following a link like mywebsite.com/members/name

where in the members folder i have
.htaccess



<?php RewriteEngine on
RewriteBase /
RewriteRule ^i([^/.]+)/?$ /images.php?username=$1
RewriteRule ^([^/.]+)/?$ members/profile.php?username=$1 [L] ?>shouldent $_GET[username] get it either form fact im logged in or from the url itself and display there information?

Fumigator
11-26-2007, 05:46 PM
If I were you I'd get your script running without the fancy mod_rewrite stuff first. Just use a normal query string. Once you have the script working with a normal query string, then introduce the mod_rewrite and debug/re-work until that is working.

p.s. your echo statement is using $ID, which I didn't see assigned to anything anywhere.

runnerjp
11-26-2007, 05:53 PM
but i thought i could get the suers id with the username from the table together?

Fumigator
11-26-2007, 06:06 PM
You can select multiple columns in one query, yes. Though I don't see why you need to select username, since you're using username to determine which row gets selected. In other words, you already have the username value.

runnerjp
11-26-2007, 06:12 PM
but surly it still should ec the result



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum