35 pts.
0
Q:
URL link in PHP/MySQL script
I am adding a URL within a table with PHP and a MySQL Database, my string doesn't show all of the URL, it cuts it off.
ASKED: Jun 19 2008  10:43 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
25 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
# This is the line I am using…
# echo “<td><a href=" . $row[’venues/venue_a/venue_a.php’] . “>” . $row[’club_id’] . “</a></td>”;

$row[’venues/venue_a/venue_a.php’] appears to have the link value as the array key instead of the valid array key - something like $row[’venues_link’].

The reason the 'first half' of the url is showing is - if you leave the href empty it defaults to your current page. So, if you're on example.com/mysite.php and click a link with an empty href it will take you to the page you're on.

Hope that helps!

Shawn
Last Answered: Jun 20 2008  12:41 AM GMT by Shawngo   25 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Jviney   35 pts.  |   Jun 19 2008  10:51PM GMT

This is the line I am using…

echo “<td><a href=" . $row['venues/venue_a/venue_a.php'] . “>” . $row['club_id'] . “</a></td>”;

It shows in the table, but the link goes to the “first half” of the web page URL , what I placed in the code is the “2nd half” of the URL.

Any help would be appreciated.

 

Jviney   35 pts.  |   Jun 20 2008  10:34PM GMT

Thank you for your help Shawn, however, I’m still confused!

 

Shawngo   25 pts.  |   Jun 21 2008  1:26PM GMT

if you just want the URL in there, remove the $row[''] part from the href.

echo ‘<td><a href="venues/venue_a/venue_a.php“>’ . $row[’club_id’] . ‘</a></td>’;

and if you’re picking up the query string at venue_a.php you could do something like

echo ‘<td><a href="venues/venue_a/venue_a.php?club_id= . $row[’club_id’] . ‘“>’ . $row[’club_name’] . ‘</a></td>’;

What does the table look like that you’re querying? Does it have a ‘venue/venue_a/venue_a.php’ column? Thats what it appears is happening in your version. But it seems like you have a column in the database to reference that venue. In that case, you would use $row[$column_name] where $column_name is (and stop me if you need no further explanation ;) ), the the column in your db that represents the venue URL reference for this particular venue.

Hope I confused things a bit more here. Job security?

Cheers,
Shawn

 

Jviney   35 pts.  |   Jun 21 2008  7:07PM GMT

Thank you….I modified it a bit, but it works perfectly!

echo “<td><a href=’venues/venue_a/venue_b.php’>” . $row['club_name'] . “</a></td>”;

Thank you!

 
0