Add Page with SQL-Query

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
mpol_ch
User
Posts: 877
Location: Switzerland

Add Page with SQL-Query

Post by mpol_ch »

Hello I need your advice to solve the following case. I do not know where to start. I want to have suggestions from database with a query in ADD table. Hier is my case:

Table: dates (id INT, start DATE, time TIME, suggest VARCHAR)

datesadd.php

Start (Select Date from Datepicker)
Time ( Select Time from Timepicker)
Suggest ( SELECT date, time, id FROM termine WHERE (start BETWEEN startdate AND enddate) AND (time BETWEEN starttime AND endtime)))

I would like to see all the possible options in "Suggest" according to the selected Start and Time. The possible options should be apear in Suggest (Dropdawn). The suggestions should be adjust dynamically acording to selected Start and time.

How can I realease this with PHPMAKER? Is there sample?

Thanks
mpol_ch


mobhar
User
Posts: 11745

Post by mobhar »

Post the schema of "termine" table (CREATE TABLE ...) including some records in it (INSERT INTO ...).


mpol_ch
User
Posts: 877
Location: Switzerland

Post by mpol_ch »

Hello mobhar
Please do not focus on the queries. They are dummy queries. I want just know how I can get the values with help of sql query for the field "Suggest". You should not checkt he correctnes of query..

The table termine will have the following records and it is given:

date DATE, time TIME, did INT

1: 2015-02-02 01:00:00 1
2: 2015-02-02 03:00 :00 1
3: 2015-02-02 04:00 :00 1
4: 2015-02-02 05:00 :00 1
5: 2015-02-02 06:00 :00 1
6: 2015-02-02 07:00 :00 1

Startdate (Select Date from Datepicker)
Enddate (Select Date from Datepicker)
Starttime ( Select Time from Timepicker)
Endtime ( Select Time from Timepicker)
Suggest (SELECT Date, time, id FROM termine WHERE (date BETWEEN Startdate AND Enddate) AND (time BETWEEN Starttime AND Endtime))..

thank you anyway

mpol_ch


mobhar
User
Posts: 11745

Post by mobhar »

Even they are dummy queries, they often help us in many situation to create a dummy project for test purpose.


mgqz
User
Posts: 89

Post by mgqz »

Hi mobhar, mpol_ch

I think I need the same thing... In my case I have a table with transactions the transactions has expenses reports example

date,invoice,vendor,type,amount

2015-01-02,233543,1122-3,GAS,112.12
2015-01-04,35453,5567-3,GAS,100.00
2015-01-12,333,1122-3,FOOD,56.23
2015-01-11,301,1011,FOOD,12.12
2015-01-13,121,2022,GAS,22.11
2015-01-16,2323,3030,BUS,77.81
2015-01-17,4544,12-1,GAS,45.67
2015-02-13,43443,1122-3,RENT,112.15

All this added via normal transactionadd.php

I want a way where I can suggest on a new record the type of expense based on the latest entered value so:

I user enters vendor 2323 fill the input text box of the type with BUS since is almost certain (but not mandatory) that if I buy to same vendor the type of expense is similar...

I don´t know where to put this since the change event of the select of vendor is on js and need to query the db based on this value to assign a suggested type ...

thanks


Post Reply