Jump to content

Using mysql field in a href using php echo


WAMFT1

Recommended Posts

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>";

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>";

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.