KitCarl Posted May 4, 2010 Share Posted May 4, 2010 I created weather links by hand for several zipcodes like this and put them in a column in the database, but that seems to be poor use of the database <a href="http://www.weather.com/weather/tenday/07461" target="_blank"> Weather</a> I would like have a self generating link using the zipcode column from the database and here is the code from the already created zip table cell ".$row["clubZipcode"]." Can someone please show me how to combine them? I can't seem to figure out all the " "'s and //'s. Link to comment https://forums.phpfreaks.com/topic/200630-use-a-zipcode-from-database-to-fill-in-link-to-weather-report/ Share on other sites More sharing options...
Presto-X Posted May 4, 2010 Share Posted May 4, 2010 Hey Carl, can you post a bit more of your code so we can see what's going on. Link to comment https://forums.phpfreaks.com/topic/200630-use-a-zipcode-from-database-to-fill-in-link-to-weather-report/#findComment-1052833 Share on other sites More sharing options...
Zane Posted May 4, 2010 Share Posted May 4, 2010 echo ' Weather'; Link to comment https://forums.phpfreaks.com/topic/200630-use-a-zipcode-from-database-to-fill-in-link-to-weather-report/#findComment-1052835 Share on other sites More sharing options...
KitCarl Posted May 4, 2010 Author Share Posted May 4, 2010 I tried a simple cut & paste with Zanus' code but I doesn't work as I used it. It works separately when tested so I know it is the implementation not the code Here is the complete code which will probably make it easier to figure out. $sql = "SELECT * FROM BeagleClub AS B, ClubOrganization AS C, Association AS A WHERE B.clubID = C.clubID AND C.organizationID = A.associationID AND C.organizationID = '1' ORDER BY B.clubName"; // Database Query $result = mysql_query("$sql") or die(mysql_error()); // Database Query result $num_rows = mysql_num_rows($result) or die(mysql_error()); echo "<h3 align='center'>There are $num_rows IBGA clubs\n</h3>"; // Starts the table echo "<table bgcolor=#0469B3 border=0 cellpadding=10 cellspacing=0 align='center' font-size=10px;>\n <tr> <th>Club Name</th> <th>Website</th> <th>Street Address</th> <th>City</th> <th>State</th> <th>Zipcode</th> <th>GPS Lattitude</th> <th>GPS Longitude</th> <th>Weather Forcast</th> </tr>"; // Create the contents of the table. for( $i = 0; $i < $row = mysql_fetch_array($result); $i++){ echo "<TR>\n" ."<TD bgcolor=".row_color($i).">".$row["clubName"]."</TD>\n" ."<TD bgcolor=".row_color($i).">".$row["website"]."</TD>\n" ."<TD bgcolor=".row_color($i).">".$row["clubAddress"]."</TD>\n" ."<TD bgcolor=".row_color($i).">".$row["clubCity"]."</TD>\n" ."<TD bgcolor=".row_color($i).">".$row["clubState"]."</TD>\n" ."<TD bgcolor=".row_color($i).">".$row["clubZipcode"]."</TD>\n" ."<TD bgcolor=".row_color($i).">".$row["clubLattitude"]."</TD>\n" ."<TD bgcolor=".row_color($i).">".$row["clubLongitude"]."</TD>\n" ."<TD bgcolor=".row_color($i).">".$row["clubWeather"]."</TD>\n" ."</TR>"; } echo "</TABLE>"; mysql_close($connection); ?> When I changed the last <TD> line to ."<TD bgcolor=".row_color($i).">'<a href="http://www.weather.com/weather/tenday/' .$row["clubZipcode"]. '" target="_blank"> Weather</a>';</TD>\n" This is the error message: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/beagle5/public_html/ibgany.org/ibga_club_list.php on line 145 Hoping to learn best practices not just have passable code so critics on all the code happily accepted. Link to comment https://forums.phpfreaks.com/topic/200630-use-a-zipcode-from-database-to-fill-in-link-to-weather-report/#findComment-1053025 Share on other sites More sharing options...
KitCarl Posted May 7, 2010 Author Share Posted May 7, 2010 I tried working with the " and \ but can't get it right. Anyone? Link to comment https://forums.phpfreaks.com/topic/200630-use-a-zipcode-from-database-to-fill-in-link-to-weather-report/#findComment-1054410 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.