473,321 Members | 1,667 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

how to ignore the empty fields of a database?

10
In my database, some fields are empty for some recordings.
And I wouldl like that the empty fields donīt appear on the answer page of my search engine or, in other worlds, that I donīt have that kind of things (ie age without anything):
Surname : Sawers
First name : Tom
Age:
Nationality : American
Thanks a million!
Jun 22 '07 #1
5 2482
pbmods
5,821 Expert 4TB
Heya, Raphaelle.

You can check for IS NOT NULL in the WHERE clause of your query:

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM `theTable` WHERE `Age` IS NOT NULL
Jun 23 '07 #2
Phaelle
10
In my database, some fields are empty for some recordings.
And I wouldl like that the empty fields donīt appear on the answer page of my search engine or, in other worlds, that I donīt have that kind of things (ie age without anything):
Surname : Sawers
First name : Tom
Age:
Nationality : American

I tried it but I got a result I didnīt expect.
If I put the IS NULL in the WHERE clause, I donīt get the file of Tom Sawers anymore and thatīs not what I want.
I would like the file appear like that
Surname : Sawers
First name : Tom
Nationality : American
The Age field doesnīt have to appear in this case because it hasnīt been filled.
Does it exist a way to do that?
thanks again for your help
Jun 25 '07 #3
code green
1,726 Expert 1GB
To filter the individual fields out of your recordset becomes a bit complicated.
It is probably tidier to filter them with your php code by checking if the array variable is empty. [PHP]while($record = mysql_fetch_assoc($result)
{
if(!empty($record['age']))
echo 'age '.$record['age'];
}[/PHP]
Jun 26 '07 #4
pbmods
5,821 Expert 4TB
Heya, Raphaelle.

You can instead use
Expand|Select|Wrap|Line Numbers
  1. AND `age` <> ''
.
Jun 26 '07 #5
Phaelle
10
It works!! thanks a lot for the tip
Jun 27 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
3
by: Phil Powell | last post by:
Based upon an article I read in http://archives.neohapsis.com/archives/mysql/2004-q1/0337.html I am trying to retrieve an "empty row" of fields from a table that may be empty. If I have this...
19
by: David Logan | last post by:
We need an additional function in the String class. We need the ability to suppress empty fields, so that we can more effectively parse. Right now, multiple whitespace characters create multiple...
22
by: EMW | last post by:
Hi, I managed to create a SQL server database and a table in it. The table is empty and that brings me to my next chalenge: How can I get the info in the table in the dataset to go in an empty...
2
by: Shum | last post by:
Hi! i have a question.. I'm filling a dataset from a table in which some rows are empty, i dont want those empty records to be filled in the dataset.. Does any one know how to restrict it to only...
5
by: eggie5 | last post by:
I'm having trouble deserilizing an xml node that has empty tags. See XML: <ContentCampaigns> <ContentCampaign> <ad_id_source type="integer"></ad_id_source> <billing_code...
10
flexsingh
by: flexsingh | last post by:
Hello there, I have a form and when data is inputted it goes into the table and I can get it out pefectly fine, the problem I have is that if the promary key is empty it will not submit, but if any...
9
by: Dhiru1009 | last post by:
Hi guys, I am trying to build a user registration form using PHP and MYSQL but encountring a problem. When I click on submit with empty fields it adds records to database also it doesn't matter...
2
by: boss1 | last post by:
hi everyone, i m having a problem with my php update code. i have 7 text fields in a webpage. i have written a code for updating multiple fields in database and it's working properly.but the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.