Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 07-11-2007, 01:23 PM   #1 (permalink)
mademokid's Avatar
 
Newb Techie

Join Date: Jun 2007

Posts: 28

mademokid is on a distinguished road

Default Php links

Right. I have successfully generate the variable I need with this code:
PHP:
PHP Code:
$query sprintf("SELECT id FROM ibf_members WHERE name='%s'",
    
mysql_real_escape_string($username));

// Perform Query
$result mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
    
$message  'Invalid query: ' mysql_error() . "\n";
    
$message .= 'Whole query: ' $query;
    die(
$message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row mysql_fetch_assoc($result)) {
    print 
$row['id'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result); 

But I need to include the $row['id'] variable in a link.

The link should be in the following format:

http://forum.example.com/index.php?showuser=$row['id']

But I don't know how to write that in php.

I would also like 'View your forum CP' to be shown as the 'link'

I hope someone understands me, because even I'm not sure!
mademokid is offline  
Old 07-11-2007, 06:15 PM   #2 (permalink)
 
Monster Techie

Join Date: May 2004

Location: Tucson, AZ, USA

Posts: 1,183

Vormund

Send a message via AIM to Vormund Send a message via MSN to Vormund Send a message via Yahoo to Vormund
Default Re: Php links

You use the echo/concatenate command.

Such as,
$link = "http://forum.example.com/index.php?showuser=" + $row['id'];
Then you use it wherever you want...by echoing/printing it.

Maybe...
Code:
<a href="http://forum.example.com/index.php?showuser=<?= $row['id'] ?>">View your forum CP</a>

__________________
Vormund is offline  
Old 07-12-2007, 10:18 AM   #3 (permalink)
mademokid's Avatar
 
Newb Techie

Join Date: Jun 2007

Posts: 28

mademokid is on a distinguished road

Default Re: Php links

Thanks
mademokid is offline  
 
Closed Thread

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Messed up links smssoleimani Browser & General Internet Questions 3 06-09-2007 06:22 PM
PHP captcha script needed iorgus Programming Discussions 2 05-20-2007 01:33 PM
Virus Writers Taint Google Ad Links Osiris Virus - Spyware Protection / Detection 0 04-26-2007 08:38 PM
PHP 2-player game? thejeremy Programming Discussions 4 04-09-2007 06:01 PM
Remote file access w/ IP + PHP? thejeremy Programming Discussions 2 04-04-2007 05:24 PM