/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Changing the setting of a table input

I have a mysql table that contains resumes, and in it is a row titled – r_default. A user can add as many resumes as they would like, but the first one they enter is set as the default resume and can be seen by employers. I want the user to be able change the default setting to whichever resume they have on file, but I’m having difficulty working this out.

The default resume and is set to “1” and the other resumes are set to “2” (not default).

How would I write the code to make another resume the default resume?

I’ll list the resumes from the database with a link next to each one containing the resume id number, i.e.

[code=php]<a href=”change_default.php?r_id=$r_id”>Set as Default</a>[/code]

, where the page “change_default.php contains the code to change the “2” to a “1” for the default resume and the original default resume to a “2”.

This may be a simple code to write and I’m just overlooking it, but a point in the right direction would be helpful.

Thanks.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@Alan_PauthorApr 27.2008 — Sorry, I was unable to edit my previous post to include this:

[code=php]$r_id = $_GET['r_id'];

include("./includes/dbconnect.php");
$query = "UPDATE resume SET r_default=2 WHERE r_default='1' AND user_id = '".$_SESSION['user_id']."'";

$query = "UPDATE resume SET r_default=1 WHERE r_id='$r_id' AND user_id = '".$_SESSION['user_id']."'";
$result = @mysql_query($query);
if($result)
{
echo "Success! Default Resume Changed.";
}
else
{
echo "Opps! Default Resume NOT Changed.";
}[/code]


Would these two queries back to back work?
Copy linkTweet thisAlerts:
@Alan_PauthorApr 27.2008 — The two queries worked. So problem solved.
×

Success!

Help @Alan_P spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...