Jump to content

bubblegum.anarchy

Members
  • Posts

    526
  • Joined

  • Last visited

    Never

Everything posted by bubblegum.anarchy

  1. You do not have to specify any closing database connections that are open via mysql_connect(). Just ignore all my posts!!
  2. With the code block of data from your original post opened in vim (a text editor) and the following regular expression command :%s/^\([0-9]*\)\s\(.*\)/'\1','\2'/g will result in each line quoted as so: '23018','14K gold tubular hoop earrings, (3mm tube, 1 3/16" diameter). Pair' '23019','14K gold tubular hoop earrings, (2mm tube, 3/4" diameter). Pair' '23047','14K gold cultured pearl diamond ring. (6 x 10mm, 1.5 points TDW).' '23059','14K gold cultured pearl heart post earrings, (4.5-5 mm). Pair' '23064','14K gold Figaro necklace, (1mm).' '23065','14K gold 18" twisted serpentine necklace, (.5mm). ' '23067','14K gold 18" box necklace, (.5mm). ' '23069','14K gold serpentine necklace, (.75mm).' '23073','14K gold box necklace (.5mm) with hearts (6 x 6mm).' '23074','14K gold box necklace, (.5mm).' '23075','14K gold diamond cut Boston cable necklace, (.5 mm).' '23077','14K gold twisted Singapore necklace, (1 mm).' You may need to run a quick regular expression to addslashes to single quotes before wrapping the id and description in quotes. EDIT: the regular expression is playing havoc with the bbcode
  3. change DEFAULT "3" to DEFAULT '3'
  4. example of what? - the regular expression?
  5. The same mysql_connect() that you have in the second line of your own code.
  6. The SQL posted above needs to be executed on the database server to update the database via myphpadmin or other suitable query browser - be sure that you select the appropriate database before executing the SQL script.
  7. If at all possible, a regular expression may be able to assure that all columns are quoted and comma seperated - then a simple CSV import into an existing database table that has the appropriate table column definitions.
  8. Use TRUNCATE instead so that any auto_increment values are reset. TRUNCATE tbl_name
  9. A procedural trigger may be appropriate if you have access to the mysql 5.1
  10. No changes should be applied to the ms sql database unless there is an explicit command that wipes all the data... backup the database for safety sake.
  11. FYI: mysql_connect() assures that the connection is closed when the script is complete so there is no need to add mysql_close(), unless you want to be super safe.
  12. oh - ok... Clicking the [update Link] button on the link provided produced the following page ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'special2 = '' WHERE id =' at line 1 UPDATE products SET title = '', description = '', retail = '', special = '' special2 = '' WHERE id = $id does not appear to be set anywhere.
  13. You may need to select a database before performing any queries.
  14. I am unsure of the full syntax but the value client_id inside the brackets should not be quoted.
  15. Finding a ready made script for something so specific will be difficult... so many variables - how do you define what two records should be compared? Maybe there is something out there that will plot a graph for a single sorted field for all records in a table, even writing something that does the graphing may not be a difficult task but once, not only conditional comparisons but also conditional records is introduced, the result is a complicated script that is unlikely to exist.
  16. ? the above code block looks exactly like what I posted... are your tables named the same as my hypotheticals? anyway.. I don't know what getArray() does. For: ID SERVICES OTHER_SERV --------------------------------------- 1 A,B,C,E,F B,D,E,G 2 B,D,E E,G,H you should get two rows SERVICES GROUP_CONCAT RESULT EACH ITEM SEPERATED BY A NEWLINE CHARACTER --------------------------------------- A,B,C,E,F Apples Ball Car Egg Fly B,D,E Ball Dog Egg
  17. You can do something like this: SELECT table_one.services, group_concat(table_two.long SEPARATOR '\n') FROM table_one INNER JOIN table_two ON instr(table_one.services, table_two.short) GROUP BY table_one.services But like others have said... normalize!
  18. I am not so sure s.event is the value you are expecting... run the subquery alone to verify the value is what you expect.
  19. Upgrade the server processor.
  20. If I understand you correctly you need to add the following to the WHERE clause: AND messageblocks.username IS NULL
  21. Allowing null values means that a field can have NULL as a value and the NULL value is set as the value of the particular field when an inserting a new record and not providing a value for the particular field, on the other hand a NOT NULL setting for the same insert would produce an error message similar to `field can not be null`- NOT NULL pretty much means that a field must have some sort of value besides NULL when a new record is inserted.
  22. use REPLACE instead of INSERT and make sure that the username has a UNIQUE index.
  23. Is UNSIGNED being applied to a numeric data data? - Post the entire create statement.
  24. The issue here appears to be related with PHP functions rather than mysql specifically - the PHP forum may be more appropriate.
  25. This is all straight out of the MySQL manual: DATETIME A date and time combination. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. MySQL displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format, but allows you to assign values to DATETIME columns using either strings or numbers. TIMESTAMP[(M)] A timestamp. The range is '1970-01-01 00:00:00' to partway through the year 2037. A TIMESTAMP column is useful for recording the date and time of an INSERT or UPDATE operation. The first TIMESTAMP column in a table is automatically set to the date and time of the most recent operation if you don't assign it a value yourself. You can also set any TIMESTAMP column to the current date and time by assigning it a NULL value. A TIMESTAMP value is returned as a string in the format 'YYYY-MM-DD HH:MM:SS'whose display width is fixed at 19 characters. If you want to obtain the value as a number, you should add +0 to the timestamp column. Note: The TIMESTAMP format that was used prior to MySQL 4.1 is not supported in MySQL 5.1; see MySQL 4.1 Reference Manual for information regarding the old format.
×
×
  • 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.