Jump to content

benji87

Members
  • Posts

    136
  • Joined

  • Last visited

    Never

Everything posted by benji87

  1. That worked great! Only trouble is it doesnt retrieve the message data for some reason it fills the text box with 'Resource id #3' anybody know what that came out of?? Thanks
  2. Can someone please help?
  3. Ok that last post made it alot easier to understand so thanks! Ive tried it and i keep getting a unexpected $ parse error on line 28. Im guessing this is something to do with it not picking up the id variable but im probably totally wrong! [code]<?   if (isset($_GET['action'])) {     switch ($_GET['action']) {       case 'edit':          require_once('db.php'); $query=("SELECT message FROM postapproval WHERE id = '{$_GET['id']}'"); $message=mysql_query($query); mysql_close(); ?> <body> <form name="" method="post" action=""> <textarea name="textarea"><? echo "$message" ?></textarea> </form> </body> </html> [/code] Thanks
  4. Ok that worked fine thanks! Now i dont understand the actions.php I dont have a clue what code i need to use with that snipet that was provided. Obviously i want a a text box with the article text in it so the admin can just edit it then submit it to update which is easy enough but will i need a seperate php file to do that?
  5. [code]<? require_once('db.php'); $query=("SELECT * FROM postapproval ORDER BY id DESC"); $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); $poster=mysql_result($result,$i,"poster"); $message=mysql_result($result,$i,"message"); $title=mysql_result($result,$i,"title"); $date=mysql_result($result,$i,"date"); $time=mysql_result($result,$i,"time"); $dellink=mysql_result($result,$i,"dellink"); ?> <body> <table width="71%" border="0" cellspacing="1" cellpadding="1">   <tr>     <td width="18%"><? echo"$date" | "$time" ?></td>     <td width="53%"><? echo "$title" ?></td>     <td width="4%"><? $id = row['id'];     echo "<a href='actions.php?action=edit&id=$id'><img src='editbutton.jpg'></a>" ?></td>     <td width="20%"></td>     <td width="23%"></td>   </tr> </table> </body> <? $i++; } ?>[/code] the bit in question is $id = row['id']
  6. I get this error when trying to execute the display page: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Parse error: parse error, unexpected '[' in /homepages/33/d69713911/htdocs/webs/examples/post/display.php on line 35 [/quote]
  7. Ok that makes perfect sense. But when the admin logs in i want them to have options next to the title of the articles waiting to be published. Like so: DATE | TITLE | ___________________________________________________________________ 12/05/06 New times ahead | EDIT | | DELETE | | APPROVE | ___________________________________________________________________ 23/06/06 Launch day | EDIT | | DELETE | | APPROVE | This would be how the data called from the database would be shown with next to each title the three buttons if the user decides that the article is not suitable then they would click delete. How do i make it so it knows that i want to delete that article on that line? the same with edit and approve. Also how would i display the buttons would i base the img url in the database or stick them in html?
  8. Hi all. Im currently trying to develop a posts approval system where an administrator has to approve the post before it is published live onto the web. This includes the option to edit, delete and publish the article etc. What i had in mind was a list of posts pending to be approved displayed when the admin logs in drawn from an sql database but i then want them to be able to click a button next to the title of the article for whatever action they wish to take. Ive thought alot about this idea and cant see a logical way of doing it with PHP. Ive done some research and it seems the only way to do this kind of thing is by using ASP. I have no knowledge of ASP what so ever so i dont know if its the right solution or not? If there is a way of doing this kind of thing using PHP then id love to know!! If not can someone confirm that ASP is the way forward for me...? Thanks
  9. Thanks that code worked great! But there is still one problem! Ive used the same method for the text that appears next to the image that welcomes the user but if you go onto my site and you are not logged in then the code wont skip to the else statement because im guessing it cant find the session variable. So how am i meant to get it to display the else statement without registering the varibles first? As my varibles are registered in the login process... Here is my code below: user image code: [code]<?php session_start(); if($_SESSION['loggedin'] == 0)        echo $_SESSION['userimg']; else        echo '<img src=/userimgs/user.gif>'; ?>[/code] user text code: [code]<?php session_start(); if($_SESSION['loggedin'] == 0)        echo "Welcome ". $_SESSION['username'] ."<br>You are logged in.<br />"; else        echo "Please login or register"; ?>[/code] heres my website: [a href=\"http://www.bubblebox-design.co.uk\" target=\"_blank\"]Studio2310[/a]
  10. Hey all. Im currently working on a user section for my new site and im trying to define a user image using sessions but im having a little problem and dont know what to do next. Here is my code so far: [b]checkuser.php (registering variable):[/b] session_register('loggedin'); $_SESSION['loggedin'] = 0; [b]login_success.php:[/b] <? if(loggedin == 0){ echo '<img src=/userimgs/ben.gif>'; } else { echo '<img src=/userimgs/standard.gif>'; } ?> With the if statement i want to draw the users image url from the database if they are logged in but im not sure how to go about that i did try: $query("SELECT userimg FROM mydatabase WHERE username='username'") $result=mysql_query($query); But i had no luck with that. So i used the image source above just to test to see if the image would not appear if i was not logged in. But it appears even if im not logged in! I hope someone can guide me in the right direction coz i think im heading that way, i hope!
×
×
  • 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.