I've got a database where i save logs from IRC channels.
I have created a field called "name" for each log. And I know how to make the names into a link. But then I'm stuck, 'cause I don't know the easiest way to display the logs. One on each page that is. I mean, you click on the link and tadaa the log's displayed.
To me it doesn't make any sense to manually code each page for the logs.
So how's the way to make this as smooth as possible?
//Magnus
the script is placed in the root dir on http://localhost
and the links to all logs show up, but when I click on any of the links there's an url like http://localhost/test.php?ID=1 showed in the browsers adress win. and on the page the links are reloaded, not the log with an ID set to 1.
I suppose I have to echo the $text var on the page loaded, how's that done?
$sql="select * from logs where ID = '$id'";
$result=MySQL_query($sql,$db);
while($myrow=MySQL_fetch_array($result));
{
$logtext=$myrow["text"];
echo "$logtext";
}
?>
I don't get any parse error neither a mysql error msg.
And yes, I have checked for misspelling.
But still the last page's totally blank.
What am I doing wrong?
You could create a file which is set up to display one set of informaion or row onto a html file.
So if you was to send the id number through a query. the recieving file could get the data from that row then display it.
<?php
// check for query
if ($id){
// Connect to database
$dbcnx = @mysql_connect("database stuff");
if (!$dbcnx) {
echo( " <P>Unable to connect to the server at this time.</P>" );
echo("<br></body></html>");
exit();
}
// Select the database
if (! @mysql_select_db("indiepop2000")){
echo( " <P>Unable to locate the database.</P>" );
echo("<br></body></html>");
exit();
}
// Request the search
$result = mysql_query("SELECT * FROM Logs WHERE ID LIKE '$id'");
if (!$result) {
echo("<br><P>Error performing query: " . mysql_error() . "</P><br>");
echo("<br></body></html>");
exit();
}
Bookmarks