hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : href link in DB output
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

href link in DB output

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 05-09-2010, 11:18 AM
internetking internetking is offline
New Member
 
Join Date: Feb 2007
Posts: 3

href link in DB output


I have built myself a little database to hold info for me but would like to add an active url to the output ...

I have it like this:

Code:
<td><center><a href="$reboot"></a></td>
$reboot being the url pulled from the database, I think its the " that is causing the probs as i get this error on the page once i insert the above code:

Code:
Parse error:  syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/seedfoxu/public_html/admin/index.php on line 35
Any ideas of help is welcomed

Thanks
Mark

Reply With Quote


Sponsored Links
  #2  
Old 05-09-2010, 12:48 PM
petteyg359 petteyg359 is offline
Web Hosting Master
 
Join Date: Mar 2009
Posts: 596
Is the URL in the database, or the full <a> element? If it's just the URL, and you're outputting with
Code:
echo "<td><center><a href="url"></td>";
then the problem should be quite obvious. See the example code. Also, your page is not going to validate, because you're not closing the <center>.

__________________
[GB ≠ GiB] [MB ≠ MiB] [kB ≠ kiB] [1000 ≠ 1024] [Giga ≠ gram] [Mega ≠ milli] [Kelvin ≠ kilo] [Byte ≠ bit]
There is no millibit. There is no gram-bit. There is no Kelvin-Byte.

Reply With Quote
  #3  
Old 05-09-2010, 02:02 PM
bear bear is online now
Community Leader
 
Join Date: Oct 2002
Location: cognito
Posts: 17,436
Or it could be as simple as the var not having a ";" after it.
<a href="$reboot"> vs <a href="$reboot;">

But it doesn't have the PHP tags around it, so it's hard to say if that's part of the longer echo or something...

__________________
Have problems (don't we all)? Head over to the help desk
If at first you don't succeed, that's one data point.


Reply With Quote
Sponsored Links
  #4  
Old 05-10-2010, 08:27 PM
sbink sbink is offline
Newbie
 
Join Date: Apr 2010
Posts: 25
You need to use PHP mode to access PHP variables. Do this in one of three ways, depending on how your code is set up:

Code:
<!-- method 1, in HTML -->
<td><center><a href="<?=$reboot;?>"></a></td>

<!-- method 2, in HTML -->
<td><center><a href="<?php echo $reboot; ?>"></a></td>

<?php
// method 3, in PHP 
echo "<td><center><a href=\"$reboot\"></a></td>";
?>

Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS "Import" or "Link href"???? spiderwebfx Web Design and Content 7 07-24-2007 01:12 PM
Button href problem Daniel_G Programming Discussion 1 01-16-2007 06:01 PM
a href link to specific part of webpage jinca Web Design and Content 5 12-30-2005 08:37 PM
href to a folder on a server? mulligan Programming Discussion 3 12-23-2005 11:34 AM
'href' attribute help Techie411 Web Design and Content 1 09-20-2004 09:45 AM

Related posts from TheWhir.com
Title Type Date Posted
Web Host Webhostforasp.net Launches New Affiliate Program Web Hosting News 2012-01-16 14:31:12
Google Data Centers Consume 50 Percent Less Energy than Average: Report Web Hosting News 2011-09-09 15:19:21
NTT America Launches Global Virtual Link Web Hosting News 2011-07-27 20:34:43
Web Host CoreLink Data Centers Adds New Managed Network Services Web Hosting News 2011-06-21 16:03:56
Indian Leaders to Form Guidelines for Improving Data Center Energy Efficiency Web Hosting News 2011-06-20 15:59:38


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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 Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?