Hello all, I have a goofy question for ya, I have a PDO transaction to my mysql database that I an sending 2 queries. I get local variables in the first mysql statement then pass the variables to the second mysql statement.
Here is my problem I have at signs (@) in some returned object references and this screws up PHP.
Here are my queries:
Query 1:
Query 2:
the problem is that in my arrayobjects I have @ signs in them, here is a sample of output
How can I take the @ signs out within the mysql statements using PDO, I dont want to have to loop through the array objects every time to clean this up.
Thank you,
timgerr
-How important does a person have to be before they are considered assassinated instead of just murdered?
Congratulations!
Here is my problem I have at signs (@) in some returned object references and this screws up PHP.
Here are my queries:
Query 1:
Code:
$stmt = conn::getInstance()->prepare("SELECT @RES_TYPE := dnt_resource_type.resource_type,
@GRP_NAME := dnt_groupname.grp_name,
@RSS_Role := dnt_group_resource.role,
@CBS_ID := dnt_resource.res_resource
FROM dnt_resource INNER JOIN dnt_resource_type ON dnt_resource.res_type = dnt_resource_type.id
INNER JOIN dnt_groupname ON dnt_groupname.id = dnt_resource.groupname
INNER JOIN dnt_group_resource ON dnt_group_resource.resourceid = dnt_resource.id
INNER JOIN dnt_role_type ON dnt_group_resource.role = dnt_role_type.id
INNER JOIN dnt_groupmembers ON dnt_groupmembers.grp_mbr_name = dnt_groupname.id
INNER JOIN dnt_user ON dnt_groupmembers.userid = dnt_user.id
WHERE dnt_user.id = ? AND ( dnt_role_type.id = '6' OR dnt_role_type.id = '3' )
AND dnt_resource_type.resource_type = 'Bla'");
$stmt->execute(array_values($a));
Code:
$stmt = conn::getInstance()->prepare("SELECT node.CBSid, @RES_TYPE, @GRP_NAME,@RSS_Role, node.CRid, node.name, node.Description, node.State, node.PARid, node.cbstreeroot
FROM dnt_cbs_table AS node, dnt_cbs_table AS parent
WHERE node.L BETWEEN parent.L AND parent.R
AND parent.CBSid = @CBS_ID
AND parent.cbstreeroot = node.cbstreeroot
ORDER BY node.L;");
$stmt->execute();
Code:
public 'CBSid' => string '645' (length=3)
public '@RES_TYPE' => string 'Somthing' (length=7)
public '@GRP_NAME' => string 'Somthing' (length=7)
public '@RSS_Role' => string '6' (length=1)
public 'CRid' => string '234' (length=3)
public 'name' => string 'Default Root' (length=12)
public 'Description' => string 'Computer Generated Root, Please rename' (length=38)
public 'State' => string '1' (length=1)
public 'PARid' => string '0' (length=1)
public 'What' => string '645' (length=3)
How can I take the @ signs out within the mysql statements using PDO, I dont want to have to loop through the array objects every time to clean this up.
Thank you,
timgerr
-How important does a person have to be before they are considered assassinated instead of just murdered?
Congratulations!