Jump to content

bubblegum.anarchy

Members
  • Posts

    526
  • Joined

  • Last visited

    Never

Everything posted by bubblegum.anarchy

  1. hmmm... The following: ALTER TABLE ADD column_name varchar(255); Adds: column_name varchar(255) The following: ALTER TABLE ADD column_name varchar(256); Adds: column_name text
  2. Where is the value for $emails coming from?
  3. Then change the last OR to an AND, and the parenthesis are not required..
  4. What about situations that involve more that one grouped record containing the highest total count?
  5. $sql = "select program.*, repetitive_program.* from program, repetitive_program where "; $sql .= "(program.weekday like '%$day%' and program.repeat='w') or "; $sql .= "(program.weekday like '%$day%' and program.repeat='a' and program.alt_repeat='$week') or "; $sql .= "(program.repeat='n' and program.special_date='$date')or "; $sql .= "(repetitive_program.pid = program.pid and repetitive_program.r_timing != program.timing) "; $sql .= " order by program.timing, repetitive_program.r_timing"; What is the highlighted part of the query supposed to be doing?
  6. <?php $result = mysql_query($query = "SELECT id FROM email WHERE address = '{$address}'") or trigger_error(mysql_error()."<PRE>".$query."</PRE>", E_USER_ERROR); if (mysql_num_rows($result)) { ; // email address registered } else { ; // email address IS NOT registered } ?>
  7. Lock the table: http://dev.mysql.com/doc/refman/4.1/en/lock-tables.html
  8. The GET id needs to be quoted at the end of the following line: if($_GET['id']){$select="select * from press where id='$_GET[id]'";} maybe even change the line to the following: if($_GET['id']){$select="select * from press where id='{$_GET['id']}'";}
  9. Can someone else please confirm mine or binindexs' results?
  10. Store paragraphs normally like a text file with paragraphs seperated by two newlines and then output the paragraph something like this: <?php $result = mysql_query("SELECT history FROM repository WHERE id = 1"); if (mysql_num_rows($result) && (list($record['history']) = mysql_fetch_row($result)) { $record['history'] = "<P>" . str_replace("\n\n", "</P><P>", $record['history']) . "</P>"; print $record['history']; } ?> The above would not be appropriate for complex formatting, like colours and type styles... user defined code blocks like forums use may be more appropriate if more complex formatting is required.
  11. Pretty much, replace the word JOIN with UNION.
  12. Your best option is probably to read up on mysql database table design first... the information being requested describes certain properties of each table column, how data is stored in said column as well as particular responses to certain circumstances.
  13. 4.1.21-community-nt I copied and pasted the following query into SQLyog SELECT collections.id , collections.subject , collections.numfiles , collections.groups , collections.size , collections.from , collections.date , collections.nfo , ( SELECT sum(mainsubjects.num) FROM mainsubjects INNER JOIN collectionpartids ON mainsubjects.id = collectionpartids.fid AND collectionpartids.cid = collections.id ) AS mainsubjects_num , ( SELECT sum(mainsubjects.max) FROM mainsubjects INNER JOIN collectionpartids ON mainsubjects.id = collectionpartids.fid AND collectionpartids.cid = collections.id ) AS mainsubjects_max FROM collections WHERE MATCH (collections.subject) AGAINST ('dvdr' IN BOOLEAN MODE) GROUP BY collections.id ORDER BY collections.date desc; ... and got the following result: id numfiles size from date nfo mainsubjects_num mainsubjects_max 269 107 5120108628 nosugar@tea.cup (Team TeaBag) 1175864267 97566 13170 13181 104 1 51733781 nosugar@tea.cup (Team TeaBag) 1175857722 0 133 133 265 2 163922 nosugar@tea.cup (Team TeaBag) 1175857214 0 2 2 12 1 51696885 nosugar@tea.cup (Team TeaBag) 1175857049 0 133 133 240 113 5336665215 nosugar@tea.cup (Team TeaBag) 1175854563 97157 13740 14045 172 113 5314060198 nosugar@tea.cup (Team TeaBag) 1175853137 97072 13675 13993 85 113 5386441836 nosugar@tea.cup (Team TeaBag) 1175852973 96951 13860 14075 338 2 19414 nvnvrlnd@ovrdarainbow.com (disorder) 1175840232 96210 2 2 90 106 5086235798 nosugar@tea.cup (Team TeaBag) 1175827371 94315 13084 13084 194 2 6035845 nosugar@tea.cup (Team TeaBag) 1175820296 0 17 17 210 1 38831745 nosugar@tea.cup (Team TeaBag) 1175820239 0 100 100 117 1 36125626 nosugar@tea.cup (Team TeaBag) 1175820002 0 93 93 5 106 5087442717 nosugar@tea.cup (Team TeaBag) 1175783674 93924 13085 13085 47 1 2978 nosugar@tea.cup (Team TeaBag) 1175682268 90545 1 1 114 2 929738 nosugar@tea.cup (Team TeaBag) 1175682173 0 3 3 306 105 5014443546 nosugar@tea.cup (Team TeaBag) 1175676395 90728 12901 12901 152 1 185791 nosugar@tea.cup (Team TeaBag) 1175671382 0 1 1 323 1 42488051 nosugar@tea.cup (Team TeaBag) 1175671305 0 109 109 14 106 5090985562 nosugar@tea.cup (Team TeaBag) 1175667861 88228 13098 13098 396 1 51726714 nosugar@tea.cup (Team TeaBag) 1175573600 0 133 133 179 106 5078252211 nosugar@tea.cup (Team TeaBag) 1175428830 75897 13091 13091 290 76 3322073885 nosugar@tea.cup (Team TeaBag) 1175419718 76055 8562 8562 161 1 33289201 nosugar@tea.cup (Team TeaBag) 1175408043 0 86 86 287 107 5139767976 nosugar@tea.cup (Team TeaBag) 1175405620 74049 13232 13232 141 1 126979 nosugar@tea.cup (Team TeaBag) 1175404705 0 1 1 EDIT: for some reason the subject and groups columns did not copy across in this post but the columns appear in the result set.
  14. Unfortunately, the following does not appear to work in mysql version [ 4.1.21-community-nt ]: SELECT CONVERT('5,692.23', DECIMAL); This following may be a good option: INSERT INTO Prices (Price, Shipping) VALUES (REPLACE('5,692.23', ',', ''), REPLACE('6,000.50', ',', ''))
  15. Leave off the WHERE clause if < Any Country > is selected, something like: $sql = " SELECT * FROM house WHERE TRUE " .( $_REQUEST['country'] != "any" ? " AND hcountry = ".to_string($_REQUEST['country']) : null ) .( $_REQUEST['area'] != "any" ? " AND harea = ".to_string($_REQUEST['area']) : null )." ORDER BY value"; to_string() is a user defined function that should return a safe sql quoted string
  16. The values listed in the error are not quoted.
  17. Probably the following: ALTER TABLE table AND FULLTEXT FT_DESCRIPTION (column1, column2);
  18. Consider something like this (pretty much the same but with disc_id added to track): disc.id disc.artist_id disc.name disc.release disc.asin track.id track.disc_id track.artist_id track.name track.lyrics artist.id artist.name No need for disc.tracks since each track would be associated via track.disc_id
  19. wow, I did not know that the following is possible: SELECT CURRENT_DATE + INTERVAL 1 DAY;
  20. SELECT adddate(CURRENT_DATE, INTERVAL 1 DAY);
  21. A column cannot contain a computated value based on the position of a row in the final record set - MySQL is not psychic.
×
×
  • 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.