Forum Moderators: coopster

Message Too Old, No Replies

Varchar col, cannot echo it all

echo display only first word

         

henry0

3:31 pm on Dec 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am in debug mode
And echo values passed from a query to another page
For example: $sub_cate_title= mysql_result($result,$i,"sub_cate_title");
The value is made out of two words like aaa (there is a space between) and bbb
Instead of echoing aaa bbb I only get the first part aaa
However the data is fully entered in the DB

What could I forgot about?

cmarshall

3:59 pm on Dec 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are hundreds of possibilities.

Without your code, no one can help you.

henry0

4:05 pm on Dec 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks but it has nothing to do with code
the value were entered as aaa "space" bbb
and I retrieve only aaa
I foresee a possible problem with char and varchar ways of handling spaces

The question is what can I do about it?

coopster

4:26 pm on Dec 26, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Have you viewed the source in the browser to make sure that the data really isn't there? What I'm saying is that perhaps the browser just isn't rendering something correctly? View source or use htmlentities() on the row's value when you echo to the browser to make sure.

jatar_k

4:42 pm on Dec 26, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



go to the command line

paste in your query and see the result, I can (almost) guarantee it isn't a mysql problem

if the query in the command line returns the proper result then look to php's handling of the returned result

if the command line turns up the same thing then look to your query

henry0

4:44 pm on Dec 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Real strange
it's not in src
and htmlentities() did not change anything

the values are in the BD varchar is 30
and the exact example is Travel (a regular natural space) Hospitality

cmarshall

4:45 pm on Dec 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've never had any problem with any type of characters in VarChar, Text, Blob, etc.

That's why I would be interested in the code. There is something else going on here. I sincerely doubt it has to do with the MySQL code.

In any case, I'll keep an eye out on this thread to see if you find an issue. Maybe someone else may have a better suggestion.

henry0

4:51 pm on Dec 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Jatar_k
The first section of the same page I take the result from is displaying existing returns(by using a query as the one posted above) from a table
those values are displayed as intended!

next when I pass the same values via hidden field to the next page then I get only the first word

jatar_k

4:52 pm on Dec 26, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



do you have quotes around the values in the hidden fields?

view source on the posting page and then dump the POST array on the next page

it is an html issue I believe

henry0

5:01 pm on Dec 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ARRRHHHHH!
This did it
I am sorry
to report that I wasted your precious time
By forgetting a pair of single quote to surround my var
Thank you

jatar_k

7:32 pm on Dec 26, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



np

I've done the same thing myself many times ;)