Jump to content

StrangeWill

Members
  • Posts

    47
  • Joined

  • Last visited

    Never

Everything posted by StrangeWill

  1. So I have a table that looks like this: +-------+---------+-----+-----+ | pageid| time | text| title | +-------+---------+-----+-----+ | 1 | 100 | text| old +-------+---------+-----+-----+ | 2 | 200 | text| none +-------+---------+-----+-----+ | 1 | 300 | text| new +-------+---------+-----+-----+ I do a group by pageID, but when I do an order by time, the last updated page is page two. Any ideas on how I can group it, get the title for the first entry, but the time for the most recent? Or should I store the most recent entry time? This is my SQL: SELECT * FROM `pages` GROUP BY `pages`.`pageid` ORDER BY `pages`.`time` DESC What I want returned: +-------+---------+-----+-----+ | pageid| time | text| title | +-------+---------+-----+-----+ | 1 | 300 | text| old +-------+---------+-----+-----+ | 2 | 200 | text| none +-------+---------+-----+-----+ What I get returned: +-------+---------+-----+-----+ | pageid| time | text| title | +-------+---------+-----+-----+ | 1 | 100 | text| old +-------+---------+-----+-----+ | 2 | 200 | text| none +-------+---------+-----+-----+
  2. "I have a covering INDEX on that table which covers all the fields used in the friends table" Well, how do you expect it to be more efficient when your index is as large as the table itself? Stick to only searchable items?
  3. I'm guessing you want to do this: mysql_query("INSERT INTO gradinfo (f_name,l_name,email,pass,gender,birthm,birthd,birthy,address1,county,country,telephone,location) VALUES ('$fname','$lname','$email','$pass','$gender','$birthm','$birthd','$birthy','$address1','$county','$country','$phone','$location')");//Set SQL mysql_query("INSERT INTO gradcoll (u_course, u_id) VALUES ('$course', '$id')"); mysql_query("INSERT INTO gradwork (occupation, u_id) VALUES ('$occupation', '$id')");
  4. Yeah, and it also tends to send way more data than is actually needed, and ends up requiring a hefty overhead of dealing with the data. Should I just loop through queries, or create a separate table, then do a call if the parent HAS children?
  5. Currently I'm roughly running with this (sorry if it isn't exact, but it's a general idea, I don't have the SQL statement right in front of me at the moment..) SELECT table.*, tablechild.* FROM table LEFT JOIN table AS tablechild ON tablechild.parentid = table.id However that only gets me one child deep. I could just do a loop: for(each record) { SELECT table.* FROM table WHERE parentid=currentTableID }
  6. So I've been working on trying to get the information I want out of one query, but the way the database is structured seems to make it extremely difficult to do such. I don't even know if I can restructure it in a way to get the information I want out of one query. So in my mind I say "why not just run more than one query?", alas how many queries is too many to run during a page load? They're all pretty simple queries (two pieces of data, one left join, where an ID is a value). Problem is I could need to do this some 20-30 times, or even more. Is this okay, or should I be looking at another method? Just in case another method is suggested, I have this (for example) as the table: id | parentid | text 1 | 0 | Sometext 2 | 1 | ChildText 3 | 1 | OtherChildText 4 | 2 | ChildChildText Currently I can left join the table again on tablejoined.parentid = table.id, alas this only gets me one deep, and also returns a lot of data (will return the id and text of the parent again and again and again for every child item, seems like a waste of memory/time). I would need something that is recursive till there are no children.
  7. So I'm a little bit new at OS modifications, I was hoping to hook up with a really simple OS, but all projects I find are usually garbage or use old compilers that don't seem to work anymore... Some people pointed me over to a handful of projects, but I made my mind up now, I definitely want to go Linux. It's something I'm becoming more and more familiar in, and I think would be the best to expand on a few projects I want to complete. Basically what I want: 1) An easy set of code to download, no proprietary CVS systems or lack of instructions. 2) An easy build that allows me to create a bootable ISO or live CD ISO 3) Console only access is fine, if not recommended. 4) The less included (games, applications, etc) the better. I've been having major difficulty finding something like this, Damn Small Linux wont run on an emulated machine, which is driving me crazy, and I can't find their CVS to begin with. Anyway, any pointers? Suggestions? I thought of trying Knoppix but their site is in like German, so finding the CVS, let alone trying to figure it out would be a nightmare. Tried Gentoo, their documentation was useless as far as compiling went, let alone which CVS directory I need... Basically I need a simple setup I can download, compile, make, and run, from there I can work on understanding once I know I have something I can work with. Linux from scratch is no good, I need to install and modify Linux... then like recompile it, which is going to end up with a lot of stuff I don't need... I have Linux box to compile on, but I want to modify source directly. Update: Downloading the source for Fedora 7 Hopefully I'm on the right path.
  8. I store two locations: [ebp+8] [ebp+4] These contain ADDRESSES. I want to be able to move from these addresses (the value of the address located at the value ebp+4, not the address of ebp+4, nor it's value) to a register (al to be exact). Any ideas? See the project demands that we use the offset, and for some reason digging through my entire textbook and as many websites as I can find, I cannot see how to move to value of the register whose value is stored at ebp+4. Basically: ebp+4 = 004000h I want the data in memory location 004000h
  9. I just play to have fun with friends, I am obviously not going to be the most kick ass, I don't have that much time to waste, it's about questing with friends, making jokes, having fun.
  10. If you have any faith in what you're selling it may be worth actually paying for a whole ecommerce setup.
  11. I've read some of it, a lot of what I've read have been mostly design ideas, and flowcharts, but no apis or documentation on how to communicate with their servers. Also their PHP API link is dead.
  12. So I've looked at the PHP toolkit, but it does no good for me... I need to be able to add more than one item, any ideas?
  13. [quote author=KingPhilip link=topic=123286.msg513168#msg513168 date=1169732457] I thought this was funny on the ASP vs PHP debate. I was walking through Fry's (a big tech store) and they had 4 or 5 racks of bargain books. There had to have been at least 20-25 books on ASP, and not a single bargain book on PHP :P [/quote] They're usually quite cheap in the first place, a bargain PHP book would be practically free. :P Most ASP books I've picked up are in the $60 area, I've gotten PHP books for like $5-15 :P Another point: As I'm getting into software development, and am releasing my own CMS (well... you hire me to do a site, I use my CMS as the underlying engine to run your site so you can still manage it) I find PHP a lot better for that market, being as I'm dealing with people just starting their businesses and such. But when I'm doing work for a company, and am hired for said company, it's usually been in ASP/ASP.NET
  14. [quote author=utexas_pjm link=topic=123286.msg509356#msg509356 date=1169343941] Something to consider: PHP runs on Apache or IIS which allows you to choose between Windows, *nix, and (cough) Mac  platforms.  ASP (natively) runs on Windows IIS only. Best, Patrick [/quote] Actually there was an Apache build that will run ASP legacy. (.asp) Anyway, I've programmed in both, started in ASP, I enjoyed it a lot, learned a lot, and made very nice applications with it. Then I moved into the business of making websites for people. PHP hosting is cheaper. It's got a lot of quirks that bug me, but I live with them (don't us programmers feel that way with all languages?). I moved into ASPX (.Net) and LOVED the event driven software they got, sadly this takes away a lot of flexibility to the system based on how you're SUPPOSE to write in .net (no HTML code, lots of objects). I got some PHP under my belt because my friend knew it, he was quickly pissed that I'm doing OOP projects that he doesn't understand (I got most of my OOP background in .NET and Java). Personally I use PHP because thats what is easiest to deploy in the "I need a website" market. We're talking about single people starting up businesses and such. If I was to write a massive piece of software for a company, I'd probably look into going back to .NET or learning JSP (I hear that stuff is powerful too!). IMHO: It's about taste and what you need to get done, really thats what ALL computer languages are about (Ignore those idiots that must insist everything should be in C++, I'll write my small desktop apps in Visual Basic or C# thank you very much) it's about finding what you NEED, and then using the language that fits that need the best (because as you get more complicated languages it takes more time to get done, and run into more errors and debugging). @Crayon: I wasn't around back in the BASIC days, but my Dad showed me some stuff he did, plus some code that came with BASIC showing sorting algorithms, that most PHP programmers don't know anything about, lots can be learned about improving your code by learning BASIC I'd say. Hence: I'm taking Data Structures in Java this semester at the college. :)
  15. No official website? I don't trust it :P Plus market is flooded with "browsers"
  16. Let me sum up the original post: *whine whine bitch bitch complain complain* Meh, I'm not a fan of Microsoft, but I'm tired of the anti-Microsoft craze. Personally I find Apple [i]worse[/i] in the bull that gets handed out. I still use Firefox though.
  17. [quote author=neylitalo link=topic=121725.msg502042#msg502042 date=1168494642] Wow, that was fast! Stick it to 'em, Cisco... (I'm not a fan of Apple.) [/quote] Agreed (Not a fan of the iCraze)
  18. [quote author=phpORcaffine link=topic=121560.msg500006#msg500006 date=1168289901] Depending on your code and how you are evaluating you comments, it may be easier to use preg_replace() which will lead you down the dark 'regex' path ... [/quote] Dark? Regex is all powerful and knowing!
  19. [quote author=thorpe link=topic=121057.msg497155#msg497155 date=1167959661] [quote]We can replace {today.weather} with $this->$Strings['today']['weather'] then use eval? Right?[/quote] How? eval doesnt replace anything, it evaluates a string as if it where php. If this... [code=php:0] '<p style="font-size:28px;">This is a {today.weather} day</p>' [/code] is your string, I don't see what good eval() would be. [/quote] Well what I'd do is replace {today.weather} with $this->Strings['today']['weather'] than eval that, but that doesn't work. [quote author=Barand link=topic=121057.msg497167#msg497167 date=1167960748] Have a look at http://www.php.net/str_replace [/quote] Okay, so what you're saying is I should use regex to get all occurrences of {val.val} in my string, then build that into an array, and do a replace? I would think that to be EXTREMELY slow, but if that wouldn't be the case, then thanks. :) So like: Regex->Get all "{(*.).(*.)}" Split all (if needed) to get the two separate vals do(while there are values to process) { replace($original regex val, $this->$Strings[$RegexSplit[0],$RegexSplit[1]]); } ?? Basically I'm building a small (but QUICK) template engine, thats why I'm trying to keep load times small, and need it to process lots of info.
  20. Okay so I have a string: "This is a {today.weather} day" We can replace {today.weather} with $this->$Strings['today']['weather'] then use eval? Right? Except the string may include "{" or ";" which seems to confuse the hell out of eval. Example: '<p style="font-size:28px;">This is a {today.weather} day</p>' Any ideas on how to overcome this problem efficiently? Wouldn't it be extremely time consuming to loop through every instance of {var.var} (gather them using regex) and then do a replace one by one?
  21. Nevermind, "U" always returns GMT/UTC
  22. GMT:1167875911 Local:1167875911 UTC:1167875911 Using: [code=php:0] echo("<br><br>GMT:".gmmktime()); echo("<br><br>Local:".time()); date_default_timezone_set('UTC'); echo("<br>UTC:".date('U').'<br><br>'); [/code]
×
×
  • 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.