WAMFT1 Posted January 14, 2013 Share Posted January 14, 2013 I am wanting my php page to load with content pulled from an existing mysql database. I am wanting to use multiple fields to create a href link. Can anybony help me. Here is the script using to collect and sort data. I am wanting to replace the XXXXX with the field name doctype, batch, and branch with underscores between each field. I am not sure how to get this to work if at all. $result=mysql_query("SELECT * FROM comm_statement WHERE paycode = 'PAYJBARR'"); while($test = mysql_fetch_array($result)) { $id = $test['id']; echo "<tr align='left'><font size='-2' face='Arial, Helvetica, sans-serif'>"; echo"<td>". $test['date']. "</td>"; echo"<td>" .$test['batch']."</td>"; echo"<td>" .$test['advisercode']."</td>"; echo"<td>" .$test['doctype']."</td>"; echo"<td><a href ='../../documents/advisers/DMS/XXXXX'>download</a>"; Quote Link to comment https://forums.phpfreaks.com/topic/273129-using-mysql-field-in-a-href-using-php-echo/ Share on other sites More sharing options...
Dharmender Posted January 14, 2013 Share Posted January 14, 2013 You can save the value of doctype in variable and use it or you can directly use it $result=mysql_query("SELECT * FROM comm_statement WHERE paycode = 'PAYJBARR'"); while($test = mysql_fetch_array($result)) { $id = $test['id']; $doctype=$test['doctype']; echo "<tr align='left'><font size='-2' face='Arial, Helvetica, sans-serif'>"; echo"<td>". $test['date']. "</td>"; echo"<td>" .$test['batch']."</td>"; echo"<td>" .$test['advisercode']."</td>"; echo"<td>" .$doctype."</td>"; echo"<td><a href ='../../documents/advisers/DMS/$doctype'>download</a>"; Quote Link to comment https://forums.phpfreaks.com/topic/273129-using-mysql-field-in-a-href-using-php-echo/#findComment-1405523 Share on other sites More sharing options...
WAMFT1 Posted February 25, 2013 Author Share Posted February 25, 2013 Sorry for the delay, thanks that has helped heaps. Quote Link to comment https://forums.phpfreaks.com/topic/273129-using-mysql-field-in-a-href-using-php-echo/#findComment-1414785 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.