Topic: displaying profile image thumbnail in the <example.php> page (Version 2) (Read 1015 times)
Atari ST fan
Posts: 8
64 credits Members referred : 0
« on: May 01, 2007, 10:48:21 am »
Olaf: -I followed your advice on keeping the <users> table clean, and instead use an already existing field in the <users_profile> table for storing the URL to the profile image thumbnail. This introduced a new problem with making the correct mySQL-query, since I realized that I had to make a query in the <users_profile> table based on info in the <users> table. I googled for tutorials and examples on joined/nested/subqueries in mySQL and understood NOTHING of it. After much reading and thinking I did succeed in writing a query that does what I want it to. Here's the code:
<img src=" <?php mysql_connect("localhost", "db_username", "db_password") or die(mysql_error()); mysql_select_db("db_name") or die(mysql_error());
$query= "SELECT user_1 FROM users, users_profile WHERE users.id = users_profile.users_id&& users.login = '$page_protect->user'";
$result = mysql_query($query) or die(mysql_error());
while($data = mysql_fetch_array($result)){
echo $data['user_1']; } ?> " border="1">
Your access_class_user script has made me learn a bit of mySQL/php, and the reason is that I'm forced to find things out on my own. I guess you could have explained everything about the class, but then people wouldn't learn much.
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #1 on: May 01, 2007, 11:27:30 am »
to use a thumbnail it's very easy to use md5(username).jpg as image name (no database mutation needed)
or if you store the info inside the profile table use the profile extenstion (check the example file how to obtain the different fields)
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=6491