Crew-Portal Posted August 25, 2007 Share Posted August 25, 2007 Can Someone help me! Here is my post page: <?php $db_host = ('localhost'); $db_name = ('db'); $db_user = ('root'); $db_pass = ('******'); $db_open = mysql_connect($db_host,$db_user,$db_pass); mysql_select_db($db_name,$db_open); echo $db; $db_term = mysql_close(); $databaseconnexion=true; // assume we will be connected $db = @mysql_connect($db_host,$db_user,$db_pass); $sql="INSERT INTO flights (PilotName, FlightDate, AircraftName, NbrPassengers, CargoWeight, DepartureIcaoName, ArrivalIcaoName, TotalDistance, TotalBlockTime) VALUES ('$valid_user', '$fltdate', '$_POST[plane]', '$_POST[pass]', '$_POST[cargo] KG', '$_POST[depart]', '$_POST[arrival]', '$_POST[distance]', '$_POST[hour]:$_POST[minute]')"; $result = @mysql_query($sql,$connection) or die("<b>A fatal MySQL error occured</b>.\n<br />Query: " . $query . "<br />\nError: (" . mysql_errno() . ") " . mysql_error()); ?> Basically what this does is it enters inforation into a table just like a registration page... All $_POST Variables are assigned but are on a diffrent page. The one being called! Anyways whenever I load it I get this error after I click submit on a previous page. A fatal MySQL error occured. Query: Error: (0) If Someone could help it would help alot Quote Link to comment https://forums.phpfreaks.com/topic/66675-solved-error-0/ Share on other sites More sharing options...
Crew-Portal Posted August 25, 2007 Author Share Posted August 25, 2007 I got it working... Sorry to bug you guys!? <?php $connection = @mysql_connect("$db_host", "$db_user", "$db_pass") or die("Couldn't connect."); $db = @mysql_select_db($db_name, $connection) or die("Couldn't select database."); $sql="INSERT INTO flights (PilotName, FlightDate, AircraftName, NbrPassengers, CargoWeight, DepartureIcaoName, ArrivalIcaoName, TotalDistance, TotalBlockTime) VALUES ('$valid_user', '$fltdate', '$_POST[plane]', '$_POST[pass]', '$_POST[cargo] KG', '$_POST[depart]', '$_POST[arrival]', '$_POST[distance]', '$_POST[hour]:$_POST[minute]')"; $result = @mysql_query($sql,$connection) or die("<b>A fatal MySQL error occured</b>.\n<br />Query: " . $query . "<br />\nError: (" . mysql_errno() . ") " . mysql_error()); ?> TOPIC SOLVED!!! Quote Link to comment https://forums.phpfreaks.com/topic/66675-solved-error-0/#findComment-334048 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.