Jump to content


Photo

Cmd line mySQL query?


  • Please log in to reply
5 replies to this topic

#1 jmaccs64

jmaccs64
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 18 September 2006 - 03:37 AM

What would cause this from a cmd line mySQL query?
Here is the query...
SELECT * FROM surpool06 WHERE surpool_week='2' ORDER BY surpool_team, surpool_username
In phpmysql there appears to be line breaks in some fields before it lists surpool_team?
And those are the fields that are messed up.... What could be causing this?

Thanks
+------------+-----------------------+--------------+--------------+
| surpool_id | surpool_username      | surpool_team | surpool_week |
+------------+-----------------------+--------------+--------------+
|        172 | big daddy d           | 
Bears      | 2            |
|        262 | dancsu17              | 
Bengals    | 2            |
|        170 | big daddy d           | 
Chargers   | 2            |
|        168 | big daddy d           | 
Colts      | 2            |
|        169 | big daddy d           | 
Colts      | 2            |
      | 2            |               | 
      | 2            |               | 
      | 2            |               | 
      | 2            |               | 
      | 2            |leman          | 
      | 2            |ime            | 
    | 2            |irter            | 
    | 2            |npa24            | 
    | 2            |Tate for Heisman | 
    | 2            |tt81             | 
    | 2            |os               | 
    | 2            |r911             | 
    | 2            |an               | 
    | 2            |                 | 
    | 2            |lo               | 
    | 2            |rtime            | 
    | 2            |rtime            | 
    | 2            |g1429            | 
    | 2            |a64              | 


#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 18 September 2006 - 06:34 AM

Is the problem that the output looks wierd when you run the query from the CLI?

#3 jmaccs64

jmaccs64
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 18 September 2006 - 03:18 PM

Yes....And there are line breaks in the fields in phpmysql.

I think i have figured out why the form that was inserting data may have had a break in it....but now i would like to remove all line breaks from the database is that possible, and if so how?



#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 18 September 2006 - 05:31 PM

Shouldn't be to difficult to issue a REPLACE() and to strip CR/LFs.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#5 jmaccs64

jmaccs64
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 19 September 2006 - 02:18 AM

I am so new at this..... I would not even know where to start?

Would I replace "/n" with ""

???

Thanks

#6 jmaccs64

jmaccs64
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 19 September 2006 - 02:43 PM

I figured it out here is what I did!

UPDATE `myTable` SET myField = replace(myField,"\r","") ;





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users