This topic is locked

Global $dal

3/25/2009 8:51:29 AM
PHPRunner General questions
R
rdowdy author

I was needing to know if I could copy specific records from one table to another table using the $dal statements. I seem to be having some difficulties INSERTing specific Columns of data FROM TableA to TableB WHERE recordA = '4'. I had spent hours, attemping this to no success. An example of using $DAL to accomplish this would go a long way to my learning process.
This was my latest shot at it:
global $conn;

$fromtablename = "mb_require"

$totablename = "mb_record"
$strSQLInsert = "insert into ".$totablename." (scout_key, mb_number, completed, mbreq_key, req_number, description)

SELECT ".$_SESSION["my_scout_key"].", ".$_SESSION["mb_key_value"].", ".$_SESSION["is_completed"].", mbreq_key, req_number, description

WHERE mb_number = ".$_SESSION["mb_key_value"];

db_exec($strSQLInsert,$conn);

J
Jane 3/25/2009

Ron,
I suppose you use this code on the add/edit pages.

In this case try to use this code:

global $dal;

$dal->mb_require->scout_key=$_SESSION["my_scout_key"];

$dal->mb_require->mb_number=$_SESSION["mb_key_value"];

$dal->mb_require->completed=$_SESSION["is_completed"];

$dal->mb_require->mbreq_key=$values["mbreq_key"];

$dal->mb_require->req_number=$values["req_number"];

$dal->mb_require->description=$values["description"];

$dal->mb_require->Add();

R
rdowdy author 3/25/2009

Thanks for the reply,

But I am also needing to copy only certain key records (Query TableA) from TableA to TableB.