I'm trying to grab a value from a mySQL database and put that value on the end of a url path

e.g. http://url.com/$valuefromdb

Is there any tutorials to how to do this or can anybody recommend how to tackle this?

Kind Regards


JayJ

I've tried various things now to attempt to get this to work - all to no avail.

My current is

// Define variables
$filename = mysql_query("SELECT log_filename FROM uploads_log");
$issueno = mysql_query("SELECT log_issue FROM uploads_log");
$issuemonth = mysql_query("SELECT log_month FROM uploads_log");

print "<a href=www.url/uploads/$filename><?php echo Issue $issueno.", ".$issuemonth; ?></a>";
<?php

$xconn =mysql_pconnect("localhost","username","userpassword") or die("unable to connect to dbengine".mysql_error());// assuming a connection to mysql db
$qry = "select field from table" ; //your sql statement


$exec_qry = mysql_query($qry) or die ("query failed".mysql_query());

$pulling =  mysql_fetch_array( $exec_qry,MYSQL_ASSOC);

foreach($pulling as $valuefromdb);
printf('%s','<a href="targetlink.ext". "?parameter= ". $valuefromdb . " '  ) ;

mysql_close($xconn);

?>

I hope this helps, Goodluck.

Thanks.

I've tried that and got the following errors:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in table2.php on line 7

Warning: Invalid argument supplied for foreach() in table2.php on line 9

Hi...
Try this....

<?php

// Define variables
$result1 = mysql_query("SELECT log_filename FROM uploads_log");
$filename = mysql_fetch_array($result1);
$result2 = mysql_query("SELECT log_issue FROM uploads_log");
$issueno = mysql_fetch_array($result2);
$result3 = mysql_query("SELECT log_month FROM uploads_log");
$issuemonth = mysql_fetch_array($result3);

print "<a href='www.url/uploads/".$filename."'>Issue ".$issueno.", ".$issuemonth."</a>"; 

?>
This question has already been answered. Start a new discussion instead.