Jump to content

Hi I Am Timbo

Members
  • Posts

    109
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Hi I Am Timbo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Is there a way I can do a summed query with appropriate group bys that returns one value, then join a second table that would affect the sum (by having more than one row) after the sum. The result would be duplicate sums rather than a sum of duplicates.
  2. I guess I don't know what you mean by this. Does this mean that the array would look like $array[0] = $token; $array[1] = first part of $token; $array[2] = second part of token;???
  3. That really helps a lot. Let me see if I can get the rest of this down then: / ### Starting delimiter ^ ### BOL (Beginning of Line) ([^\s]+) ### Capture one or more instances of non-whitespace; this is better written as (\S+) \s+ ### One or more instances of whitespace. (.+) ### One or more instances of any character excluding a new line. \s+ (.*\d+) ### Capture zero or more instances of any character excluding a new line, followed by one or more digits. \s+ ([^\s\d]+) ### Capture one or more instances of non-whitespace, followed by one or more digits \s+ ([^\s]+) \s+ ([^\s]+) \s+ ([^\s]+) \s+ (.*[^\s]+) ### Capture zero or more instances of any character excluding a new line, followed by one or more instances of non-whitespace; this is better written as (\S+) \s+ ([^\s]+) $ ### Match at EOL or before a new line. / ### Ending delimiter If I put that in preg_match($regex, $token, $array); it will do this if it is matched: $array[] = $token; Is that correct?
  4. I have a regular expression and I am reading tutorials on it, but it is really taking me a long time to figure out what this does: /^([^\s]+)\s+(.+)\s+(.*\d+)\s+([^\s\d]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+(.*[^\s]+)\s+([^\s]+)$/ If someone could help me, that would be great. I'm trying to break it down, but I don't understand it all. What is \s?
  5. He's right, this worked like a charm: SELECT * FROM `user` A WHERE idUser = ( SELECT MAX( idUser ) FROM user B WHERE A.originalIdUser = B.originalIdUser ) Thank you artacus
  6. I'm trying to write a query on a user table. The table looks like this: +--------+-----------+-----------+----------+----------------+ | idUser | username | firstname | lastname | originalIdUser | +--------+-----------+-----------+----------+----------------+ | 1 | tbarsness | Tim | Barsness | 1 | | 2 | asdf | Tim | Barsness | 1 | | 3 | tbarsness | Tim | Barsness | 1 | | 4 | rocks | Tim | Barsness | 1 | | 5 | johndoe | John | Doe | 5 | | 6 | agoobwa | John | agoobwa | 5 | | 7 | agoobwa | John | agoobwa | 5 | +--------+-----------+-----------+----------+----------------+ I am trying to get the whole row for group of originalIdUser having a max(idUser) The query I thought should work: SELECT * , max( idUser ) FROM `user` GROUP BY originalIdUser HAVING idUser = max( idUser ) But it returns an empty result set. This is because this query: SELECT * , max( idUser ) FROM `user` GROUP BY originalIdUser returns the first record in each group as below: +--------+-----------+-----------+----------+----------------+ | idUser | username | firstname | lastname | originalIdUser | +--------+-----------+-----------+----------+----------------+ | 1 | tbarsness | Tim | Barsness | 1 | | 5 | johndoe | John | Doe | 5 | +--------+-----------+-----------+----------+----------------+ This is what I wanted: +--------+-----------+-----------+----------+----------------+ | idUser | username | firstname | lastname | originalIdUser | +--------+-----------+-----------+----------+----------------+ | 4 | rocks | Tim | Barsness | 1 | | 7 | agoobwa | John | agoobwa | 5 | +--------+-----------+-----------+----------+----------------+ I am thinking I have to join the user table to itself, but I am not sure how. Any help would be greatly appreciated.
  7. I'm looking to have authenticated users download files.  The only way to require them to be authenticated is to have the files be outside of the public directories, check user authentication, then allow them to be downloaded.  I'm wondering how you would do this.  The effect would be something like sourceforge where you actually download the file from a page instead of a direct link to the file. Thank you!
  8. I am trying to enable apache2 mod_rewrite for wordpress and am having some troubles. Here is what I have done (I added logging, but it doesn't work. I did a2enmod rewrite I added these lines to /etc/apache2/apache2.conf almost at the bottom, right before the sites-enabled wildcard: [code] RewriteEngine On RewriteLog "/var/log/apache2/rewrite_log" RewriteLogLevel 9 [/code] I then changed the permalink structure in wordpress to this: [code] /%year%/%monthnum%/%day%/%postname%/ [/code] I took the code they gave me and put it in a .htaccess file in the same directory as wordpress' index.php [code] <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> [/code] Then reloaded the web server: [code] /etc/init.d/apache2 force-reload [/code] everything reloaded fine. I go to the blog, and the first pages loads fine (because of the directory index). Then I click a link and get a File Not Found error. Here is the log. [code] [Thu Dec 14 23:11:46 2006] [error] [client 24.116.186.97] File does not exist: /var/www/timbo.name/hi.i.am/2006, referer: http://hi.i.am.timbo.name/ [/code] Looks like it isn't rewriting! Can anyone think what I am doing wrong?
  9. You can't use the local filesystem of the server for links.  A great way of doing it is using relative http links! <a href="foo/bar.php">Foo's Bar</a> <a href="/foo/bar.php">Foo's Bar from the http root</a> <a href="bar.php">Bar</a> Otherwise, just set the $config['root'] = 'http://www.localdomain.com' or to $_SERVER['http_host'] -- I'm not sure that will work.
  10. is $countryList a single string or a list of countries as the name suggests?  If so, this may be the source of your errors.
  11. Can I ask what class you got a homework assignment in PHP for?  Seems like most introductory programming courses aren't taught in scripting languages, and rightfully so.
  12. IT IS POSSIBLE!  YAY!  The only problem, it requires server customization not available on most inexpensive hosts.  If you don't have your own server, good luck.  Anyway, the information you are looking for is called a cron task (command run on).  Give that a go in google.
  13. I guess I'm not sure what you mean, but you can put images inside your list items (<li>)
  14. It works kind of in Firefox on the mac.  The left half works.  Anyway, this is a CSS issue.  I would try putting a link after it and see if that fixes it.  I bet it will.
×
×
  • 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.