Jump to content

fenway

Staff Alumni
  • Posts

    16,168
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by fenway

  1. It will not "go away" -- it is stored in the proc table of the mysql database.
  2. mysql regexp simply returns a boolean -- there's a UDF at mysqludf.org that has a more useful regexp egine.
  3. fenway

    syntax error

    Yes, and enough upper case.
  4. Run the EXPLAIN... I think you'll see a dependent subquery, which isn't optimal
  5. Not a particular helpful comment, I suppose. You have to issue your SET statement separately from your SELECT statement. Alternatively, you can use a CASE statement to declare your variable in-line to save the 2nd statement.
  6. Unfortunately, it's not possible to use dynamic table names.
  7. You can GRANT the appropriate permission -- create table and create database are necessarily different.
  8. There's a whole sticky dedicated to this topic.
  9. Well, I mean the columns in the target table...
  10. Well, you only need to "load" it once... and since the stuff in the .sql file is SQL statements, yes.
  11. OK... so you need: INSERT INTO `accounts_pkgs` ( <column-list> ) SELECT <column-list> FROM `account` WHERE carrier_id=6 What will you be inserting?
  12. By "insert" you mean update the matching rows?
  13. LIMIT 0, 30 is probably not what you mean... the syntax is LIMIT <number>, <offset>. You're always getting zero rows back.
  14. Ho, but you can use it in a HAVING clause ... BETWEEN 25 and 27 would be eaiser to read though. Also, if DOB is a real date, there are some cleaner ways to determine age.
  15. I know what you need; I was just hoping to see some further attempts to "complete it"; you already have the complex part. records.challengeid<->challenges.id....records.playerid<->player.id. select r2.score, p.name, c.name from ( select r.recordID, max(r.date) AS maxDate from records AS r inner join ( select challengeID, min(score) AS minScore from records group by challengeID ) as t2 on ( t2.challengeID = r.challengeID AND t2.minScore = r.score ) group by r. challengeID ) as r1 inner join records as r2 on ( r2.recordID = r1.recordID and r2.date = r1.maxDate ) inner join players as p on ( p.id = r2.playerid ) inner join challenges as c on ( c.id = r2.challengeid )
  16. As you can see, you have nested single quotes that aren't escaped... I'm guessing that because you assigned the result of mysql_real_escape_string to a variable, PHP simply stripped to escaping backslashes. Try: mysql_query("UPDATE livejobs SET description='".mysql_real_escape_string($description)."' WHERE description='.mysql_real_escape_string($initialdescription).'")" or die(mysql_error()); [code] [/code]
  17. No, you wan't the opposite: $result = mysql_query("SELECT * FROM image WHERE img_name = '$img_name'"); And yes, check mysql_error() too.
  18. Specifically here. Easiest way to get around this (since the list can change) is to use an underscore in column names.
  19. A number of reasons -- sometimes, where clauses are added to on-the-fly, so have 1=1 means it's easy to say "+= AND .... " (though joining an array is cleaner); I always like to have a WHERE clause so that it doesn't look like an accident.
  20. Are you talking about HTML output?
  21. $img_name needs quotes around it.
  22. Just to evaluate to true.
  23. Nope... that's php code... echo that string.
  24. say what?
×
×
  • 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.