Jump to content

Recommended Posts

I am trying to creat a link for php in an application.  I am very novus to php.

 

goal is go get an ip address that is being collected in the DB and convert it in to a link to see how I can trace it on http://en.utrace.de/?query=

 

here is the code that i have so far but i get an error on the page.

 

<?php echo (<a href="http://en.utrace.de/?query="$result->fields['log_ip']> echo $result->fields['log_ip'] </a>); ?>

 

i get the following error;

 

Parse error: parse error, unexpected '<' in /home/web/pubht/_includes/admin/reports.php on line 298

 

 

 

Any help will be much appreciated.

 

Thank you.

 

MD X

 

Link to comment
https://forums.phpfreaks.com/topic/163832-php-link-question-please-help/
Share on other sites

You need to have quotes around the string:

echo "<a href='http://en.utrace.de/?query={$result->fields['log_ip']}'>{$result->fields['log_ip']}</a>";

or

echo '<a href="http://en.utrace.de/query=',$result->fields['log_ip'],'>',$result->fields['log_ip'],'</a>';

KingPhillip, any performance difference between using , and . in echos? PHP benchmark tests seems to favor dots more. What are your thoughts? :)

WOW THAT WAS QUICK!!!  Thanks a lot guys! 

 

another question, if i need this to be a pop-up window nad without any navigations optiions, any suggestions?

 

yes use javascript :D

 

 

a quick google search for javascript popup window tutorial/code will give you all the answers you need and allow you the ability to get it just how you want.

@SetToLoki - if you're talking to me you can use commas instead of dots. Echo allows for multiple parameters to be passed, so PHP won't have to concatenate the strings before outputting them... it just outputs the strings.

 

@Ken - see above, and I do believe it is slightly (very very slightly) faster, just because it does not have to concatenate the strings first. Again, this is the same as the ' vs " argument. Speed wise, it is practically the same.

 

@Doctor - as SetToLoki said, look into javascript's window open command: http://www.pageresource.com/jscript/jwinopen.htm

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.