Page 1 of 1

Passing Data with URLs

Posted: Thu Oct 17, 2002 3:26 am
by Bob.H
Hi,
I am new to php and I have a small problem. I have a database (mysql) driven webpage displaying events and meeting. Some of these events have websites and or pdf documents for extra information.

At the moment when I fill my webpage with all the data, I only see the flat text of the link/document:

if ($row["link"] != "")
echo "\n<tr>\n\t<td bgcolor=\"#FFFFCC\">" .
"<b>Link: </b>" .
$row["link"] .
"</td>\n</tr>";

I have tried various combinations of "<a href=\"$row["link"]"\">, but none seem to work.

I would also like to let my users upload and download pdf documents. How can I do this?

Any information would be most greatfully appreciated.

Bob. H. :oops

?>

Posted: Thu Oct 17, 2002 3:52 am
by twigletmac
You don't really explain what you mean by 'none seem to work' - do you get error messages, does anything display, does the link not work when you click on it - however, try something like this:

Code: Select all

if (!empty($row&#1111;'link'])) {
	echo '&lt;tr&gt;&lt;td bgcolor="#FFFFCC"&gt;';
	echo '&lt;b&gt;Link: &lt;/b&gt;';
	echo '&lt;a href="'.$row&#1111;'link'].'"&gt;Link Text&lt;/a&gt;';
	echo '&lt;/td&gt;&lt;/tr&gt;';
}
As for uploading files have a look at:
http://www.php.net/manual/en/features.file-upload.php

To enable people to download a PDF you just have to give a link to that PDF's location.

Mac

Posted: Thu Oct 17, 2002 3:53 am
by volka
try something like

Code: Select all

...
$query = ....
$result = mysql_query($query, $dbConn) or die(mysql_error());
while( $row = mysql_fetch_assoc($result) )
{
	...
	if (!empty($row&#1111;'link']))
		echo '&lt;tr&gt;&lt;td bgcolor="#FFFFCC"&gt;&lt;b&gt;Link: &lt;/b&gt;',$row&#1111;'link'], '&lt;/td&gt;&lt;/tr&gt;';
	...
}
...
edit: once again: too slow :?