Jump to content

DAcre

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

DAcre's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. http://www.dcs.napier.ac.uk/~05013885/EVERYTHING%20PRESENT%20NEED%20SESSIONS%20AND%20REMOVE-EDIT%20USERS/newspages/viewcomments.php?newsid=1 the 'newsid' is in the address bar there (as i put it there) When some one clicks submit! at the bottom of the page I want that newsid to be followed on to the next page in the address bar.
  2. oh wait, thats not a problem I want to make sure that I can just echo the values first before i write the stuff that'll use the variables within an INSERT query.
  3. woops look like i didn't remove my pasword and shit for the mysql its ok tho you first need to log into socweb1 with a different username and pass first. If anyones testing it, it wont work because the database server only accepts connections from within the university.
  4. $newsid = $_GET['newsid']; $query = "SELECT * FROM news JOIN members ON (news.newsAuthor=members.memberID) WHERE newsID='$newsid'"; $query2 = "SELECT * FROM comments JOIN members ON (comments.commentAuthor=members.memberID) WHERE newsID='$newsid'"; $result = mysql_query($query); $result2 = mysql_query($query2); while ($list = mysql_fetch_array($result)) { echo "<table width=\"500\">"; echo "<tr>"; echo "<th>DateTime</th>"; echo "<th>Author</th>"; echo "<th>Title</th>"; echo "</tr>"; echo "<tr>"; echo "<td>{$list['newsDateTime']}</td>"; echo "<td class=\"tdwidth\"><a href=\"..\memberpages\viewmember.php?memberID=$list[memberID]\">{$list['name']}</a></td>"; echo "<td>{$list['newsTitle']}</td>"; echo "</tr>"; echo "<tr>"; echo "<th colspan=\"3\">News Item</th>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=\"3\">{$list['newsItem']}</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=\"3\"><a href=\"viewcomments.php?newsid=$list[newsID]\">View Comments</a></td>"; echo "</tr>"; echo "</table>"; echo "<br/>"; } while ($list2 = mysql_Fetch_array($result2)) { echo "<table width=\"500\">"; echo "<tr>"; echo "<th>Comment From</th>"; echo "<th>Date/Time</th>"; echo "</tr>"; echo "<tr>"; echo "<td><a href=\"..\memberpages\viewmember.php?memberID=$list2[memberID]\">{$list2['name']}</a></td>"; echo "<td>{$list2['commentDateTime']}</td>"; echo "</tr>"; echo "<tr>"; echo "<th colspan=\"2\">Comment</th>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=\"2\">{$list2['comment']}</td>"; echo "</tr>"; echo "</table>"; echo "<br/>"; } include 'addnewscomment-form.php'; ?> Above GETS the memberID from a previous page fine. ----------------------- addnewscomment-form.php <?php session_start();?> <form action="addnewscomment-process.php" method="post"> <p> <label for="newscomment">Comment On This News Item:</label><br/><br/> <textarea rows="5" cols="30" name="newscomment" id="newscomment"></textarea> </p> <p> <input type="submit" value="submit" name="submit"/> </p> </form> the process form - adds stuff to the db <?php mysql_connect('socweb1.napier.ac.uk', 'a5013885', '3ball'); $db_selected = mysql_select_db('a5013885'); if (!$db_selected) { die('Can\'t use a5013885 : ' . mysql_error()); } if (!empty($_POST['newscomment'])){ $newscomment = $_POST['newscomment']; } echo $newscomment; mysql_query($query) or die('Insert Failed - Probably dodgy coding at the mo.'); echo "<p>News comment added!</p><br/>"; echo "<p>Click <a href=\"index.php\">Here</a> to return to the main page</p>"; ?> I'm echoing $newscomment to make sure it goes across (it does). I want to chuck the $memberID through too so I can add it to the database table comments under a field called commentAuthor. Any help would be appreciated as this problem is throwing me out a few times in similar situations. Then thats me finished apart from one other problem. A session problem but i'm gonna go ask Andrew Cumming in the morning (work doesn't have to be in till 3 pm) about that. Thank youuuuuu xx
  5. Second year university student in Edinburgh. Got a piece of PHP work due in for web technologies tommorrow. http://www.dcs.napier.ac.uk/~05013885/TEST/viewmember.php?memberID=2 Click submit and you'll discover the problem. The page isn't valid so it displays the error class from my validationfunctions file. its the memberID variable not being passed over again? Is there anyway to stop this I've been working my ass off to to do this. Had 10 weeks to do it and I started a couple of days ago Thanks in advance!
×
×
  • 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.