Quick Help for Newbie
Posted: Thu Jan 16, 2003 6:40 pm
I am new to PHP and need some help. I am accessing a MySQL database to pull in text inside a flash file. The text has to be formatted a particular way (as you will see below). I have a PHP page with the following code:
When viewing the page via Internet Explorer, it reads:
How would this code look? (using the code of the first page)
Code: Select all
<?php
@mysql_connect("www.website.com", "user", "pass") or die("could connect to server");
@mysql_select_db( "databaseName") or die("couldn't select db");
$query = mysql_query("select * from tableName where id='$_REQUESTїid]' ");
while ($row = mysql_fetch_array($query)) {
$pagetext1=$rowї"title"];
$pagetext=$rowї"content"];
$pagetext2=$rowї"link"];
}
echo "vartxt=<b>{$pagetext1}</b><br><br>{$pagetext}<br><br><b>{$pagetext2}";
?>What I need is a similar page which queries the database and gathers the text in the TITLE field and LINK field that have the same ID which is the variable passed by the prior link. And then displays them (echo) like this:vartxt=A bunch of text pulled from the database
And it should be a hyperlink. The text for the "Title 1" is pulled from the TITLE field while the URL for the hyperlink is pulled from the LINK field of that same record.title=Title 1
How would this code look? (using the code of the first page)