help with a url

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
epic
Forum Newbie
Posts: 9
Joined: Sun Jun 02, 2002 6:14 am

help with a url

Post by epic »

Im making a script for my webhost because he never updates the hosted site page. so i want to make him a script where all he has todo is update the database via my form which is fine i can do that.
the only thing that is troubling me is that.
The urls that have to be out putted onto the page have to have the http:// in them. and when i try add that bit to the array part of the php script it comments out the rest of the script.
Eg.

Code: Select all

while ( $data = mysql_fetch_array( $result ) )
		{
		echo 'Hosted Sites: '.
		$data&#1111;'sitename'].'  <a href="http://'.
		$data&#1111;'url'].'">'.
		$data&#1111;'sitename'].'</a><br />';
the // in the http:// comments out the rest of the script.. is there any way to combat this??
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Is it actually causing the script not to run because since those //'s are enclosed within a string they don't get recognised as comments.
This

Code: Select all

echo 'Hosted Sites: '.$data&#1111;'sitename'].'<a href="http://'.$data&#1111;'url'].'">'.$data&#1111;'sitename'].'</a><br />';
works just fine for me.

Mac
Nezzar
Forum Newbie
Posts: 4
Joined: Thu Jul 04, 2002 12:54 pm
Location: Germany
Contact:

Post by Nezzar »

If it is making trouble you could try the following (dunno why it should but...):

Code: Select all

while ( $data = mysql_fetch_array( $result ) ) 
      &#123; 
      echo 'Hosted Sites: '. 
      $data&#1111;'sitename'].'  <a href="http:/'.'/'. 
      $data&#1111;'url'].'">'. 
      $data&#1111;'sitename'].'</a><br />';
Notice the '.' between the two /
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

I think maybe what's happening is that his editor is showing him that it is a commented out line, when really it's completely valid because it's inside quotes.

Is this correct epic???
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

That's what I thought but I thought I'd be kind and didn't say it.

Mac
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

Well it's early and I haven't had my coffee yet. I'm likely to say anything. Bah!
Post Reply