Jump to content

ibab

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Everything posted by ibab

  1. Could you give me an example of how to do this?
  2. I've been trying to go around with str_replace to replace numbers with words. I have a database which has table actions. The actions are saved in numbers from 0 to 20. I'd need to get something to replace the numbers with words to explain what actions these are. I've tried using this. $action1 = str_replace("5", "Command", "action1"); But that doesn't work. Not even 100% sure if that is even correct, because I am new to the str_replace thing anyway. Could someone help me with this, please?
  3. It always was ID, never id, well, only when you told me to try out that, but after that I changed it back to ID. And yeah, its working now and thats the main thing. Thanks a lot.
  4. I'm just wondering, because in PHPMyAdmin I've setted it as ID, not id. So basically, it should be view.php?ID=2, right? EDIT: Finally! I just changed the view.php?id= to view.php?ID= and it worked. Thank you for everyone who helped me, especially .Stealth and Maq.
  5. When I click on the link, it takes me to this site. http://localhost/news/view.php?id=2 It adds the right id there.
  6. Currently only errors I get is in view.php. Notice: Undefined variable: ID in C:\WWW\xampp\htdocs\news\view.php on line 7 Stealth, yes, I tried changing it, still the same.
  7. It says this about the $_GET['ID']. Notice: Undefined index: ID in C:\WWW\xampp\htdocs\news\view.php on line 7 When I took it off and edited it to look like this. "SELECT * FROM news WHERE ID = '$ID'" It gave the same error. Notice: Undefined index: ID in C:\WWW\xampp\htdocs\news\view.php on line 7 (Here its the same line because the $_GET['ID'] is right on top of the SELECT thingy)
  8. Sorry for the double post, but the edit button just was not appearing in my newest post. I just found this one from the "Beta Testing" section of this forum. What I am trying to do, is something like this. http://www.hssz.net/sz/?catId=7 Its not exactly like it, but a bit editing would probably make it to be what I am trying to do. Basically, it has the Subject which is link to the main content related to the Subject.
  9. I added those and it gave error of those $_GET and $_POST, I took them off and it didn't give error anymore, but the site was still blank.
  10. Changing that shouldn't give it any effect, only that it searches for id which it never founds, because in MySQL its ID, not id. I think the whole script is wrong.
  11. There was .$row['id']. but its .$row['ID']. Oh well, still nothing. It does add this "view.php?id=" but it haven't helped yet. I don't know, but somewhy it doesn't get the id for the post into the url like it probably should, right? EDIT: Well, I took from the link the one " which was not supposed to be there, and now it gets the post ID into the link. view.php?id=2 But it still shows just a blank site.
  12. Theres no form actually, I didn't know that the $_POST was used for only that. But still nothing. When I click on the subject, it shows just view.php which is empty, no text at all. And how you mean subject wrongly? EDIT: Oh right, I've typoed in that part, but I think it should not have effect on the script.
  13. I've visited few forums to try to figure out what is wrong and how to fix this but no help so far, so I'll give it a try here. I created a news system like a year ago, but I would like to improve it a bit. Basically, what I want it to be like, is a table with "Subject", "Poster" and "Date". The Subjects are links to a page named view.php which should then show the text and other information related to this subject. So, I created a index.php which includes the stuff to get subjects from the database and give them a link to view.php, but this seemed not to work. index.php <table border="0"> <tr><td class="subcjet"><span><b>Subject</b></span></td><td class="header"><b>Poster</b></td><td class="header"><b>Date</b></td></tr> <?php require("config.php"); $ID = $_POST['ID']; $query = mysql_query('SELECT * FROM news ORDER BY ID DESC LIMIT 10'); while($row = mysql_fetch_assoc($query)) echo '<tr><td><a href="view.php" name="ID">'.$row['Subject'].'</a></td><td>'.$row['User'].'</td><td>'.$row['Date'].'</td></tr>'; ?> view.php <?php require("config.php"); $ID = $_GET['ID']; $query = mysql_query('SELECT * FROM news WHERE ID = "$ID"') or die(mysql_error()); while($row = mysql_fetch_assoc($query)) echo '<span><strong>'.$row['Subject'].'</strong> - <font size="2">Posted by '.$row['User'].' on '.$row['Date'].'</span><br /><br></font>'.str_replace(chr(10), '<br>', $row['Text']).'<hr />'; ?> I don't know if thats even a bit into the right way to do something such as this. Basically, I've tried just to make a thing to get an ID from the Subject and show the whole row for the ID. Any help to get this working like I am trying to would be great and I would be thankful.
×
×
  • 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.