PHP SQL problem!!

MRSN

T20I Star
Joined
Oct 20, 2010
Runs
30,597
Friends I need your help with this problem related to php sql..

so there is a field containing "0" value in the table.

When I echo it out there's nothing on display but if I enter some random value then it displays that but if it is "0" it does not.

why is the "0" not being displayed?

It would be great if anyone could help me. I am stuck here..:(
It
 
Make sure you are using 'int' datatype in the database and also when you are storing the value into the table you are typecasting it as '(int)'
 
Make sure you are using 'int' datatype in the database and also when you are storing the value into the table you are typecasting it as '(int)'

yeah I have that as int in database but I haven't stored anything yet. I was trying to fetch value from another page which contained the query but was returning null instead of "0" hence it was not displaying...but now I exclusively called query in that page and now it is working fine.
 
Friends I need your help with this problem related to php sql..

so there is a field containing "0" value in the table.

When I echo it out there's nothing on display but if I enter some random value then it displays that but if it is "0" it does not.

why is the "0" not being displayed?

It would be great if anyone could help me. I am stuck here..:(
It

Did you try 0.0? Remember something like this a long while ago.
 
Post your code.

The problem has been kind of sorted out brother as I used alternative way of getting the value from the database. Before I was using a function to return the value from another page to index.php and as the field contained "0" it was sending it as a null..once I performed the query in the page it works there. there is nothing wrong with code. it's the same code I copy and pasted in the index page.
 
We can only help if you can share those code snippets. Most probably its because of int VS NUMBER VS DECIMAL data-type. You can always include a check of something like if($row['num']=='0' && !empty($row)).. Can only tell the exact cause once there's some code.
 
Back
Top