Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,973 members, 7,817,865 topics. Date: Saturday, 04 May 2024 at 09:35 PM

I'm New To Php.need Help - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / I'm New To Php.need Help (712 Views)

An Introduction To PHP - Beginners Base / How To Connect Vb.net Windows Application To Php And My Sql Database / Convert My Cms From Cfm To Php (2) (3) (4)

(1) (Reply) (Go Down)

I'm New To Php.need Help by victorex27: 12:20pm On Jul 25, 2013
Good day. I intend designing a website in which querying the database will require some inpute about 8.Each input may be filled or left blank.For example input may be firstname,age,sex,phone no. i want to be able to query for all rows using phone no alone if it is the only input,firstname,age and sex if they are my only conditions.I need an example of a php program that can do this.using mysql.Thanks.

1 Like

Re: I'm New To Php.need Help by adewasco2k(m): 1:45pm On Jul 26, 2013
This is not gonna be a problem if you make yourself clearer.
Re: I'm New To Php.need Help by victorex27: 8:12am On Jul 29, 2013
the query form should have subjects like
firstname:
surname:
sex:
occupation:
address:
nationality:
state of origin:
d.o.b:
and so on.
i want to be able to apply only details on firstname with other fields empty and get all the result that applys to it in the db. i also want at another instance to be able to query the db using only sex and occupation with other fields being empty and it will still give me results from the db.
So i need help with a php code that will query the db if all the fields are given or not.Thank you.
Re: I'm New To Php.need Help by adewasco2k(m): 10:40am On Jul 29, 2013
victorex27: the query form should have subjects like
firstname:
surname:
sex:
occupation:
address:
nationality:
state of origin:
d.o.b:
and so on.
i want to be able to apply only details on firstname with other fields empty and get all the result that applys to it in the db. i also want at another instance to be able to query the db using only sex and occupation with other fields being empty and it will still give me results from the db.
So i need help with a php code that will query the db if all the fields are given or not.Thank you.

once again i will say you need help on sql not php even though you are working on php.

when i get on my PC i will post an example of what you want to accomplish if i get you right.

also i want to know if there is any reason you even want to store details from a form which is not filled completely!?

if no reason and you always want only a completely field form to send data to your database then you have to validate the form to make sure all required fields are not left blank .
Re: I'm New To Php.need Help by adewasco2k(m): 7:04pm On Jul 29, 2013
On PC as promised!!

okay i will first believe you dont mind if the whole fields are filled i.e somebody can fill the form typing only firstname and submitting and then you save the details to your database, you sill need to validate to know which field was field then you send it to your database then, i think you should have a default value for each row in your database, so when somebody fill only firstname and email for example leaving the others empty, there will be a default country, sex, phone no. etc.

so you can always write a query like

SELECT firstnname, email from your_table_name WHERE (sex or phone_no or country or etc)= default_name. you can even leave it blank and say where NULL.


As i have said, i still dont understand your question very well though.
Re: I'm New To Php.need Help by victorex27: 8:56am On Jul 30, 2013
Thank you Sir.
The form has already been filled and validated i.e i already have a table filled with rows of value.Now,i want to query the database with any combination of the form given above.i need a function that will help me do this in php.thanks.

(1) (Reply)

Keller Box Scheme / XML For Web Development / How To Convert Your Website To Mobile App

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 16
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.