Jump to content

artacus

Members
  • Posts

    737
  • Joined

  • Last visited

    Never

Everything posted by artacus

  1. No problem, do it like so: [code] SELECT * FROM member AS m JOIN pokes AS p ON p.poker = m.id OR poked = m.id JOIN photo AS pic ON m.id = pic.id WHERE p.poker = 123 OR p.poked = 123 GROUP BY m.id[/code] BTW. Your apps will always perform better if you let SQL do your grouping, filtering and aggregate functions. You CAN do it in PHP but thats what databases were designed to do and they do it much faster. Not to mention your code will be more maintainable.
  2. So if your current id is 42, you'll want to pull 39,40,41 right? [code] SELECT * FROM products WHERE id < 42 ORDER BY id DESC LIMIT 3 [/code]
  3. It SHOULD work. I do this often. What happens when you reverse the order? My guess is the problem lies with your actual AJAX calls.
  4. Yeah I was trying to save a CSV file in this way but it can't be done w/ AJAX Javascript it seems.
  5. After doing some googling, it appears that you need to set a small delay before setting focus in Firefox. I haven't tested it but try this: [code] setTimeout(function(){objInput.focus()}, 100);[/code]
  6. Well save the query as a variable and add an [code]or die(mysql_error() ."<br>$query");[/code] to the end of your mysql_query statement. It helps to troubleshoot if you can see what went wrong. Having the wrong column count is the most common problem for that type of query.
  7. No. objInput should be a reference to your input field. The function is called like so: (You could just add the onBlur when you are writing the input and get rid of the attachFormHandlers() call. <input type="text" id="depletions100" ...snip... onBlur="validateMe(this);" /> So in your function validateMe(objInput) <- objInput is referencing the input because of "this" so you would just do: objInput.focus();
  8. A pilcrow huh? I learned something new today. See if this works: UPDATE mytable SET myfield = REPLACE(myfield,'ΒΆ','') If it doesn't you'll have to do it in PHP using str_replace(chr(182),'',$row['myfield']); you can use ord() and chr() to get to wierd non-printable characters.
  9. "select top 5 name..." TOP is a MS SQL thing. If that's what you're using and what you want to do, thats fine. It limits the results to the first n rows. It doesn't really fit in with what you are trying to do. And if you are using mysql it will just error out.
  10. Are the two databases on the same db server? If so you can copy it over with a single sql statement like so: INSERT INTO other_db.table1 SELECT stuff FROM table3 If they are on separate servers, you will need two connections: $dbcon1 = mysql_connect(); $dbcon2 = mysql_connect(); And you'll need to specify which server when you do a query $result = mysql_query($query,$dbcon1);
  11. A little bit cleaner than having a daisy chain of OR's is to use IN SELECT * FROM people WHERE job IN (3,5,7)
  12. I'm not following how you are using an onBlur here without having it specified in your <input>. Anyhow you should be able to set focus with objInput.focus();
  13. If you've got to refresh to see updates then yes its a caching issue. Try <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> in the head of your document and see if that helps.
  14. If you are echoing this from inside a function, it won't be in the function's scope unless you use "global"
  15. So? That pretty much sums up what PHP applications do. What is your question?
  16. Yes its inclusive, but when you are in doubt about these things, just test them SELECT IF('2006-12-01' BETWEEN '2006-11-01' AND '2006-12-01',  'YES', 'NO')
  17. Absolutely SELECT DATE(myTimestamp) AS myDate, TIME(myTimestamp) AS myTime or DATE_FORMAT(myTimestamp, '%Y-%m-%d') AS myDate check out the date/time section of the mysql manual for all of your options.
  18. You probably don't need more than 8 to 10 characters on the html form. But you don't really even need to worry about it. Just set the db field wide enough to store the output of PASSWORD()
  19. The length of the password before isn't related to its length after encryption SELECT PASSWORD('f') //*241E241B694B4F0B740CF5B9775AFD9A511E1CEC SELECT PASSWORD('This is my really really long password') //*23218AC3A2F0CA3DF720A86F399AF85C36CFDEDE
  20. You can't do $Array1[0][] = 1 ?
  21. Do you have a db connection? Its always a good idea to use: mysql_query($query) or die(mysql_error()); So you can see exactly where it went wrong.
  22. [code] SELECT pid, name_last FROM TabA LEFT JOIN TabB ON TabA.pid = TabB.pid AND TabB.encounter_class_nr=1 AND TabB.is_discharged = 0 WHERE TabB.pid IS NULL [/code]
  23. missing {}'s and you need your IP address like 63.64.65.66
  24. Ok then, and answer and a half for the price of one.
  25. I'm not sure but it sounds like you've got the wrong character set. Try SELECT CONVERT(field USING latin1) FROM table and see what that does.
×
×
  • 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.