@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info


Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10



Comments:

<TodoInTX> it's fine if you use usr_login = now()
<TodoInTX> not if you use usr_login = 'now()';
<eml> okay
<eml> Whole query: UPDATE bolted_users SET usr_login=now() WHERE usr_id=1
<eml> doesn't go through at all in the mysql-prompt
<TodoInTX> eml: hrm.. I did this... mysql> create table bolted_users ( usr_id int(4) AUTO_INCREMENT , usr_login TIME, PRIMARY KEY (usr_id) ) ;
<TodoInTX> eml: then mysql> insert into bolted_users VALUES(Null, now());
<TodoInTX> eml : then mysql> UPDATE bolted_users SET usr_login=now() WHERE usr_id=1 ;
<TodoInTX> Rows matched: 1 Changed: 1 Warnings: 0
<eml> it works for me in the mysql-prompt too, but not in php
<eml> I'm out of ideas on how to debug this
<TodoInTX> put your php code in a pastebin and ask #php since the DB and SQL query is fine.
<eml> okay
<Andr> "In addition, it is not a good idea to "double up" on indexes. In other words, don't put a Primary key non-clustered index on a column, and a clustered index on the same column (this is possible, although never a good idea)" , what does he mean with this?
<Andr> i should not use compound indexes ?
<JustinTArthur> This is probably a really stupid question, but why does my LONGBLOB field return things like "[B@14b6bed" in select statements? o_o
<eml> http://pastebin.com/572414 <- query is on line 37 if you're interrested
<jpm_> Therion: why would i need a sense of humor over here? for your weird jokes?
<jpm_> Therion: but those are not funny
<RZA-Razor> how do i stop it from beeping?
<jpm_> mute the sound
<bobfield> eml, would it work better if you freed the result after you formatted your next query?
<eml> bobfield, I thikn you found the error, seems like that query doesn't return a valid mysql result
<bobfield> Just thinking that $row might not hold anything meaningful after mysql_free_result is called
<RZA-Razor> jpm
<RZA-Razor> the beep is not coming from my speakers
<RZA-Razor> its coming from the motherboard
<eml> bobfield, good point
<eml> bobfield, don't think that was it tho
<bobfield> no? hmmm...
<ikonia> chaps, I'm looking for some specific SQL query help
<ikonia> I have a field in a database that contains the html for a webpage
<ikonia> I need to write some sql the will remove all the <font face=blah blah> and </font> tags from it
<ikonia> removing the </font> tags is not a problem
<ikonia> but the opening <font face=X size=X etc> is a problem
<***yKen> Okay guys --- if I have a datetime field, and I want to query only the date (based on today) from that field how do I do so?
<***yKen> select * from table where date = current_date does not work
<firewire> where date = cur_date()
<***yKen> That doesn't do it...
<firewire> sorry, where dat_col = current_date();
<***yKen> select * from table where date = current_date does not work
<***yKen> I tried that
<bobfield> select * from table where date_format(date,'%Y-%m-%d) = curdate();
<***yKen> Works like a charm.
<***yKen> Thanks bob
<bobfield> you're welcome
<firewire> is it a datetime?
<bobfield> ikonia, I came up with something but it only eats one instance
<ikonia> bobfield I'd appriciate any help at this moment in time
<ikonia> its a cms system with over 2000 records
<ikonia> so stipping font tags by hand is not an option
<bobfield> concat(left(@string,@pos:=locate('<font',@string)-1),right(@string,length(@string)-locate('>',@string,@pos)))
<ikonia> so stipping font tags by hand is not an option
<ikonia_> sorry about that
<ikonia_> cat jumped on laptop
<ikonia_> bobfield can you say again please
<bobfield> concat(left(@string,@pos:=locate('<font',@string)-1),right(@string,length(@string)-locate('>',@string,@pos)))
<ikonia_> and exactly what will that do
<ikonia_> I'm just walking through it
<bobfield> eats from @string first instance of <font ... >
<bobfield> result of first locate is stored in @pos, used in second locate
<ikonia_> so if I have 10 lines of <font> I'll have to run this 10 times per record
<ikonia_> is that right ?
<bobfield> yes you'd have to run it iteratively
<ikonia_> ok, so how can I use that against a specific table and firled
<ikonia_> field
<ikonia_> eg concat blah from table_field
<ikonia_> if you see what I mean
<bobfield> update yourtable set yourfield = concat(...)
<ikonia_> got you
<ikonia_> ok
<ikonia_> mega
<bobfield> until rows changed=0
<ikonia_> 881 rows effected !
<ikonia_> cool
<ikonia_> oops
<ikonia_> blanked the whole db
<bobfield> did you substitute your field for @string ?
<ikonia_> guess that needs a bit more consideration
<ikonia_> yup
<ikonia_> i'll have to re-check
<bobfield> hopefully yoi'
<bobfield> hopefully you've a backup
<ikonia_> oh yes
<ikonia_> test db
<bobfield> very smart idea
<mzantsi> hgd
<fromvega> Hello
<ikonia_> hey, can't rush in and start alerting data on a live db
<ikonia_> I an drop this one all night
<bobfield> I run a small db right on my laptop, can lose the whole show if I like
<fromvega> How does mysql indexing works? For instance, I have a table with some columns like USER_NAME, USER_COUNTRY etc. Can I let it (the table) ordered by a specific column, like USER_NAME for instance or this ordering just occours on SELECT queries?
<bobfield> the query will work just fine without the index but the index can help the performance
<fromvega> but can I let the table data ALREADY indexed? I mean, instead of ordering in the SELECT query?
<ikonia_> bobfield is it possible to expand the scope of that query
<ikonia_> Degola:
<bobfield> you mean more than one field?
<ikonia_> no
<ikonia_> so its a little more generic
<ikonia_> Degola:
<bobfield> ah
<ikonia_> for example
<ikonia_> left <font right=> and then remove everything in between
<ikonia_> so it removes all <font %%%%% > tags
<bobfield> instead of just the first instance per row?
<ikonia_> yeah
<ikonia_> so any <font %$£""$%> tags are removed
<ikonia_> so the while field is stripped of any sort of <font> tag
<bobfield> I think that would need a stored function
<bobfield> with a loop
<ikonia_> the sql equiv of a while loop
<ikonia_> or
<ikonia_> I could be lazy
<bobfield> REPEAT stmt UNTIL condition;
<ikonia_> and just have something that did
<bobfield> REPEAT stmt UNTIL condition END REPEAT;
<ikonia_> remove <font $everything until the first >
<ikonia_> and run it a 100000 times
<bobfield> well I'm guessing this is a one-off cleanup operation?
<ikonia_> yeah
<ikonia_> updated to css
<ikonia_> but due to custom tags
<ikonia_> not all pages are the same
<ikonia_> so I need to strip all font tags
<ikonia_> so that all pages are foced to css
<bobfield> *nods
<ikonia_> so it will be run once on the test db
<ikonia_> and then once on live
<ikonia_> once test is %100
<bobfield> well a stored function might be just the ticket then if that's an option
<bobfield> run it once and be positive
<ikonia_> sql is not my thing
<ikonia_> I'm pretty basic
<ikonia_> I can create/drop/update etc etc
<ikonia_> but procedures and advanced sql is out of my league
<bobfield> Are you running V5?
<ikonia_> yes 5.1.16
<bobfield> How long are these strings in each row?
<ikonia_> thousands of line
<ikonia_> each row is a full html page
<ikonia_> so could be 100 lines
<ikonia_> could be 1000 lines
<ikonia_> depending on how long the content of the page is
<bobfield> how are they declared, text? longtext?
<ikonia_> mediumtext
<bobfield> okay
<CraZyLeGs> what's wrong with this:
<CraZyLeGs> SELECT M.*, P.label FROM metas M, pages P
<CraZyLeGs> WHERE P.action_id = ( select actions.id from actions where actions.name = 'splash' limit 1)
<CraZyLeGs> AND P.meta_id = M.id
<CraZyLeGs> LIMIT 1


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #mysql
or
Go to some related logs:

#linux
Pyhton __slots__
he1ix
#perl
javascript datetime add days
zamba*meaning
Class driver suspend failed for cpu0
pound GLIBC_PRIVATE
#perl
gparted unclean



Home  |  disclaimer  |  contact  |  submit quotes