monkeypaw201 Posted February 8, 2008 Share Posted February 8, 2008 here it is: <?php $pilot_id = mysql_connect("localhost","user","pass"); if (!$pilot_id) { die('Could not connect: ' . mysql_error()); } mysql_select_db("cerulean_site", $pilot_id); $result = mysql_query("SELECT * FROM pilots ORDER BY pilot_id DESC"); $row = mysql_fetch_assoc($result); // add this line $pilot_id = $row['pilot_id']+1; //-------------------------- $first_name=$_POST['first_name']; $last_name=$_POST['last_name']; $email=$_POST['email']; $password=md5($_POST['password']); $dob=$_POST['dob']; $personal_location=$_POST['personal_location']; $personal_country=$_POST['personal_country']; $public_msn=$_POST['public_msn']; $public_yim=$_POST['public_yim']; $public_aim=$_POST['public_aim']; $public_skype=$_POST['public_skype']; $public_icq=$_POST['public_icq']; $public_website=$_POST['public_website']; $public_avatar=$_POST['public_avatar']; $public_biography=$_POST['public_biography']; $public_sagtv=$_POST['public_sagtv']; $public_real_world_pilot=$_POST['public_real_world_pilot']; $public_vatsim_controller=$_POST['public_vatsim_controller']; $public_vatsim=$_POST['public_vatsim']; $activation_code=substr(str_shuffle("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),0,35); $hire_date=date("F j, Y"); //------------------------- $transfer_airline=$_POST['transfer_airline']; $transfer_proof_link=$_POST['transfer_proof_link']; $transfer_hours_requested=$_POST['transfer_hours_requested']; $pilot = mysql_connect("localhost","user","pass"); if (!$pilot) { die('Could not connect: ' . mysql_error()); }mysql_select_db("cerulean_site", $pilot); $sql="INSERT INTO pilots (pilot_id, first_name, last_name, email, password, date_of_birth, personal_location, personal_country, activation_code, hire_date, public_msn, public_yim, public_aim, public_skype, public_icq, public_website, public_avatar, public_biography, public_sagtv, public_real_world_pilot, public_vatsim_controller, public_vatsim) VALUES ('$pilot_id','$first_name','$last_name','$email','$password','$dob','$personal_location','$personal_country','$activation_code','$hire_date','$public_msn','$public_yim','$public_aim','$public_skype','$public_icq','$public_website','$public_avatar','$public_biography','$public_sagtv','$public_real_world_pilot','$public_vatsim_controller','$public_vatsim')"; if (!mysql_query($sql,$pilot)) { die('Error: ' . mysql_error()); } mysql_close($pilot) $hour = mysql_connect("localhost","user","pass"); if (!$hour) { die('Could not connect: ' . mysql_error()); }mysql_select_db("cerulean_site", $hour); $sql="INSERT INTO pilot_hour_transfer (pilot_id, transfer_airline, transfer_proof_link, transfer_hours_requested) VALUES ('$pilot_id','$transfer_airline','$transfer_proof_link','$transfer_hours_requested')"; if (!mysql_query($sql,$hour)) { die('Error: ' . mysql_error()); } mysql_close($hour) ?> I get the following error: Parse error: parse error, unexpected T_VARIABLE on line 173 Line 173 is: $hour = mysql_connect("localhost","user","pass"); it works fine without the second mysql insert... Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/90102-solved-mysql-php-being-weird-undefined-t_variable/ Share on other sites More sharing options...
revraz Posted February 8, 2008 Share Posted February 8, 2008 Missing semi colon mysql_close($pilot); <--------- Quote Link to comment https://forums.phpfreaks.com/topic/90102-solved-mysql-php-being-weird-undefined-t_variable/#findComment-461988 Share on other sites More sharing options...
kenrbnsn Posted February 8, 2008 Share Posted February 8, 2008 You don't have to connect again. Also you should use a different variable name for the db connection. <?php $conn = mysql_connect("localhost","user","pass") or die("Could not connect to the database: " . mysql_error()); mysql_select_db("cerulean_site", $conn); ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/90102-solved-mysql-php-being-weird-undefined-t_variable/#findComment-462002 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.