This topic is locked
[SOLVED]

 Add Record And Execute Sql Based On Dropdown

3/18/2013 12:35:54 PM
PHPRunner General questions
P
p1nr author

I am setting up a project and would like to execute an SQL command when a new record is added. That SQL command needs to be dependant on a drop down selection.
Here is a breakdown:

The user clicks 'Create Schedle' (name of the table I've created for this)

The user then selects a (between) date range

When the user clicks 'Add New Record' the SQL command executes with the (selected) date range applied to the WHERE statement within that command
Has anyone dealt with this yet, or know where I can find Help on this in the PHPrunner documentation?

C
cgphp 3/18/2013

What is the SQL command you want to execute?

P
p1nr author 3/19/2013



What is the SQL command you want to execute?


I've trimmed down the code a bit to make it easier for everyone to analyze, but this is basically what I need done.

$strSQLInsert = "insert into vcschedule (techid, `date`, `weekday`, status, dept)

select techid, edate

from vcschedulerotations

where vcdateperiod.edate BETWEEN ".$values['edate1']." AND ".$values['edate2']; echo($strSQLInsert);

db_exec($strSQLInsert,$conn);
P
p1nr author 3/21/2013

I got it now. The .$values['edate1&2']. parameters above were correct, I just needed to set up those 2 fields differently in my SQL query.