Jump to content

roopurt18

Staff Alumni
  • Posts

    3,746
  • Joined

  • Last visited

    Never

Everything posted by roopurt18

  1. If you want the matches from '$term%' to appear before those matched by '%$term%' there are a couple of ways you can do it. SELECT * FROM info_articles WHERE article_title LIKE 'term' OR article_title LIKE '%term' OR article_title LIKE 'term%' OR article_title LIKE '%term%' could become SELECT *, 0 as `sort_order` FROM info_articles WHERE article_title LIKE 'term' UNION SELECT *, 1 as `sort_order` FROM info_articles WHERE article_title LIKE 'term%' UNION SELECT *, 2 as `sort_order` FROM info_articles WHERE article_title LIKE '%term%' UNION SELECT *, 4 as `sort_order` FROM info_articles WHERE article_title LIKE '%term' ORDER BY `sort_order`, `article_title` If you don't want to use a UNION, then you might get away with some form of a CASE...WHEN in the ORDER BY clause of your original query.
  2. You may want to do some reading on database normalization. Most articles / tutorials on the subject will contain examples that might point in the right direction as far as these types of design choices are concerned.
  3. It sounds to me like the OP is building his action attribute of the form in such a manner that it "forgets" the query string that generated the page request. Fix that and it should be fine.
  4. Uploads and downloads will always be hard-capped by the physical capabilities of the connection. That said, any machine could potentially have software installed that throttles the rate at which uploads and downloads occur. If that were the case, then you'd have to find the appropriate settings for said software on your server and your clients' machines.
  5. Your 'Position' table seems extraneous to me. <?php $date = mysql_real_escape_string( $_POST['date'] ); $venue_id = mysql_real_escape_string( $_POST['venue_id'] ); $select = " SELECT p.`FirstName`, p.`NickName`, p.`LastName`, po.`Position`, po.`Points` FROM `Player` p INNER JOIN `Results` r ON p.`MembershipNo`=r.`MembershipNo` INNER JOIN `Venue` v ON v.`VenueID`=r.`VenueID` INNER JOIN `Position` po ON po.`Position`=r.`Position` WHERE r.`Date`={$date} AND v.`VenueID`={$venue_id} ORDER BY po.`Position` "; ?>
  6. What is best depends on your criteria and circumstances. In any case, the database is usually faster than PHP code. (edit) In addition, the database already supports a grammar for conducting searches with very little effort on your part, whereas in PHP you'll have to potentially write a lot of code to conduct the same searches.
  7. I had high hopes for WoW when it was released. I don't really care for quests or killing mobs or dungeon crawling. I just want good PvP. Well there was none of that to be found.
  8. I've used eclipse and netbeans both in addition to IDEs written in C or C++. I'm going to have to agree with keldorn that Java-based IDEs are slow in general and can become completely unusable in large projects or when large files are opened. I've also noticed that Java applications tend to have worse performance on Windows than they do on Linux. For what it's worth, I still use netbeans at home because it's free. I also use eclipse at work to design reports.
  9. I'll need to see more of the xml file as the one you've posted doesn't seem to be organized correctly.
  10. You need to do more reading on XML to understand what you're doing; w3schools has some fine tutorials. <category name="Stop Smoking"> The part in bold is an element. The element is named category. The part in italics is an attribute. The attribute's name is name and its value is Stop Smoking. You'll have to double check the SimpleXML documentation on how to access attributes, but I believe you do it as if they were array elements. The following may work: <?php $object = simplexml_load_file("data.xml"); //$xmlobj = new SimpleXMLElement($object); // <-- PRETTY SURE THIS IS REDUNDANT AND UNNECESSARY echo $object->root->category['name']; ?>
  11. 1) Students are either absent or present. 2) There are special actions to take when a student is absent, not when a student is present. 3) Students are also more likely to be present than absent. Given the following, I'd say you should only keep track of when students are absent and otherwise assume they were present. table: students id, first_name, last_name, etc. table: classes id, title, description table: student_classes id, term (semester, trimester, or quarter), hour (period of the day, etc), student_id, class_id table: student_attendance -- A record in this table indicates the student was absent id, student_classes_id, timestamp
  12. Don't use that query to see if something exists and don't use the mysql_num_rows() method. The query you've presented will return the data in all of the rows. Let's say your average record is 500 bytes. Now let's say your database contains 1,000 records that meet the criteria. You'll be returning all 1,000 records at 500 bytes per record. 1) This is making the database do way more work than it has to. 2) Your sending excessive data through the connection between your application and the database (500,000 bytes in my example). Use something like this: <?php $escaped_variable = mysql_real_escape_string( $_POST['some_input'] ); $count_stmt = " SELECT COUNT(*) AS `n` FROM `yourtable` WHERE `thecol`={$escaped_variable} "; $q_handle = mysql_query( $count_stmt ); $count = 0; if( $q_handle ) { $count_row = mysql_fetch_object( $q_handle ); if( $count_row ) { $count = $count_row->n; } } echo "There are {$count} records matching the criteria."; ?>
  13. Show us an example of the XML file.
  14. You're usually best off just using the if..else if...else if...else if...else syntax.
  15. For those of you thinking an outdoor trade may have been the route to go. No. No. No! Computers may be hard on the eyes, but my dad has more or less been doing construction type deals since 18. He's now in his fifties. He has all sorts of aches and pains and according to my mom sometimes groans painfully while sleeping. Like I said, I went on a lot of jobs with him when I was younger and it's hard work the human body isn't meant to do for years on end.
  16. For me it was extremely easy. 1) I like it. 2) I'm good at it. 3) People will pay me for it. The "do what you love" is extremely important. I love programming. I wrote programs even as a hobby before my career. However, as much as I love it, there are days I go into work and think "I don't want to do this today." I can't imagine what I'd think if I didn't even like what I did.
  17. I was born in 1980 and, according to my parents, beating their friends' asses in Pac Man on the atari when I was two. Apparently I've been a gamer for most of my life as I still play them today. While growing up my dad worked for So. California Edison and later as a self-employed general contractor. I commuted with him to Edison many times. When he was a contractor I also helped him on many jobs. Most of it is hard work and I was always thinking to myself, "Fuck this. I'm going to be a lawyer." Early in high school I realized two things: 1) Lawyers have to take a lot of school 2) I hate school So then I started thinking about career choices. Everyone was always telling me to do what you love and I love video games so I started thinking I could create them. Now next door to me lived a computer programmer. The guy before him in the same house was a computer programmer as well. And the guy after him, again in the same house, was also a computer programmer. They never seemed like they were working very hard at all; in fact they were always hanging out in front drinking a beer. I asked one of them, "If I wanted to program games what would I need to do?" "Learn C++." So I bought my very first programming book around 1994 or 1995. It was Sams Teach Yourself Visual C++ in 21 Days and it came with MS Visual C++ 2.0! Man I was hooked. I made it most of the book without much trouble, until I got to pointers and references. Then it got a little tough. Then I got my license and started having a social life. I stopped programming for a while. During my senior year in high school I enrolled in a Visual Basic course at the local junior college. This was when I noticed that programming seems to be a natural ability for me. While many people, mostly adults, were struggling with the concepts, I thought it was a breeze. So I decided that my major would be Computer Science with a minor in Physics; this was so I could make 3D game engines. Fast forward several years and I was finally finishing up school and job hunting. I first applied at several game companies. One was kind enough to send me back a test. I never got an interview though. Simultaneously I was leading a World of Warcraft guild and had made the guild website from scratch in PHP and MySQL as a side project. The game thing wasn't working out and my fiancee found a job posting for a PHP / MySQL developer. I ended up working there for two years maintaining and enhancing a web application. I now work at another small company writing all sorts of custom applications and software in PHP and either PostgreSql or MS Sql. I'm really glad that I don't work for a game company. Most of the game programmers are over-worked and underpaid and their compensation is, "But you work for a game company!!!" I work 9 to 5, almost never stay late, get my vacations, and probably earn more than the average game developer. (edit) Small addition. While in college I still thought I was going to be a game programmer so I took all sorts of hard core classes in 3D programming, artificial intelligence, and computer architecture. I never once took or thought about taking any classes in databases or web based technologies. Funny how things turn out.
  18. Only in certain contexts. @dflow, you're going to need to show us more code that is relevant to your problem. We need to know how the value is created (or where it's coming from) and see how you're trying to insert it into your database. We'd also need to know the table structure for the table you're inserting into.
  19. I haven't used MySQL in almost two years, but I use all of the equivalent features in PostgreSql, except the event scheduler.
  20. PHP doesn't offer function overloading. You have to: + Use default parameters (if they'll work in your case) + Use differing function names (as if you were programming in C) + Use unnamed and variable arguments (which will render your code difficult to use)
  21. Where did this requirement come from? Your passing thoughts or the client?
  22. If you look at the query that was echo'ed, you can plainly see that $regionrow[$region_id] is not set.
  23. This is going to be chaos and inaccurate on a high traffic site.
×
×
  • 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.