35 pts.
 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.

Software/Hardware used:
ASKED: June 19, 2008  10:43 PM
UPDATED: June 21, 2008  7:07 PM

Answer Wiki:
# 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 Wiki Answer Submitted:  June 20, 2008  12:41 pm  by  Shawngo   25 pts.
All Answer Wiki Contributors:  Shawngo   25 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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.

 35 pts.

 

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

 35 pts.

 

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

 25 pts.

 

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!

 35 pts.