Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
mysql database strange problem
Old 06-23-2009, 07:37 AM mysql database strange problem
Skilled Talker

Posts: 83
Trades: 0
Hello,

Recently i have noticed that it is impossible to look up certain records. I want to look them up by the field 'model'. This contains numbers like 504010 or 55822S.

Certain numbers are found, others are not (however they are there!). It looks to happen random. When i go to phpmyadmin, click the search tab and enter my number behind the "model" field, it returns also 0 records. However when i check the explore tab, the number i just entered is there. So why is it not found? I checked and there are no spaces or something like that.

The only thing that is consistent (at least i think so), is that in the explore tab in phpmyadmin, the numbers that are found are aligned to the top of the cell, the numbers that are not found are aligned to the bottom of the cell. Does this ring a bell?

Thanks!

Matt
killerwhale65 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-23-2009, 08:12 AM Re: mysql database strange problem
akratellio's Avatar
Experienced Talker

Posts: 30
Location: Berlin Germany Europe World
Trades: 0
hi killerwhale65,

what type do you use for 'model'?
if it's an int you might have problems with numbers starting with 0,
if it's a string you maybe can't compare via = easy.

i think it would be best if you would post the mysql structure and your query too.

mfg akratellio
__________________
I'm always lying...
Ich lüge immer...

Please login or register to view this content. Registration is FREE
akratellio is offline
Reply With Quote
View Public Profile Visit akratellio's homepage!
 
Old 06-23-2009, 10:35 AM Re: mysql database strange problem
Skilled Talker

Posts: 83
Trades: 0
hello,

model is a varchar(10) because it can contain a letter as well.

my query is: SELECT aantal FROM backorder where model='".$model."'"

But like i said, its the same when i use the search function of phpmyadmin, and enter the model-number next to 'model' (tried both LIKE and = without luck).

Thanks!
killerwhale65 is offline
Reply With Quote
View Public Profile
 
Old 06-23-2009, 10:53 AM Re: mysql database strange problem
Skilled Talker

Posts: 83
Trades: 0
ok i think i have discovered something:

When i export the table, i notice some model numbers like '123456' and others like '\n123456'.
killerwhale65 is offline
Reply With Quote
View Public Profile
 
Old 06-23-2009, 11:04 AM Re: mysql database strange problem
Skilled Talker

Posts: 83
Trades: 0
Solved with this query:

UPDATE `backorder` SET `model`=replace(`model`, '\n', '');

Now i only need to figure out how the \n got in there.
killerwhale65 is offline
Reply With Quote
View Public Profile
 
Old 06-24-2009, 06:29 AM Re: mysql database strange problem
akratellio's Avatar
Experienced Talker

Posts: 30
Location: Berlin Germany Europe World
Trades: 0
hi,

'\n' oftenoccurs when you get input via forms, namely textareas.
Since you don't escape inputs by using nl2br or something all line breaks will be '\n'

mfg akratellio
__________________
I'm always lying...
Ich lüge immer...

Please login or register to view this content. Registration is FREE
akratellio is offline
Reply With Quote
View Public Profile Visit akratellio's homepage!
 
Reply     « Reply to mysql database strange problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30860 seconds with 12 queries