Jump to content

Issue updating database and redirecting


HDFilmMaker2112

Recommended Posts

The below code is taking the submission from the form and inserting into the members table, but it is not updating the application table.

 

 

if($_GET['view']=="applications"){

$section.=' - New Investor Applications';
$content='
<div class="main">
<div class="main_header">New Investor Applications</div>';

if($_GET['approved']=="update"){
$id=(int)$_GET['id'];
$approved=$_POST['approved'];
$approved=sanitize($approved);
$username=$_POST['username'];
$username=sanitize($username);
$password=$_POST['password'];
$password=kam3($password);
$approved_sql="INSERT INTO members (username, password, application_id) VALUES ('$username', '$password', '$id')";
$approved_result=mysql_query($approved_sql) or die(mysql_error());
$approved_rows=mysql_affected_rows();
$update_approved_sql='UPDATE application SET approved="y" WHERE id="$id"';
$update_approved_result=mysql_query($update_approved_sql) or die(mysql_error());
$update_approved_rows=mysql_affected_rows();
if($approved_rows==1 && $update_approved_rows==1){
header("Location: ./index.php??admincp=investors&view=applications&approved=updated");
}
}

elseif($_GET['approved']=="updated"){
$content.='<div class="center">
Application Status Updated.
<br />
<a href="http://www.makethemoviehappen.com/index.php?admincp=investors&view=accounts">View Investor Accounts</a>
</div>';
}

elseif(isset($_GET['id'])){
$id=(int)$_GET['id'];
$member_list_query="SELECT * FROM application WHERE id='$id'";
$member_list_result=mysql_query($member_list_query);
while($member_list_row=mysql_fetch_array($member_list_result)){
extract($member_list_row);
}

$section.=' - '.$name.' - Application #'.$id.'';
$content.='
<div class="center bold eighteen">Investor Application - '.$name.' - #'.$id.'</div>
<br />
<div class="investor_applications_wrapper">
<div class="title_data_row">
<div class="title"><div class="investor_padding">Name:</div></div>
<div class="data"><div class="investor_padding">'.$name.'</div></div>
</div>
<div class="title_data_row">
<div class="title"><div class="investor_padding">Organization (if applicable):</div></div>
<div class="data"><div class="investor_padding">'.$organization.'</div></div>
</div>
<div class="title_data_row">
<div class="title" class="title"><div class="investor_padding">E-Mail Address:</div></div>
<div class="data"><div class="investor_padding">'.$email.'</div></div>
</div>
<div class="title_data_row">
<div class="title"><div class="investor_padding">Phone Number:</div></div>
<div class="data"><div class="investor_padding">'.$phone.'</div></div>
</div>
<div class="title_data_row">
<div class="title"><div class="investor_padding">Brief description of the organization you represent (if applicable):</div></div>
<div class="data"><div class="investor_padding">'.$company_description.'</div></div>
</div>
<div class="title_data_row">
<div class="title"><div class="investor_padding">Nature of your inquiry into Make the Movie Happen:</div></div>
<div class="data"><div class="investor_padding">'.$nature_inquiry.'</div></div>
</div>
<div class="title_data_row accredited_spacer">
<div class="bold center eighteen">"Accredited Investor" Qualification</div>
</div>
<div class="title_data_row">
<div class="title"><div class="investor_padding">The applicant is an entity with total assets in excess of $5,000,000:</div></div>
<div class="data"><div class="investor_padding">'.ucfirst($company_assets).'</div></div>
</div>
<div class="title_data_row">
<div class="title"><div class="investor_padding">The applicant is a natural person whose individual net worth is above $1,000,000 or annual income of $2/300,000:</div></div>
<div class="data"><div class="investor_padding">'.ucfirst($natural_person).'</div></div>
</div>
<div class="title_data_row">
<div class="title"><div class="investor_padding">The applicant is an employee benefit plan within the meaning of Title I of ERISA:</div></div>
<div class="data"><div class="investor_padding">'.ucfirst($employee_benefit_plan).'</div></div>
</div>
<div class="title_data_row">
<div class="title"><div class="investor_padding">The applicant is licensed, or subject to supervision, by U.S. federal or state examining authorities as a bank or savings and loan association, insurance company or licensed small business investment company:</div></div>
<div class="data"><div class="investor_padding">'.ucfirst($bank_savings).'</div></div>
</div>
<div class="title_data_row">
<div class="title"><div class="investor_padding">The applicant is registered with the U.S. Securities and Exchange Commission (the "SEC") as a broker or dealer under the Securities Exchange Act of 1934 or qualifies as a "business development company":</div></div>
<div class="data"><div class="investor_padding">'.ucfirst($broker_dealer).'</div></div>
</div>
<div class="title_data_row">
<div class="title"><div class="investor_padding">The applicant is a private business development company as defined in Section 202(a)(22) of the Investment Advisers Act of 1940, as amended:</div></div>
<div class="data"><div class="investor_padding">'.ucfirst($development_company).'</div></div>
</div>
<div class="title_data_row">
<div class="title"><div class="investor_padding">The applicant is an entity in which all of the equity owners are persons described above (including an IRA where the participant is an accredited investor):</div></div>
<div class="data"><div class="investor_padding">'.ucfirst($equity_owners).'</div></div>
</div>
<div class="title_data_row">
<div class="title"><div class="investor_padding">Agreement Confirmed</div></div>
<div class="data"><div class="investor_padding">'.ucfirst($confirm_agreement).'</div></div>
</div>
</div>
<div class="investors_approve_form">
<div class="center bold eighteen">Approve Application</div>
<form action="./index.php?admincp=investors&view=applications&approved=update&id='.$id.'" method="post">
<p><label>Username: </label><input type="text" name="username" size="32" /></p>
<p><label>Password: </label><input type="text" name="password" size="32" /></p>
<p><label>Approve: </label>
Yes <input type="radio" name="rating" value="y" />
No <input type="radio" name="rating" value="n" /></p>
<input type="submit" name="go" value="Go" />
</form>
</div>
<div class="spacer_bottom"> </div>
';
}
else{
$new_applications="SELECT * FROM application WHERE approved='n'";
$new_applications_result=mysql_query($new_applications);
while($new_applications_row=mysql_fetch_assoc($new_applications_result)){
extract($new_applications_row);
$content.='<div class="center"><a href="./index.php?admincp=investors&view=applications&id='.$id.'">'.(!empty($username) ? ''.$username.'' : ''.$name.'').'</a></div>';
}
}
$content.='</div>';
}

Link to comment
Share on other sites

This probably isn't right but i'll try and answer for the sake of trying to learn myself:

 

this line:

 

$update_approved_sql='UPDATE application SET approved="y" WHERE id="$id"';

//Change it to this
$update_approved_sql="UPDATE application SET approved='y' WHERE id='$id'";

Link to comment
Share on other sites

This probably isn't right but i'll try and answer for the sake of trying to learn myself:

 

this line:

 

$update_approved_sql='UPDATE application SET approved="y" WHERE id="$id"';

//Change it to this
$update_approved_sql="UPDATE application SET approved='y' WHERE id='$id'";

 

Exactly right. Don't know why I used double quotes inside the query.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.