PDA

View Full Version : Need PHP Script! [+Rep]



Decode
07-01-2008, 08:27 PM
Please could someone make/find a link to a script like this;

you go to a page eg- www.mysite.com/page.html?message=1 (http://www.mysite.com/page.html?message=1)
and it displays message 1

and on the same page you can go to www.mysite.com/page.html?message=2 (http://www.mysite.com/page.html?message=2) and it displays message 2

+Rep for link to script or make one

Thanks,
Tom

[Oli]
07-01-2008, 08:58 PM
Wouldn't it be page.php?message=1 ?

Anyway, do you want the message system along with it ?
Otherwise I guesse it's just:

page.php (first bit)



/*
make sure you're connected to your databases right.
ex. include("config.php"); etc
*/

$sql = mysql_query("SELECT * FROM databasename WHERE id = '$_GET["message"]'");
$msg = mysql_fetch_array($sql);


Second bit (to display message)



if($_GET["message"] == NULL){
/*
In this case the link would look like
page.php or page.php?message=
*/
echo("
No message selected
");
}else{
/*
Here the link would be page.php?message=1 (or any other number)
*/

/*
Depending on which rows you've got you display the message, as example i'll use
- author
- title
- message
*/

echo("
Message from ".$msg[author].",<br />
Title: ".$msg[title]."<br />
<br />
Message<br />
".$msg[message]."
");
}


(Sorry if I made some mistakes but that's what I think it would be (atm) )

Decode
07-01-2008, 09:03 PM
Thanks Oli +Rep :)

Verrou
07-01-2008, 09:14 PM
If you looked, there is a really good tutorial on it in the tutorials section. That is if the above doesn't work :D

Want to hide these adverts? Register an account for free!