kyleldi Posted August 1, 2007 Share Posted August 1, 2007 I'm attempting to turn the results of a query into urls, yet I keep getting this error, "Parse error: syntax error, unexpected '<' in staff.php on line 190." I've coded and recoded this, yet for some reason I cannot get this error to go away. I know it's probably simple, but what am I missing? - Kyle <table border="0" align="center" class="results"> <?php do { ?> <tr> <td><?php echo <a href="department.php?dept=$row_rs_departments['Department_Title']"$row_rs_departments['Department_Title']</a>; ?></td> </tr> <?php } while ($row_rs_departments = mysql_fetch_assoc($rs_departments)); ?> </table> Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/ Share on other sites More sharing options...
jbrill Posted August 1, 2007 Share Posted August 1, 2007 try this <table border="0" align="center" class="results"> <?php do { echo "<tr>"; echo "<td>"; echo "<a href="department.php?dept=$row_rs_departments['Department_Title']"$row_rs_departments['Department_Title']</a>"; echo "</td>"; echo "</tr>"; } while ($row_rs_departments = mysql_fetch_assoc($rs_departments)); ?> </table> Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/#findComment-313100 Share on other sites More sharing options...
kyleldi Posted August 1, 2007 Author Share Posted August 1, 2007 Different error this time, so apparently one thing is cleared up "Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in staff.php on line 192". I don't see any semi-colins that are astray nor missing... Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/#findComment-313110 Share on other sites More sharing options...
jbrill Posted August 1, 2007 Share Posted August 1, 2007 oops, my bad: <table border="0" align="center" class="results"> <?php do { echo "<tr>"; echo "<td>"; echo "<a href=\"department.php?dept=$row_rs_departments['Department_Title']\">$row_rs_departments['Department_Title']</a>"; echo "</td>"; echo "</tr>"; } while ($row_rs_departments = mysql_fetch_assoc($rs_departments)); ?> </table> try that Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/#findComment-313112 Share on other sites More sharing options...
kyleldi Posted August 1, 2007 Author Share Posted August 1, 2007 Seems to have taken care of that error, but it seems to hang at about the same place with this error. Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in staff.php on line 190 <?php echo "<a href=\"department.php?dept=$row_rs_departments['Department_Title']\">$row_rs_departments['Department_Title']</a>"; ?> That's the line it hangs on Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/#findComment-313123 Share on other sites More sharing options...
jbrill Posted August 1, 2007 Share Posted August 1, 2007 k try this: echo "<a href=\"department.php?dept=".$row_rs_departments['Department_Title']."\">$row_rs_departments['Department_Title']</a>"; Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/#findComment-313137 Share on other sites More sharing options...
kyleldi Posted August 1, 2007 Author Share Posted August 1, 2007 Unfortunately, same error on the same line. Here's the code again just for us to stair at. I've tried a bunch of different combinations to no avail. <?php do { echo "<tr>"; echo "<td>"; echo "<a href=\"department.php?dept=".$row_rs_departments['Department_Title']."\">$row_rs_departments['Department_Title'][/url]"; echo "</td>"; echo "</tr>"; } while ($row_rs_departments = mysql_fetch_assoc($rs_departments)); ?> Sorry to be such a pain Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/#findComment-313146 Share on other sites More sharing options...
jbrill Posted August 1, 2007 Share Posted August 1, 2007 yoes your link end in [/url] it needs to be </a> fix that and try this: echo "<a href=\"department.php?dept=".$row_rs_departments['Department_Title']."\">$row_rs_departments['Department_Title']</a>"; if that didnt work try this: echo "<a href=\"department.php?dept=".$row_rs_departments['Department_Title']."\">".$row_rs_departments['Department_Title']."</a>"; Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/#findComment-313158 Share on other sites More sharing options...
kyleldi Posted August 1, 2007 Author Share Posted August 1, 2007 The result when using the last code was this: Engineering[/url]Quotes[/url]Quotes[/url]Customer Service[/url] (it's supposed to be inline, minus the URL line It odly enough seems to put hyperlinks (proper ones) about half way down the page that are dashes. Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/#findComment-313177 Share on other sites More sharing options...
kyleldi Posted August 1, 2007 Author Share Posted August 1, 2007 I've got rid of the URL part in the links, but it's still putting the exact same hyperlink about half way down the page (in dashes). You can examine it here. http://www.lastingimpressionsbyken.com/kyle/staff.php Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/#findComment-313180 Share on other sites More sharing options...
jbrill Posted August 1, 2007 Share Posted August 1, 2007 i dont really understand how u want it to look, or what you are really trying to do. try explaining to me a bit more and i'll help you out. by the way, i noticed this site is for a machine company. I have just developed a job management program that organizes all the jobs being done in the shop, prints quotes, M&I's etc. don't know if it anything that would interest you but let meknow Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/#findComment-313193 Share on other sites More sharing options...
kyleldi Posted August 1, 2007 Author Share Posted August 1, 2007 There are just a bunch of little dashes created by the code that make additional urls on the bottom left hand side of the window that I need to get rid of. The page is just listing departments for a staff directory. The next page which I am working on will be a detailed list of every employee in that department, linking to a employee detail page for each employee.. It's just all entirely dynamic so we can update it easily- since we're constantly changing. Your program sounds interesting, right now we use a similar program called JobBoss. I hate its bulk, but its very versitle. Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/#findComment-313200 Share on other sites More sharing options...
jbrill Posted August 1, 2007 Share Posted August 1, 2007 send me the whole page's code, it will be much easier to look at and understand Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/#findComment-313212 Share on other sites More sharing options...
kyleldi Posted August 1, 2007 Author Share Posted August 1, 2007 Here ya go... <?php require_once('connect.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_staff, $staff); $query_rs_departments = "SELECT Department_Title FROM staffdirectory"; $rs_departments = mysql_query($query_rs_departments, $staff) or die(mysql_error()); $row_rs_departments = mysql_fetch_assoc($rs_departments); $totalRows_rs_departments = mysql_num_rows($rs_departments); if (isset($_GET['id'])) { //Page first accessed $id = $_GET['id']; } else { if (isset($_POST['id'])) { //form has been submit $id = $_POST['id']; } } ?>?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Staff Directory at Laser-Dynamics.com - Precision Laser Cutting and Metal Fabrication Job Shop Serving Grand Rapids, Detroit,and Surrounding Areas</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta name="keywords" content="Laser Cutting Laser Cut to Length Metal Fabrication Metal Cutting Robotic Welding Tube Laser Cutting Metal Fabrication Metal Brackets Sheet Metal Cutting Job Shop Tube Cutting Metal Tube Fabrication"> <meta name="description" content="Laser Dynamics is a full service laser cutting job shop that specializes in quality laser cut parts, metal fabrication, and more. Request a quote for more information and pricing. Fast turnaround."> <link href="style.css" rel="stylesheet" type="text/css"> <script language=javascript src=activateSF123.js></script> <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script> <style type="text/css"> <!-- .staffleft { height: 233px; width: 350px; border: 2px groove #FFFFFF; float: left; margin-top: 20px; margin-right: 2px; margin-bottom: 15px; margin-left: 25px; text-align: center; white-space: normal; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; font-style: normal; line-height: normal; font-weight: normal; font-variant: normal; text-transform: capitalize; text-decoration: none; color: #FFFFFF; padding: 3px; } .newblock { margin-top: 45px; margin-right: 15px; margin-bottom: 15px; margin-left: 15px; padding-top: 0px; padding-right: 0px; padding-bottom: 5px; padding-left: 0px; text-align: center; vertical-align: bottom; } .stafftable { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; color: #FFFFFF; margin: 0px; padding: 2px; } .staffright { padding: 3px; height: 233px; width: 550px; margin-top: 20px; margin-right: 105px; margin-bottom: 15px; margin-left: 105px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; color: #FFFFFF; } .staffcenter { padding: 3px; width: 600px; margin-top: 15px; margin-right: auto; margin-bottom: 15px; margin-left: auto; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: large; font-style: normal; line-height: normal; font-weight: bold; font-variant: normal; color: #FFFFFF; text-align: center; white-space: normal; text-transform: capitalize; } .stafftableheading { color: #FFFFFF; font-weight: bold; } --> </style> </head> <body> <table height="77%" border="0" align="left" cellpadding="0" cellspacing="0" style="height:100% "> <tr> <td width="766" height="495" valign="top" style="height:100% "> <table width="776" border="0" cellpadding="0" cellspacing="0" style="height:100% "> <tr> <td valign="top" width="1180" height="274" style=""> <div align="center" id="nav"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="766" height="227"> <param name="movie" value="flash/main.swf"> <param name="quality" value="high"> <param name="menu" value="false"> <param name="wmode" value="transparent"> <!--[if !IE]> <--> <object data="flash/main.swf" width="766" height="227" type="application/x-shockwave-flash"> <param name="quality" value="high"> <param name="menu" value="false"> <param name="wmode" value="transparent"> <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer"> FAIL (the browser should render some flash content, not this). </object> <!--> <![endif]--> </object> <script type="text/javascript" src="fixit.js"></script> <ul> <li><a href="laser-custom-tube-cutting.html">Tube Laser Cutting</a></li> <li><a href="flat-metal-laser-cutting.html">Flat Laser Cutting</a></li> <li><a href="cnc-turning.html">CNC Turning</a></li> <li><a href="metalfabrication.html">Metal Fabrication</a></li> <li><a href="multimedia.html">Video Library</a></li> <li><a href="about-us.html">About Us</a></li> <li><a href="our-clients.html">Clients</a></li> <li><a href="careers.html">Careers</a></li> <li><a href="http://www.laser-dynamics.com/forum/" target="_blank">Forum </a></li> <li><a href="contact-us.html">Contact Us</a></li> <li><a href="quote.html">Request A Quote</a></li> </ul> </div> </td> </tr> <tr> <td valign="top" width="1180" style="" class="content"> <div class="staffcenter"> Laser Dynamics, Inc. Staff Directory</div> <div class="staffright"> <div align="center"> <h3>Please Choose A Department<br> </h3> </div> <div class="results" id="results"> <?php do { echo "<a href=\"department.php?dept=".$row_rs_departments['Department_Title']."\">".$row_rs_departments['Department_Title']; } while ($row_rs_departments = mysql_fetch_assoc($rs_departments)); ?></div> </div> <p> </p> <p> </p> <p> </p> <p> </p> <div class="newblock"> <div align="center"></div> </div> </td> </tr> <tr> <td valign="top" width="1180" height="34" style="background-image:url(images/bottom.gif) " class="footer"><div style="margin:9 0 0 51px "><b><a href="terms.html">Terms of Use</a> |<a href="privacy.html"> Privacy Statement</a><a href="privacy.html"></a></b><img alt="" src="images/spacer.gif" width="314px" height="1px"> © 2007 Laser Dynamics, Inc. All rights reserved</div></td> </tr> </table> </td> </tr> </table> <script language="javascript">FlashSolver()</script> <!-- Start of StatCounter Code --> <script type="text/javascript"> var sc_project=2379861; var sc_invisible=0; var sc_partition=22; var sc_security="1e4169f8"; </script> <script type="text/javascript" src="http://www.statcounter.com/counter/counter_xhtml.js"></script> <noscript><div class="statcounter"><a class="statcounter" href="http://www.statcounter.com/"><img class="statcounter" src="http://c23.statcounter.com/2379861/0/1e4169f8/0/" alt="website stats" /></a></div></noscript> <!-- End of StatCounter Code --> </body> </html> <?php mysql_free_result($rs_departments); ?> Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/#findComment-313218 Share on other sites More sharing options...
kyleldi Posted August 1, 2007 Author Share Posted August 1, 2007 Apparently the other urls were from the returns I had in the page above the div... I took care of it now. Thank you very much for all your help! Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/#findComment-313220 Share on other sites More sharing options...
jbrill Posted August 1, 2007 Share Posted August 1, 2007 no problem! and if you or anyone else are interested in my program, designed specifically for the machine industry, please let me know! Quote Link to comment https://forums.phpfreaks.com/topic/62898-solved-displaying-mysql-results-as-urls/#findComment-313228 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.