Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
codes to show the username in the title of the site
Old 11-16-2005, 03:30 PM codes to show the username in the title of the site
Junior Talker

Posts: 4
Trades: 0
hello
i look for codes to show:

Viewing profile "userx" as title of the personal profilesite
where you see the information about userx

thx if someone can help
user465 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-16-2005, 03:51 PM
Ultra Talker

Posts: 251
Location: Belgium, Antwerp, Zoersel
Trades: 0
From a MySQL database? With PHP? With those 2 you could do it like this:

PHP Code:
<html>
<head>
<title><?php

$dbHost
="your host";
$dbUser="your username";
$dbPass="your password";
$dbName="your database";
$dbTable="the table you want to use";
$dbField="the field you want to show in the title";
$dbWhereField="the field which the database has to check to find the right user";
$dbWhereValue="the value the \$dbWhereField has to have. Probably a $_GET[] value";

$db=mysql_connect($dbHost$dbUser$dbPass);
mysql_select_db($dbName$db);

$user=mysql_fetch_row(mysql_query("SELECT `$dbField` FROM `$dbTable` WHERE `$dbWhereField`=`$dbWhereValue`;"));
echo 
"Your are viewing the profile of $user[0]";

?></title>
</head>
<body>
<!-- content of your page -->
</body>
</html>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Orodreth is offline
Reply With Quote
View Public Profile Visit Orodreth's homepage!
 
Old 11-16-2005, 04:20 PM
Junior Talker

Posts: 4
Trades: 0
hi
what do u mean with
the field you want to show in the title

and how do i find out $dbWhereField
user465 is offline
Reply With Quote
View Public Profile
 
Old 11-16-2005, 06:14 PM
Ultra Talker

Posts: 251
Location: Belgium, Antwerp, Zoersel
Trades: 0
Well, with "the field you want to show in the title", I mean the field in the database where the user's name is in, which will be shown in the title.

"how do i find out $dbWhereField": $dbWhereField is a variable in the script above. $dbWhereField is used to find the username of the user you want to show in the page's title. The $dbWhereValue variable contains the value it has to have, so the query will find the username you need, and not usernames. The query will only return the username of the user for which the following statement is valid: $dbWhereField = $dbWhereValue.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Orodreth is offline
Reply With Quote
View Public Profile Visit Orodreth's homepage!
 
Reply     « Reply to codes to show the username in the title of the site
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.39565 seconds with 12 queries