Jump to content

newbeee

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

newbeee's Achievements

Member

Member (2/5)

0

Reputation

  1. correct links sorry [redacted]/photogallery3%20DB/index-DB-version%20album%20one%20works%20and%20end%20ok%20but%20rest%20just%20show%20main%20image%20page%20not%20gallery.php and [redacted]/photogallery3%20DB/index-DB-version4%20keeps%20advancing%20to%20next%20album.php
  2. Hi Hopefully someone can answer this for me as i have been getting rather annoyed with DW ! It keeps changing the layout of my code! aarrgghh adding in tabs realigning code here and there when i reload the file. how can i stop DW from doing this please.
  3. i have been tried to get 'all' the categorys to be listed no mater what. but have them ordered by the stickypost (high number first) of the category table and then the comments stickypost field (again high number first) and then by the created_on in the comments (most recent date first - yyyy-mm-dd). if there are no comments or topics in the category then the categories still show. all of the topics or comments should have their 'confirmed' fields = 1, if not then these are disgarded and not used in the query. here are my tables... CREATE TABLE IF NOT EXISTS `forum_category` ( `category_id` bigint(20) NOT NULL auto_increment, `confirmed` text, `stickypost` tinyint(4) NOT NULL default '0', `category` text NOT NULL, `created_by` text NOT NULL, `created_on` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`category_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4; INSERT INTO `forum_category` (`category_id`, `confirmed`, `stickypost`, `category`, `created_by`, `created_on`) VALUES (1, '1', 1, 'General', 'Jason (admin)', '2009-01-30 00:00:00'), (2, '1', 0, 'Your stories', 'Jason (admin)', '2009-01-30 00:16:57'), (3, '1', 0, 'Something else', 'Jason (admin)', '2009-01-30 00:27:59'); CREATE TABLE IF NOT EXISTS `forum_topics` ( `topic_id` bigint(20) NOT NULL auto_increment, `category_id` bigint(20) NOT NULL default '0', `topic` longtext NOT NULL, `username` text NOT NULL, `stickypost` tinyint(4) NOT NULL default '0', `created_by` text NOT NULL, `created_on` datetime NOT NULL default '0000-00-00 00:00:00', `confirmed` text, `views` bigint(20) NOT NULL default '0', KEY `topic_id` (`topic_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1; CREATE TABLE IF NOT EXISTS `forum_comments` ( `postcounter` bigint(20) NOT NULL auto_increment, `topic_id` bigint(20) NOT NULL default '0', `comment` longtext NOT NULL, `username` varchar(65) NOT NULL default '', `stickypost` tinyint(4) NOT NULL default '0', `created_on` datetime NOT NULL default '0000-00-00 00:00:00', `confirmed` text, KEY `postcounter` (`postcounter`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1; this is the query i have come up with so far and the fields i need available in the results. i know i have used the long way to query but this will help me understand the query so i can hopefully learn to do this myself one day. SELECT `forum_category`.`category_id`, `forum_category`.`category`, `forum_category`.`stickypost`, `forum_category`.`confirmed`, `forum_topics`.`category_id`, `forum_topics`.`topic_id`, `forum_topics`.`confirmed`, `forum_topics`.`views`, `forum_comments`.`postcounter`, `forum_comments`.`topic_id`, `forum_comments`.`created_on`, `forum_comments`.`username`, `forum_comments`.`confirmed` FROM forum_category WHERE `forum_category`.`confirmed` = '1' , JOIN forum_topics WHERE `forum_topics`.`confirmed` = '1', JOIN forum_comments WHERE `forum_comments`.`confirmed` = '1' ORDER BY `forum_category`.`stickypost` DESC, `forum_comments`.`created_on` DESC
  4. sory i was not clear with my OP did not want to delete just to list them. what i did not say is that these posts could be valid but just not linked properly for errors in my code or something, so just wanted to list all the topics and the comments that may have category_id or topic_id but just linked to one another.
  5. validated and now working using the methods shows in the error messages i got from w3c thanks for your help
  6. I have my own forum scripts and wish to know if some posts have for what ever reason become unlinked. list all the results where the category_id number in the category table is not in the topic table field category_id and the second seperate query... list all the results where the topic_id number in the comments table not in the topic table field topic_id below are the tables i have and their fields that would be needed. CREATE TABLE IF NOT EXISTS `forum_category` ( `category_id` bigint(20) NOT NULL auto_increment, PRIMARY KEY (`category_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; CREATE TABLE IF NOT EXISTS `forum_topics` ( `topic_id` bigint(20) NOT NULL auto_increment, `category_id` bigint(20) NOT NULL default '0', KEY `topic_id` (`topic_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ; CREATE TABLE IF NOT EXISTS `forum_comments` ( `postcounter` bigint(20) NOT NULL auto_increment, `topic_id` bigint(20) NOT NULL default '0', KEY `postcounter` (`postcounter`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
  7. i have tried to access the movies via the direct link and all seems ok, but for some reason the movie does not now show in Internet Explorer. All works ok in Fire Fox tho Can anyone suggest a way to fix this please. www dot round shaw dot com/?ac=cs (take out spaces also)
  8. Hello, Just thought i'd add my thoughts on this. If the page is created on the fly and the files are not always the same then have the page create the zip of the chosen files. and then this zip could be stored in a temporary folder within your web folder i.e public_html. then the link to this file shown on the page. ok now for the part that removes this temporary zip file. have a cron job that runs another file that would check the date the file was created and delete all the files within this temporary folder that stores the zuip files apart from the files that have been created within the last hour and have this cron job run say every so many hours or how ever long you want to prevent your webspace from being eatten up by these temporary zip files. if you need any help with setting this up get back to me via a PM Jason
  9. what is the best way to prevent SQL injections with what code i have so far.. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <? include("config.php"); if($_POST['submit'] == "submit") { $update = mysql_query("UPDATE `news` SET `news` = '" . $_POST['news'] . "'"); } else { $news = mysql_query("SELECT * FROM `news`"); ?> <textarea name="news" cols="80" rows="10"><?=@mysql_result($news, 0, 'news');?></textarea><br> <input name="submit" type="submit" value="submit"> <? } ?> </body> </html>
  10. the news field in my database is a text type what i wish to know is how to have text that has line breaks within the text still show with these line breaks when i grab the data again to show it in the page it is ment for. at the moment all the text seems to just continue on one long line and breaks up when the end of the page is reached. edit file <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <? include("config.php"); if($_POST['submit'] == "submit") { $update = mysql_query("UPDATE `news` SET `news` = '" . $_POST['news'] . "'"); } else { $news = mysql_query("SELECT * FROM `news`"); ?> <textarea name="news" cols="80" rows="10"><?=@mysql_result($news, 0, 'news');?></textarea><br> <input name="submit" type="submit" value="submit"> <? } ?> </body> </html> display page <?=@mysql_result($mpsurgeries_news, 0, "mpsurgeries_news");?>
  11. get data from mysql and use it via... $results[fieldname] i have used it once but can not remember or find it on my sites code. what is the correct way to do this please. i hope to use this to simplify the permission section of my site. this is my database... CREATE TABLE IF NOT EXISTS `permissions` ( `username` text NOT NULL, `Some Menu` tinyint(4) NOT NULL, `Forum Menu` tinyint(4) NOT NULL, `Menu1` tinyint(4) NOT NULL, `Another Menu` tinyint(4) NOT NULL, `Menu2` tinyint(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `permissions` -- INSERT INTO `permissions` (`username`, `Some Menu`, `Forum Menu`, `Menu1`, `Another Menu`, `Menu2`) VALUES ('Steph', 0, 1, 1, 0, 0), ('Terry', 0, 0, 0, 0, 0), ('Tom', 0, 0, 0, 0, 0), ('James', 0, 0, 0, 0, 0), ('Jason', 1, 1, 1, 1, 1), ('Tina', 0, 0, 0, 0, 0), ('Sue', 0, 0, 0, 0, 0), ('Tim', 0, 1, 0, 0, 0), ('David', 0, 0, 0, 0, 0), ('Lil', 0, 0, 0, 0, 0); then a user logs in and the database is got with the permissions the user can do. i would then use the following to find out if they can use that page or not if ($permissions[menu2] = '1') { //show menu }
  12. category about cats Jason 12 Jan 2009 04:11 category about dogs Jason 11 Jan 2009 06:00 category about dogs Jason 11 Jan 2009 06:00 it shows the dogs entry twice in phpmyadmin and on the site and there are only two categories at the moment for testing.. and should show just two category about cats Jason 12 Jan 2009 04:11 category about dogs Jason 11 Jan 2009 06:00
  13. the following is now geting one of the entries twice! it should be getting each category once and order by... stickypost, (from the category table, high number first) then created_on, (from the comments table, recent date first) can anyone see whats wrong with the query. this is my table and the data. -- -- Table structure for table `forum_category` -- CREATE TABLE IF NOT EXISTS `forum_category` ( `category_id` bigint(20) NOT NULL auto_increment, `confirmed` text, `stickypost` tinyint(4) NOT NULL default '0', `category` text NOT NULL, `created_by` text NOT NULL, `created_on` datetime NOT NULL default '0000-00-00 00:00:00', `theip` text NOT NULL, PRIMARY KEY (`category_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; -- -- Dumping data for table `forum_category` -- INSERT INTO `forum_category` (`category_id`, `confirmed`, `stickypost`, `category`, `created_by`, `created_on`, `theip`) VALUES (1, '1', 0, 'category about cats', 'Admin', '2008-12-30 01:02:03', ''), (2, '1', 0, 'category about dogs', 'Admin', '2008-12-30 01:02:03', ''); -- -------------------------------------------------------- -- -- Table structure for table `forum_comments` -- CREATE TABLE IF NOT EXISTS `forum_comments` ( `postcounter` bigint(20) NOT NULL auto_increment, `topic_id` bigint(20) NOT NULL default '0', `reportedby` text NOT NULL, `comment` longtext NOT NULL, `alreadyexists` text NOT NULL, `username` varchar(65) NOT NULL default '', `theip` text NOT NULL, `created_on` datetime NOT NULL default '0000-00-00 00:00:00', `confirmed` text, `approvedby` text, `approveddatetime` datetime NOT NULL default '0000-00-00 00:00:00', `editedby` text, `editeddatetime` datetime NOT NULL default '0000-00-00 00:00:00', `deletedby` text NOT NULL, `restoredby` text NOT NULL, KEY `postcounter` (`postcounter`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=25 ; -- -- Dumping data for table `forum_comments` -- INSERT INTO `forum_comments` (`postcounter`, `topic_id`, `reportedby`, `comment`, `alreadyexists`, `username`, `theip`, `created_on`, `confirmed`, `approvedby`, `approveddatetime`, `editedby`, `editeddatetime`, `deletedby`, `restoredby`) VALUES (16, 7, '', 'dog', 'no', 'Jason', '', '2009-01-11 00:00:00', '1', 'Jason', '0000-00-00 00:00:00', 'Jason', '0000-00-00 00:00:00', '', ''), (17, 1, '', 'cats comment 2', 'no', 'Jason', '', '2009-01-11 14:09:00', '1', 'Jason', '0000-00-00 00:00:00', NULL, '0000-00-00 00:00:00', '', ''), (18, 1, '', 'cat topic 3', 'no', 'Jason', '', '2009-01-11 00:00:00', '1', 'Jason', '0000-00-00 00:00:00', 'Jason', '0000-00-00 00:00:00', '', ''), (20, 1, '', 'last dogs', 'no', 'Jason', '', '2009-01-11 00:00:00', '1', 'Jason', '0000-00-00 00:00:00', 'Jason', '0000-00-00 00:00:00', '', ''), (22, 1, '', 'new vt 8', 'no', 'Jason', '', '2009-01-11 00:00:00', '1', 'Jason', '0000-00-00 00:00:00', 'Jason', '0000-00-00 00:00:00', '', ''), (23, 7, '', 'cat topic 3 - new to replace the blank entry', 'no', 'Jason', '', '2009-01-11 00:00:00', '1', 'Jason', '0000-00-00 00:00:00', 'Jason', '0000-00-00 00:00:00', '', ''), (24, 8, '', 'tttttttt', '', 'Jason', '', '2009-01-11 22:11:00', '1', 'Jason', '0000-00-00 00:00:00', NULL, '0000-00-00 00:00:00', '', ''), (15, 1, '', 'cats', 'no', 'Jason', '', '2009-01-11 00:00:00', '1', 'Jason', '0000-00-00 00:00:00', 'Jason', '0000-00-00 00:00:00', '', ''); -- -------------------------------------------------------- -- -- Table structure for table `forum_topics` -- CREATE TABLE IF NOT EXISTS `forum_topics` ( `topic_id` bigint(20) NOT NULL auto_increment, `category_id` bigint(20) NOT NULL default '0', `topic` longtext NOT NULL, `username` text NOT NULL, `theip` text NOT NULL, `stickypost` tinyint(4) NOT NULL default '0', `created_on` datetime NOT NULL default '0000-00-00 00:00:00', `confirmed` text, `updated_on` datetime NOT NULL default '0000-00-00 00:00:00', `views` bigint(20) NOT NULL default '0', `lastviewer` text NOT NULL, `approvedby` text, `approveddatetime` datetime NOT NULL default '0000-00-00 00:00:00', `editedby` text, `editeddatetime` datetime NOT NULL default '0000-00-00 00:00:00', `deletedby` text NOT NULL, `restoredby` text NOT NULL, KEY `topic_id` (`topic_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; -- -- Dumping data for table `forum_topics` -- INSERT INTO `forum_topics` (`topic_id`, `category_id`, `topic`, `username`, `theip`, `stickypost`, `created_on`, `confirmed`, `updated_on`, `views`, `lastviewer`, `approvedby`, `approveddatetime`, `editedby`, `editeddatetime`, `deletedby`, `restoredby`) VALUES (1, 1, 'topic about cats', 'Admin', '', 0, '2009-01-11 14:09:00', '1', '2009-01-11 14:09:13', 13, 'Jason', 'Jason', '0000-00-00 00:00:00', NULL, '0000-00-00 00:00:00', '', ''), (8, 1, 'cat topic 3', 'Jason', '', 0, '2009-01-11 22:11:00', '1', '2009-01-11 22:10:53', 0, '', 'Jason', '0000-00-00 00:00:00', NULL, '0000-00-00 00:00:00', '', ''), (7, 2, 'topic about dogs', 'Jason', '', 0, '2009-01-11 14:17:00', '1', '2009-01-11 14:17:08', 0, '', 'Jason', '0000-00-00 00:00:00', NULL, '0000-00-00 00:00:00', '', ''); SELECT cat.category_id , cat.category , cat.stickypost , t.category_id , t.topic_id , c.created_on , c.username FROM forum_comments AS c INNER JOIN forum_topics AS t USING ( topic_id ) INNER JOIN forum_category AS cat USING ( category_id ) INNER JOIN ( SELECT t.category_id , MAX(c.created_on) AS created_on FROM forum_comments AS c INNER JOIN forum_topics AS t USING ( topic_id ) WHERE c.confirmed = '1' AND t.confirmed = '1' GROUP BY t.category_id ) AS c2 ON ( c2.category_id = t.category_id AND c2.created_on = c.created_on ) ORDER BY `stickypost` DESC, `created_on` DESC
  14. if the category pull down menu is changed then the list in the topics pull down menu changes to show the topics that are in that category chosen. all data is got from the mysql database. there maybe a lot of categories and topics in the furture, just in case that may help in creating a method to prevent the code needing changing again in the future, due to taking too long or something? <select name="categoryid"><? // get category_id $get_category_titles = mysql_query("SELECT * FROM `forum_category` WHERE `confirmed` = '1' ORDER BY `created_on` DESC"); $get_topic_titles = mysql_query("SELECT * FROM `forum_topics` WHERE `confirmed` = '1' ORDER BY `created_on` DESC"); for ($i = 0; $i < mysql_num_rows($get_category_titles); $i ++) { ?><option<? if ($posts['categoryid'] == mysql_result($get_category_titles, $i, 'category_id')) {echo(" selected");} ?> value="<?=mysql_result($get_category_titles, $i, 'category_id');?>"><?=mysql_result($get_category_titles, $i, 'category');?></option><? } ?></select> <select name="topicid"><? // get topics for ($i = 0; $i < mysql_num_rows($get_topic_titles); $i ++) { ?><option<? if ($posts['topicid'] == mysql_result($get_topic_titles, $i, 'topic_id')) {echo(" selected");} ?> value="<?=mysql_result($get_topic_titles, $i, 'topic_id');?>"><?=mysql_result($get_topic_titles, $i, 'topic');?></option><? } ?></select>
  15. Please can someone help me here as i have no idea what i need to do or where to start. this is the method i as trying to do... <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form name="form2" method="post" action=""> <p> <select name="select1"> <option value="L1 - VALUE 1">L1 - OPT 1</option> <option value="L1 - VALUE 2">L1 - OPT 2</option> <option value="L1 - VALUE 3">L1 - OPT 3</option> </select> </p> <? // if OPT 1 is selected in the select1 pulldown then the following is placed the select2 options ?> <p> <select name="select2-1"> <option value="L2 - VALUE 1">L2 - OPT 1</option> <option value="L2 - VALUE 2">L2 - OPT 2</option> <option value="L2 - VALUE 3">L2 - OPT 3</option> </select> </p> <? // if OPT 2 is selected in the select1 pulldown then the following is placed the select2 options ?> <p> <select name="select2-2"> <option value="L3 - VALUE 1">L3 - OPT 1</option> <option value="L3 - VALUE 2">L3 - OPT 2</option> <option value="L3 - VALUE 3">L3 - OPT 3</option> </select> </p> <? // if OPT 3 is selected in the select1 pulldown then the following is placed the select2 options ?> <p> <select name="select2-3"> <option value="L4 - VALUE 1">L4 - OPT 1</option> <option value="L4 - VALUE 2">L4 - OPT 2</option> <option value="L4 - VALUE 3">L4 - OPT 3</option> </select> </p> </form> </body> </html>
×
×
  • 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.