Jump to content

Recommended Posts

I have a mySQL database. Version 5.0.

I have a table that is generated dynaically, this works fine.

In the table I have the following fields

 

RestName, Address, Phone, Price, Rating

 

This is the table where the webpage name lies for each restaurant.

 

tblRestaurants

RestID 1

RestName Red Place

RestPage Red_Place.php

 

I am storing a webpage in the RestPage field.

 

When I click on the RestName field in the table I want the webpage stored in the RestPAge field to come up. Needless to say I need a variable because you never know which restaurant will appear in the table.

 

I have this so far...

 

<td><a href='$row[$RestPage]$RestID=RestID'>$row[RestName]</a></td>

 

but it doesn't seem to be working. I'm new to this so..........I need some direction here. Thank you.

Link to comment
https://forums.phpfreaks.com/topic/273932-href-link-variable/
Share on other sites

The link shows in the table, but the page doesn't come up. You can see the working (used loosely) example at...

http://www.menuhead....eelers/Head.php

Then Select City, Boston,Back Bay,American(New) SEARCH

Then click on 28 degrees.

The link goes nowhere.

 

Here is the mySQL query/php that the table is being built with.

 

<?php
include("config.php");
if(!$rs = mysql_query("SELECT tblRestaurants.RestName, tblLocations.CityID,
tblLocations.AreaID, tblLocations.CuisineID,tblLocations.RestID,
CONCAT(tblLocations.StreetNumber,' ', tblLocations.Street) Address,
tblLocations.Phone, tblDetails.Price, tblDetails.Rating
FROM tblRestaurants INNER JOIN (tblLocations LEFT JOIN tblDetails
ON tblLocations.LocationID = tblDetails.LocationID)	
ON tblRestaurants.RestID = tblLocations.RestID
WHERE tblLocations.CityID='$Doggie'
AND tblLocations.AreaID='$Kitty'
AND tblLocations.CuisineID='$Pig'
ORDER BY tblRestaurants.RestName ASC")) {
echo "Cannot parse query";
}
elseif(mysql_num_rows($rs) == 0) {
echo "No records found";
}
else {
echo "<table id=\"myTable\" table width=\"720\" class=\"tablesorter\" align=\"Left\" cellspacing=\"0\">\n";
echo "<thead>\n<tr>";
echo "<th>PLACE</th>";
echo "<th>ADDRESS</th>";
echo "<th>PHONE</th>";
echo "<th>PRICE</th>";
echo "<th>RATING</th>";
echo "</tr>\n</thead>\n";
while($row = mysql_fetch_array($rs)) {
echo"<tr>
<td><a href='$row[$RestPage]$RestID=RestID'>$row[RestName]</a></td>
<td>$row[Address]</td>
<td>$row[Phone]</td>
<td>$row[Price]</td>
<td>$row[Rating]</td>
</tr>\n";
}
echo "</table><br />\n";
}
?>

Edited by DSTR3
Link to comment
https://forums.phpfreaks.com/topic/273932-href-link-variable/#findComment-1409624
Share on other sites

Thank you. I did that and now I am getting webpage not found. In storing these pages in the table in the mySQL database, is there a certain way this should be done? Right now its just 28_Degrees.php Is this correct? Its saying this in the address bar...

 

http://www.menuhead.net/Steelers/=RestID

Edited by DSTR3
Link to comment
https://forums.phpfreaks.com/topic/273932-href-link-variable/#findComment-1409629
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.