Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/66675-solved-error-0/
Share on other sites

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!!!  :o

Link to comment
https://forums.phpfreaks.com/topic/66675-solved-error-0/#findComment-334048
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.