Jump to content

ralph4100

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ralph4100's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello! I have to tables that are similar in important respects but different enough that I want them independent of each other ([b]flag_requests[/b] and [b]tour_requests[/b]). The tables [b]flag_notes[/b] and [b]tour_notes[/b] keep track of user submitted notes regarding the rows in [b]flag_requests[/b] and [b]tour_requests[/b], respectively. What I want is to select the rows in [b]flag_requests[/b] and [b]tour_requests[/b] that have zero rows in their respective [b]flag_notes[/b] and [b]tour_notes[/b] tables, and order the results by a column [b]added[/b] (datetime) which exists in both [b]flag_requests[/b] and [b]tour_requests[/b]. In other words, the unaddressed requests, as per their having no notes about them. My pathetic attempt: [code]SELECT * FROM flag_requests, tour_requests WHERE COUNT(             SELECT * FROM flag_notes, tour_notes             WHERE flag_notes_request_id=flag_requests.id OR tour_notes.request_id=tour_requests.id )=0 ORDER BY added[/code] the tables: [code]CREATE TABLE `flag_notes` (   `id` int(11) NOT NULL auto_increment,   `office_id` int(11) default NULL,   `user_id` int(11) default NULL,   `party_id` int(11) default NULL,   `request_id` int(11) default NULL,   `added` datetime default NULL,   `body` text,   PRIMARY KEY  (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; CREATE TABLE `flag_requests` (   `id` int(11) NOT NULL auto_increment,   `office_id` int(11) default NULL,   `party_id` int(11) default NULL,   `date_to_be_flown` date default NULL,   `date_needed_by` date default NULL,   `flown_for` varchar(150) default NULL,   `occassion` varchar(250) default NULL,   `special_instructions` text,   PRIMARY KEY  (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; CREATE TABLE `tour_notes` (   `id` int(11) NOT NULL auto_increment,   `office_id` int(11) default NULL,   `user_id` int(11) default NULL,   `party_id` int(11) default NULL,   `request_id` int(11) default NULL,   `added` datetime default NULL,   `body` text,   PRIMARY KEY  (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=52 ; CREATE TABLE `tour_requests` (   `id` int(11) NOT NULL auto_increment,   `party_id` int(11) NOT NULL,   `type` int(11) default NULL,   `confirmed` datetime default NULL,   `cancelled` varchar(200) default NULL,   PRIMARY KEY  (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=26 ;[/code]                      
  2. sometimes programming makes you feel so dumb.
  3. ok here's the code: [code]<?php function checkFor($n) { //let's see if this syntax works... //it's supposed to be true for any variation (regarding capitalization) //of the word 'reset' echo 'checking \''.$n.'\'...'; if(stristr('reset',$n)!==false) { echo 'true'; } else { echo 'false'; } echo '<p>'; } checkFor('reset'); checkFor('RESET'); checkFor('does not contain '); checkFor('does contain reset'); checkFor('rEsEt'); checkFor('ReSeT'); checkFor('reeeeset'); ?>[/code] and here's the output [code]checking 'reset'...true checking 'RESET'...true checking 'does not contain '...false checking 'does contain reset'...false checking 'rEsEt'...true checking 'ReSeT'...true checking 'reeeeset'...false[/code] stristr() should not return false for 'does contain reset' because 'reset' is in the string 'does contain reset'. get me? what's going on here? running php 5.2 btw...
  4. usually the mod operator is best for this but your question is hard to understand. try to explain more fully what you are trying to do
  5. try over two lines of code like this [code]<?php $plusone=$row_Recordset1['id']++; $minusone=$row_Recordset1['id']--; //then echo as needed //the problem I think is that when you can't do calculation while echoing [/code]
  6. whew that was a tough problem
  7. $i<=3 would mean 4 iterations if it begins with 0 lol I don't know about your list method why not just use mysql_fetch_array [code] <?php db_connect(); $q="SELECT * FROM table LIMIT 1"; $r=mysql_query($q); $counter=0; while($row=mysql_fetch_array($r)&& $counter<3) { echo $row['column1'].' tada! '.$row['column2']; $counter++; } ?>[/code]
  8. htmlentities is SUPPOSED to do what u want but I am having problems with it see my topic hahaha
  9. man that is a perplexing PHP problem
  10. if u have a good head on your shoulders u can figure out the rest from this http://www.phpbuilder.com/columns/akent20000610.php3?page=6
  11. you probably didn't close the <?php with a corresponding ?> so when it gets to html code it sees the < and has a syntax error
×
×
  • 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.