URL link in PHP/MySQL script

35 pts.
Tags:
MySQL
PHP
Table Functions
URL
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.

Answer Wiki

Thanks. We'll let you know when a new response is added.

# 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

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Jviney
    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 pointsBadges:
    report
  • Jviney
    Thank you for your help Shawn, however, I'm still confused!
    35 pointsBadges:
    report
  • Shawngo
    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 pointsBadges:
    report
  • Jviney
    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 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following