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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 1 month later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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