emtor
Tue 1 May 2007, 10:48 am GMT +0200
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. :)
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. :)