This topic is locked

Transferring vales from list to view page

1/22/2007 6:24:08 AM
PHPRunner General questions
D
datapimp author

Hi

I'm trying to transfer field values from selected rows on the list page to the view page onload function. So once they select a column some of the selected field can be saved on to a different table.
From going back over the forum I belive this could be done on the ADD page by using:
postvalue("value_fieldname")

^^ I hope that's info is right
Here is my code for example, I'm trying to make $ds_Lead_ID equal to the Lead_ID field from the list page but having no luck.... Any ideas ?? .. thanks in advances
[codebox]view page onload
function ViewOnLoad()

{

global $where;

global $conn;

$myun = @$_SESSION["UserID"];

global $ds_Lead_ID;

$dldate = date("Y:m:d:H:i:s");
$strSQLExists = "select from _clead where ".$where;

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

if($data["cl_status"]=="active")

{

// if record exists do something
$result = mysql_query("SELECT
FROM _cdws WHERE uname like '$myun' ")

or die(mysql_error());
while($row = mysql_fetch_array( $result )) {

$strSQLInsert = "insert into _dlp (dws_cname,abin,lead_id,dlp_date) values ('$myun', '$row[abin]','$ds_Lead_ID','$dldate')";

db_exec($strSQLInsert,$conn);
echo "Got It";
}
}

else

{

// if dont exist do something else

echo "This is not an ACTIVE LEAD";

die();

}

}

[/codebox]

J
Jane 1/22/2007

Hi,
I'm not sure that I understand you correctly.

If you want to save some fields from view page in the another table use this code:

function ViewOnLoad()

{

$myun = @$_SESSION["UserID"];

$dldate = date("Y:m:d:H:i:s");
global $where,$strTableName,$conn;

$str = "select from ".$strTableName." where ".$where;

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);
if($data["cl_status"]=="active")

{

// if record exists do something

$result = mysql_query("SELECT
FROM _cdws WHERE uname like '$myun' ") or die(mysql_error());

while($row = mysql_fetch_array( $result ))

{

$strSQLInsert = "insert into _dlp (dws_cname,abin,lead_id,dlp_date) values ('".$myun."', '".$row["abin"]."','".$data["ds_Lead_ID"]."','".$dldate."')";

db_exec($strSQLInsert,$conn);

echo "Got It";

}

}

else

{

// if dont exist do something else

echo "This is not an ACTIVE LEAD";

die();

}

}

D
datapimp author 1/23/2007

an error comes up when i use your code:
Table 'autodatabase.dvl' doesn't exist
sorry for not making myself clear but i believe this error is caused the fact that _dvl is a table view not a real table in my sql db. Everything thing else with the code seem fine.
just to recap...

_dvl is a table view of _clead (which is the real sql table)
i have a _dvl view list and view page. i'm trying carry over the field data they have selected on the list page so when they hit the view page it makes a log of the entry into a different table (_dlp) of what they have selected (just one field called lead_id).That is the purpose of the viewonload function.
i hope u can understand and help me <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=14812&image=1&table=forumreplies' class='bbc_emoticon' alt=':unsure:' />
ps.. thanks for cleaning up my sloppy code, i have a lot of faith in PHPrunner that I've just brought it....

D
datapimp author 1/24/2007

I'm thinking that no-one has any idea with this one ????? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=14858&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />

J
Jane 1/24/2007

Try to use _clead table instead of _dvl:

function ViewOnLoad()

{

$myun = @$_SESSION["UserID"];

$dldate = date("Y:m:d:H:i:s");
global $where,$strTableName,$conn;

$str = "select * from _clead where ".$where;

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);

...