Jump to content

Edgewalker81

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Edgewalker81's Achievements

Member

Member (2/5)

0

Reputation

  1. Ok, I found my solution on my own, and it's the "UNION" statement. I assumed that UNION would return duplicate rows if the results overlap. It does not. It's pretty simple really. You just UNION both queries (one by date and one by quantity) and you'll wind up with the larger of the two as the final result.
  2. I'm trying to offload some of my PHP control structure "workload" to MySQL for scalability. Here is a pseudocode example of what I'm trying to do SELECT the first 20 records from event_dates that have a date>today OR the next three weeks, whichever is the larger set I know how I'd write those queries individually, but not sure how to combine them to avoid having to grab 2 sets, waste time comparing them via PHP, and throw one set away. (MySQL 5.0 as part of WAMP)
  3. Aha! This was a little surprising, so it might help someone else to know. If you are getting this error, and your code is correct, this may be your problem: I have been saving my files in UTF-8 format, but it looks like the byte-order-mark was somehow being outputted at the start of the file. The solution was to save as "ANSI" or "UTF without BOM," which may actually be equivalent.
  4. I keep getting this error, even though I know my code is correct. I'm attempted to use "session_start();" at the very beginning of a file.
  5. Lately I've discovered the technique of creating pretty looking buttons and links by using fixed dimensions with nice background images and giving the elements some enormous (-9999) text-indent to hide the text that keeps the box itself visible. I've noticed this method used in many places, but it seems a bit like a band-aid solution. Is there a better way to achieve this effect? I don't like to feel like I'm working around the standards instead of working with them.
  6. Yes, thank you, and I also now have a much better general understanding of how to use JOIN.
  7. You never actually performed your query. At some point you will have to do something like $result_set=mysql_query("SELECT user FROM users WHERE user=\'$user\'"); Then get the information you're trying to test for from the result set.
  8. I have two tables in this project I'm working on, and one looks like this: schools --------- school_id school_name address1... etc. etc. events --------- school_id event_type start_time... etc. etc. What I want to do is retrieve a list of all events ("SELECT * FROM events WHERE ...") but sort that result set by the school_name. I'm sure SQL allows this... I keep trying to "JOIN" somehow, but I haven't gotten it right yet. Any help appreciated, thank you in advance.
  9. Yeah, I was thinking something like that. Luckily this system is pretty much being redesigned from scratch, so I can change the way it's set up. Thanks for the help.
  10. I just knew you'd ask I'd rather not, to be honest, but the project is for barcoding a large number of items, and I need to be able to answer the question "what is this thing?" It might be an order form, a service request, a CD, a bag of photos, or many other things. They are all scanned into one field by the user, so the system has to be able to figure out what the item is so it can display the info relevant to that item type upon being scanned. I'm thinking an table that indexes what each item is might be in order...
  11. Is a way to make custom primary keys based on auto-increment? Now I insert a row, then use mysql_insert_id() to get the number, alter it (adding a prefix such as "E-") and save it in another field. Is there a way to simplify this? I want the prefixes is so I can know what kind of object it is, and so which table it is in. I can't just make one table because the items have no data fields in common. I thought of just making a table with an autoincrement field and a field for which table the item belongs to, but I'm worried that if the number of items grows large, it would be quicker to have my PHP check the prefix and just do one query instead. Any advice appreciated.
  12. I'm looking for a well-worded response to the kind of question that often appears on tech forums about something that could EASILY be solved with a simple Google search- particularly when the person asking the question doesn't get an answer and bumps the thread repeatedly with increasingly irritated replies like, "Thanks for being utterly useless!" Eventually someone will help them, and point out that they are wasting the time of people who are helping people with real problems for free. I know that if I browse long enough, I'll find one or two, but I thought maybe somebody had a pet cut/paste one or a good link to one that is appropriately cutting, but still fairly civil.
  13. Thanks for the help. It was really just 500 instances of one error (being that I forgot to include quotes around my attribute values, which as far as I know doesn't affect the problem I was having). I got XHTML validation by just inserting quotes where they ought to be. In the end I got it to work by just making the images 10px x 10px, and it works in every browser I've tested since then. I'm a little intimidated by the orders of magnitude more complex a single-image solution is, but I plan to move in that direction as time permits. Any suggestions? I was thinking of working with php's GD2 libraries.
  14. Well, then I can only assume there is something about the way our printers are set up here, which is very helpful. Thanks!
  15. I was trying to make a very naive version of a barcode generator using code39 (it's based on just stretching out white and black 1x1 gifs in sequence) The result is a correct barcode, and if I print it in IE it scans great. The problem is printing (from apparently any computer to any printer) in FireFox garbles the code, almost like FF is just throwing out some images. Suggestions? Should I scrap this and go down the long road to php image generation? Here's where I have my test: http://www.edge-walker.com/barcode_tests/test.php I don't want anybody wasting paper on my account , but printing from firefox does give you something very different from what is on the screen. Relevant code: $black='<img src="b.gif" height='.$height.' width='.$width.' />'; $white='<img src="w.gif" height='.$height.' width='.$width.' />'; $encodings['0']="$black$white$black$white$white$black$black$white$black$black$white$black"; // Encodings continue in that manner... $html_string=$encodings['*'].$white; $pos=0; while($pos<strlen($text)) { $html_string.=$encodings[$text[$pos]]; $html_string.=$white; $pos++; } $html_string.=$encodings['*']; return($html_string);
×
×
  • 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.