0

hi everyone am a novie in php world. i was asked to creat a database and a table which i did but now i created a form which has the following client,fullnames,commissioning date, expiry date, email, telephone, vehicle type, subsribtion. i inserted the values into mysql database. but now i want to create a search field which when the enter the client name, it will generate the expired field of the table

3
Contributors
8
Replies
35
Views
3 Years
Discussion Span
Last Post by lily123
0

Why will it generate the expiry date? You have the expiry date in the form so it should be in the DB already, shouldn't it?

0

exact match

$sql = "SELECT * FROM mytablename WHERE `fullnames` = '$searchname'";

or search by name parts

$sql = "SELECT * FROM mytablename WHERE `fullnames` LIKE '%$searchname%'";
0

but am having another problem, i want to view all active users from the table database using date that is not more than one year

0

Have you studied SQL syntax? To retrieve use

SELECT ...list of fields you need... FROM ...tablename... WHERE ...fieldname... = ...value...

In your case you'll want the WHERE clause to have a function instead of a simple fieldname...

DATEDIFF(NOW(), expiry_date) <= 365

Maybe something else to take into account leap years.

0

please can u give me the full php code to that? cuz am a beginner tank u

2

I see that you've opened a new thread to ask the same question again.

http://www.daniweb.com/web-development/php/threads/472595/date-range

Please keep your posts organised. There's no need to open a new thread, even if you do not find a contributor's post useful - that's just rude.

In addition, although we are here to help, it is not our job to give you complete solutions or write all the code for you. We are all volunteers and post what and when we can. It's YOUR job to provide US with the code, telling us where it's going wrong.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.