Jump to content

[SOLVED] insert query not working...please help!


mcerveni

Recommended Posts

Here's the example site: www.rimdev.sgspoint.com/agentcenter

 

username: CA705556

leave the password blank, press login.

create a password and press finish.

it does nothing...lol whyyy. i can't figure it out.

 

i'm connecting to 2 different databases. the username/pass for them are in a functions include page i have.

 

 

 

code below:

 


<?php
include("header.php");


$ca = $_GET['ca'];
$pass = $_GET['pass'];
$date = date('l F j, Y');



$handle = mysql_connect($host,$user,$pwd);
mysql_select_db($stats, $handle);
mysql_query("USE $stats",$handle);

$query = "SELECT * FROM employee_compo WHERE EmpID = '$ca'";
$result = mysql_query($query) or die(mysql_error());
$row=mysql_fetch_array($result);

$agentName = $row['AgentName'];
$email = $row['email'];
$empID = $ca;




if($row['Email'] == $email && $row['Position'] == "FLA" || $row['Position'] == "PRS" ) {

$picture = "pic";
$activated = "yes";

$handle2 = mysql_connect($host,$user,$pwd);
mysql_select_db($agentcenter_database, $handle2);
mysql_query("USE $agentcenter_database",$handle2);

$sql = "INSERT INTO users ( user_id, email, empID, AgentName, password, date, activated, picture) VALUES(0, '$email', '$empID', '$agentName', '$pass', '$date', '$activated', '$picture')";
$insertUser = mysql_query($sql) or die(mysql_error());

$to= "[email protected]"; 
$subject = "Activation Email";

$body= "<br><br> You have recently registered to the Agent Support Center. <b> Activate your account below. </b> <br> <br>


";


$headers = "From: Agent Support Center  \r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";


mail($to, $subject, $body, $headers);



echo "You have been sent an email to activate your account! ";

}

else {

echo $ca;
echo $pass;
   echo " <br> <br> <span style='font-size:17px'> <img src='images/invalid.JPG'> <center><a href='index.php'> Error: Try Again </a> </center> </span>  ";

}





?>

$agentName = $row['AgentName'];
$email = $row['email'];  # <---
$empID = $ca;

# vvvvvv
if($row['Email'] == $email && $row['Position'] == "FLA" || $row['Position'] == "PRS" ) {

 

I've marked two pieces of code here - one references $row['email'], the other $row['Email'].  That looks sus to me.  The lowercase one is probably correct.  This may lead to the insert query not being executed at all.

 

The other sus thing there is that you probably should write this:

 

if($row['Email'] == $email && ($row['Position'] == "FLA" || $row['Position'] == "PRS" )) {

 

With brackets to tell php exactly how you want that "and/or" to be interpreted.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.