This topic is locked

linking to primary key with multiple fields

12/2/2014 3:12:44 PM
PHPRunner General questions
C
cyberslugg author

I am using the following

$record["memclose_link"] = "<a href=\"Renew_Jobs_list.php?a=close&recordid=".$data["Id"]."\">Delete This Job (click twice)</a>";
it triggers this
if ($_REQUEST["a"]=="close"&& $_REQUEST["recordid"])

{
$sql="UPDATE Employment SET EndDate = CURDATE() WHERE Id=".$_REQUEST["recordid"];

CustomQuery($sql);
}
I now need to use this for a table that has a primary key made up of two fields ie Field1 and Field2
how do I change the "ID" to be use field1 and field2 in combo to id the field to have an end dated added.
any help would be great.
Thanks
Garvin

Sergey Kornilov admin 12/3/2014

The basic idea of passing multiple parameters via URL is simple. Sample URL:

Renew_Jobs_list.php?a=close&recordid1=someid&recordid2=someotherid


Then in your code you can use $_REQUEST["recordid1"] and $_REQUEST["recordid2"] respectively.

C
cyberslugg author 12/4/2014



The basic idea of passing multiple parameters via URL is simple. Sample URL:

Renew_Jobs_list.php?a=close&recordid1=someid&recordid2=someotherid


Then in your code you can use $_REQUEST["recordid1"] and $_REQUEST["recordid2"] respectively.


**** SEE MY POST BELOW, I changed several things in the code including fixing a field name error so the code I put here has errors I did find and fix..... ***
So something like
AFTER RECORD
if ($_SESSION["language"] == "French") {

$record["memclose_link"] = "<a href=\"Renew_Jobs_list.php?a=close&recordid1=".$data["MemberID"]."&recordid2=".$data["EmployerID"]."\">Mettre fin à ce statut (cliquer deux fois)</a>";

} else {

$record["memclose_link"] = "<a href=\"Renew_Jobs_list.php?a=close&recordid1=".$data["MemberID"]."&recordid2=".$data["EmployerID"]."\">Delete This Job (click twice)</a>";

}
AND BEFORE RECORD
if ($_REQUEST["a"]=="close"&& $_REQUEST["recordid1"] and $_REQUEST["recordid2"] )

{
$sql="UPDATE Employment SET EndDate = CURDATE() WHERE MemberID = ".$_REQUEST["recordid1"] AND EmploymentID = .$_REQUEST["recordid2"] ;

CustomQuery($sql);
}
The above is not working yet... I get an error on syntax check about the = after EmploymentID =
I'm sure I'm just being a bit brain dead <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=76364&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
Thanks for all the help

C
cyberslugg author 12/4/2014

Quick update, I am using the following and getting closer... I think...
AFTER RECORD
if ($_SESSION["language"] == "French") {

$record["memclose_link"] = "<a href=\"Renew_Jobs_list.php?a=close&recordid1=".$data["MemberID"]."&recordid2=".$data["EmployerID"]."&recordid3=".$data["StartDate"]."\">Mettre fin à ce statut (cliquer deux fois)</a>";

} else {

$record["memclose_link"] = "<a href=\"Renew_Jobs_list.php?a=close&recordid1=".$data["MemberID"]."&recordid2=".$data["EmployerID"]."&recordid3=".$data["StartDate"]."\">Delete This Job (click twice)</a>";

}
BEFORE RECORD
if ($_REQUEST["a"]=="close"&& $_REQUEST["recordid1"] and $_REQUEST["recordid2"] and $_REQUEST["recordid3"] )

{
$sql="UPDATE Employment SET EndDate = CURDATE() WHERE MemberID = ".$_REQUEST["recordid1"]." AND EmployerID = ".$_REQUEST["recordid2"]." AND StartDate = ".$_REQUEST["recordid3"] ;

CustomQuery($sql);
}

C
cyberslugg author 12/8/2014

this is a bit critical for me ... it is best if I purchase a couple hours of coding? I'm rather stuck and up against a tight time.

Sergey Kornilov admin 12/8/2014

If you need help from support team - contact support directly at http://support.xlinesoft.com. Your code alone is not helping, in order to troubleshoot this we need to see the whole application, database structure, have access to some sample data etc.

C
cyberslugg author 12/8/2014

Thanks Sergey
I figured it was going to be more involved which was why I was wondering about moving it over to a support call.
Thanks I'll get in touch with support.