Help - Search - Members - Calendar
Full Version: BAB: update entries
Codegrrl.com Forums > Script Help > Tutorial Help
ilona_
Is it possible to show all the available entries on update.php, and when I click on one of the entries it will then take me to update.php?id=x (where x is the entry's id number)? Right now I have the list of available in edit.php and then when I click on one of the titles it'll lead me to update.php?id=x. If I go to update.php directly it'll give me the "Invalid entry ID" message. Thanks.. flowers.gif
ilona_
Another thing.. tongue.gif I managed to view entries by categories, but I'm stuck as to how I make the category name came up. Right now I have this after selecting a category..
QUOTE
title entry
title entry

I can't figure out how I make it like so..
QUOTE
entries in the -categoryname- category
title entry
title entry
ilona_
Anyone please? You can forget about my first post, but I'd still like to know about my second post.. thanks. smile.gif
Martina
I have my categories directly inside the one news table, like this:

CODE
CREATE TABLE `php_news` (
  `id` int(20) NOT NULL auto_increment,
  `timestamp` int(20) NOT NULL default '0',
  `title` varchar(255) NOT NULL default '',
  `category` varchar(255) NOT NULL default '',
  `entry` longtext NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=502;

--
-- Daten für Tabelle `php_news`
--

INSERT INTO `php_news` VALUES (1, 1150532220, 'Teen Choice nominees announced', 'awards', 'blabla);



And I have it just like this (the category name comes from the things you put in):

CODE
<?php } elseif (substr_count($_SERVER['QUERY_STRING'], 'category')) { ?>
<?php
if ($_GET["c"]) {
$c=clean($_GET['c']);

echo "<h1>$c</h1>";

$result = mysql_query("SELECT * FROM php_news WHERE category='$c' ORDER BY timestamp DESC") or
print ("Can't select entries from table news.<br />" . $result . "<br />" . mysql_error());

while ($row = mysql_fetch_array($result)) {
$id = $row["id"];
$date = date("F d, Y, g:i a",$row["timestamp"]);
$title = $row["title"];
$category = $row["category"];

echo "<p><div style=\"float:left;display:inline;clear:both\">$date</div><div style=\"margin-left:180px;\"> &Iota; <a href=\"?entry&amp;id=$id\">$title</a></div></p>";
}

} else {

$result = mysql_query("SELECT category AS get_group FROM php_news GROUP BY get_group ASC") or print ("Can't select categories.<br />" . $result . "<br />" . mysql_error());

while($row = mysql_fetch_array($result)) {
$category = $row["get_group"];

echo "<a href=\"?category&amp;c=$category\">$category</a><br />";
}
}

?>


It was when I had no clue at all with php.

If that doesn't help, you should post the code you already have and how your database is created.

Instead of my <h1>$c</h1> you can just put your words in.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.