28, May 2012

displaying profile image thumbnail in the <example.php> page (Version 2) - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: displaying profile image thumbnail in the <example.php> page (Version 2)
« previous next »
Pages: [1] Print

Author 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.  Smiley
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
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
Tags : access user class Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: displaying profile image thumbnail in the <example.php> page (Version 2)
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 10:20:34 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.