• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

fwrite

PHP:
<?
if(!empty($_GET['Category']))
{

$category = $_GET['Category'];

if(!empty($_GET['Poem'])) $poem_id = $_GET['Poem'];
else $poem_id = 1;
$query = "select * from" . $category . "where id='$poem_id' limit 1";
$result = mysql_query($query) or die(mysql_error());
// check to see if this poem actually exists
if(!num = mysql_num_rows($result)) die('Error message when there is no poem with that cat or id');

// if it does
while($row = mysql_fetch_assoc($result))
{

$author = $row['author'];
$email = $row['email'];
$title  = $row['title'];
$poem = $row['poem'];
$comment = $row['comment'];

##
##Insert the poem output here
##

}
$next_poem = poem_id + 1;
if($poem_id < 1) $prev_poem = 1;
else $prev_poem = $poem_id - 1;

?>
<a href ="Poem.php?Category=<? echo $category; ?>&Poem=<? echo $prev_poem; ?>">Previous</a>
<a href ="Poem.php?Category=<? echo $category; ?>&Poem=<? echo $next_poem; ?>">Next</a>
<?
}
else
{
##
## Put here what you want to happen if no category is selected.
##

}

Remember I cant test any of this so do some error checking, and do with it what you like.
 
Big ol Thanks would do. If you want to paypal me a new car or maybe some mail order brides my email is spectral2k###hotmail.com
 
last few questions :)


When I add poems, this one for example:
Code:
Happy birthday, darling!
Even though you're not with me.
Right now you're with someone else
Temporarily. 

I know I am the wild cat
Who'll get you in the end,
Not only your hot lover, but
Your best and truest friend. 

So have a happy birthday
And remember my sweet kiss.
It's waiting for you when you turn
To me, your fated bliss.
It gets displayed like that:
Code:
Happy birthday, darling! Even though you're not with me. Right now you're with someone else Temporarily. I know I am the wild cat Who'll get you in the end, Not only your hot lover, but Your best and truest friend. So have a happy birthday And remember my sweet kiss. It's waiting for you when you turn To me, your fated bliss.
I'd need to make the submit script put a <br> at the end of each line. and <br><br> when there is an empty line.



"SELECT * from Love ORDER by id ASC"
How can I search from all the tables?
"SELECT * from * ORDER by id ASC" dosnt work.


Also for the score thingy.
Since each poem has an ID, and Score field, I'd like to be able to update the content of the score field.

something like that is ok?
Code:
$id=$_GET['id'];
$num=$_GET['num'];
$current=$_GET['current'];
$score=($current+$num)

$db = mysql_connect("localhost", "wojtek_poems", "password");
mysql_select_db("wojtek_poems", $db) or die(mysql_errno() . ": " . mysql_error() . "<br>");

$sql = 'UPDATE `Love` SET `Score` = \'$score\' WHERE `id` = \'$id\' LIMIT 1 ;
$result = $nav->execute($sql, $db, "mysql");
Sorry I cant paypal you a new car :)
 
for adding <BR> try this:

PHP:
<?

....

if(!empty($_GET['Category'])) $cat = $_GET['Category']; 
if(!empty($_GET['Poem'])) $poem =  $_GET['Poem'];
//add this line 
$poem = preg_replace( "/\n/", "<br>", $poem);
if(!empty($_GET['Comment'])) $comment = $_GET['Comment'];  

...

?>
 
Back
Top