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>";
Using mysql field in a href using php echo
Started by WAMFT1, Jan 14 2013 03:12 AM
2 replies to this topic
#1
Posted 14 January 2013 - 03:12 AM
#2
Posted 14 January 2013 - 03:19 AM
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>";
$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>";
#3
Posted 25 February 2013 - 02:57 AM
Sorry for the delay, thanks that has helped heaps.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











