Jump to content

razzle

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

razzle's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. managed it on my lonesome now guys cheers to everyone whos helped me particularly revraz
  2. please please please will someon help me im begging i think im right on the verge of getting it right but i just cant see whats gone wrong <?php include ('mysql_connect.php'); $query = "SELECT id, title, author, post, DATE_FORMAT(date, '%M %d, %Y') as sd FROM news_posts ORDER BY date DESC"; $result = @mysql_query($query); if ($result) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)); $num = $row['id']; $sql = mysql_query("SELECT id FROM comments WHERE id='$num'")or die(mysql_error()); $sql_num_rows = mysql_num_rows($sql); { $url = 'comments.php?id='.$row['id']; echo '<p align="center"><b>'.$row['title'].'</b><br /> '.$row['sd'].'<br /> Posted by : <b>'.$row['author'].'</b><br /> '.$row['post'].'</p><p span class="style2" align="right"> <a href="'.$url.'">Add new comment or view posted comments ('.$sql_num_rows.')</a></p><p span class="style1" align="center"><hr width="90%" /></p>' ; } } else { echo 'There are no news posts to display'; } ?> its not throwning up an error, but its not showing any of the articals, ironicly the mysql_num_rows function is working. can someone help me to get this to work all together
  3. ok i think i need to use the mysql_num_rows function can some one show me how to display the ammount of comments there are if you look at the post above you will see two coulombs we need to use id and nid where id is the id of the comment and nid is the id from an artical in a seperate news db i think i need something like this $sql = mysql_query("SELECT id, nid FROM comments WHERE id='$nid'")or die(mysql_error()); $sql_num_rows = mysql_num_rows($sql); echo "add new comment or read existing comments ($sql_num_rows)"; does this make sense to anyone, or does it need changing? many thanks
  4. do you think you can help me with this check the page im on about http://www.pushmusic.org/archive/news.php ok under every news post is a link to a comments page for each individual article how would i go about making this link dynamic ie it shows how many comments there are already? example - add new comments or read existing comments (3) as opposed to what i have now which is the above without the "(3)" the way my comments database is set us is like this CREATE TABLE comments ( id INT(11) NOT NULL AUTO_INCREMENT, nid INT(11) NOT NULL, title VARCHAR(70) NOT NULL, author VARCHAR(50) NOT NULL, comment TEXT NOT NULL, DATE DATETIME NOT NULL, PRIMARY KEY (id) ); where id is the comment id and nid is the id of the news article on a separate database here is the code on my news.php page <?php include ('mysql_connect.php'); $query = "SELECT id, title, author, post, DATE_FORMAT(date, '%M %d, %Y') as sd FROM news_posts"; $result = @mysql_query($query); if ($result) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $url = 'comments.php?id='.$row['id']; echo '<p><b>'.$row['title'].'</b><br /> '.$row['sd'].'<br /> Posted by : <b>'.$row['author'].'</b><br /> '.$row['post'].'<br /> <a href="javascript:openComments(\''.$url.'\')">Add new comment or view posted comments</a></p>'; } } else { echo 'There are no news posts to display'; } ?> now im sure i need to set a variable but what sort of function do i need your help would be greatly appritiated
  5. i just had the same problems on my site theres a tutorial on this site which is pretty good but i found it a little confusing being new to php as i am but i found a very straight foward one right here http://php.about.com/od/phpwithmysql/ss/php_pagination.htm good luck
  6. i did warn you that i was a newbie, haha i was thinking i should be pulling info from my php pages rather than the database itself im an idiot cheers mate
  7. ok i thin ig to the pagination sorted on my site can any one point me in the direction of a tutorial which will be able to place the latest news headline on my index page? ive searched in google but im not sure im using the right tearms to describe what i want can abyone help me?
  8. lol you already answered that question
  9. http://php.about.com/od/phpwithmysql/ss/php_pagination.htm is this what i need?
  10. so i could put $query = "SELECT id, title, author, post, DATE_FORMAT(date, '%M %d, %Y') as sd FROM news_posts" LIMIT 0, 10; as apposed to $query = "SELECT id, title, author, post, DATE_FORMAT(date, '%M %d, %Y') as sd FROM news_posts"; and that would give me only the latest 10 posts, ok so whats the best way of creating pages for the 10 posts before that? my minds telling me to create a new file called news2.php and use this line $query = "SELECT id, title, author, post, DATE_FORMAT(date, '%M %d, %Y') as sd FROM news_posts" LIMIT 10, 10; but then i would have to create loads of pages link that as my news archive grows, am i being a simpleton? or is the way its done?
  11. @revraz im sorry im a real novice ,where would i the code to limit the muber of articals? <html> <head> <script type="text/javascript"> function openComments(url) { comments = window.open(url, "Comment", "menubar=0,resizable=0,width=380,height=480") comments.focus() } </script> </head> <body> <?php include ('mysql_connect.php'); $query = "SELECT id, title, author, post, DATE_FORMAT(date, '%M %d, %Y') as sd FROM news_posts"; $result = @mysql_query($query); if ($result) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $url = 'comments.php?id='.$row['id']; echo '<p><b>'.$row['title'].'</b><br /> '.$row['sd'].'<br /> Posted by : <b>'.$row['author'].'</b><br /> '.$row['post'].'<br /> <a href="javascript:openComments(\''.$url.'\')">Add new comment or view posted comments</a></p>'; } } else { echo 'There are no news posts to display'; } ?> </body> </html> can you show me how i would do it? and @PhREEEk do you mean did I pay or will I pay? cos i haven't really got the capital to pay someone to sort it for me, would be nice if i did though
  12. ok guys im not going to pretend im good with php so let me cut to the chase i used this tutorial to create a news page with comments, but there are some things id like to change or tweek about how it works. here is the tutorial http://www.tutorialcode.com/php/news-system-with-comments/ ive got my working version of it on my site www.pushmusic.org or here is the direct link http://www.pushmusic.org/archive/news.php ok so ....... i want to make the news page display only the latest 10 articals, and perhaps have a series of pages for previous news each displaying 10 posts, do you know what i mean? id also like a way of deleting or editing the comments posted by readers just in case someone writes something offensive. and if someones feeling really creative.... id like to be able to display the title of the latest news artical on my main page, at the moment my main page just displays a link to the news, id like that to display the latest news artical. any help would be greatly appritaited many thanks ben (please excuse my spelling mistakes)
  13. you are a top man
  14. well really a point in the right direction basically im trying to implement a new function on my site my site is the base for my podcast, and i archive all my shows on individual pages within the site check out my site http://www.pushmusic.org and click the archive tab to see what i mean now what i really need is a form so that people can leave feedback on that page about that particular podcast, and i want it to be displayed on the page too, similar to a forum style post i suppose. now ive looked about for some tutorials and guides but i have no idea what this is called can someone tell me / show me how its done? many thanks ben
  15. mate i found an email form thing that worked here i suggest you just use this, its basic but it works http://www.thesitewizard.com/wizards/feedbackform.shtml
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.