Forum Moderators: coopster
I'm a bit new to php and i've been staring at this thing an entire morning now, and i can't seem to find my errors.
I know this might not be the best(cleanest or fastest) way to put things entered in a form into a msql dbase, but it should work.
A mate of mine pointed me in the right direction. but now i'm stuck, can someone here please lend a hand.
I know it might be a long read, but please help.
thanx
Leo
------------------------------------------------------------
<?
$dbh=mysql_connect ("localhost", "****", "****") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("hollandc_italy");
@mysql_select_db("hollandc_italy") or die;
$sqlquery=("INSERT INTO Contacts (hotel_name, connect, cost_per_miute, itf, commission_hotel, commission_agent, contactid, number_of_rooms, manager, hotel_name, hotel_address, hotel_phone_nr, city, country, manger_telephone, faxnumber, emailname, website, account_nr, password, responsible_agent, notes_on_hotel, bank_name, bank_swift_code, bank_account_nr, bank_location, ani, hotel_man_email);
$VALUES=
('$hotel_name','$connect','$cost_per_miute', '$itf', '$commission_hotel', '$commission_agent', '$contactid', '$number_of_room'$manager', '$hotel_name', '$hotel_address', '$hotel_phone', '$city', '$country', '$manager_phone', '$faxnumber', '$emailname', '$website', '$account_nr', '$password', '$responsible_agent', '$notes_on_hotel', '$bank_name', '$bank_swift_code', '$bank_account_nr', '$bank_location', '$ani', '$hotel_man_email');
$results=mysql_query("$sqlquery") or die;
?>
-----------------------------------------------------------
[edited by: jatar_k at 8:20 pm (utc) on Dec. 5, 2003]
[edit reason] fixed sidescroll [/edit]
You are are also selecting the database twice. mysql_select_db ("hollandc_italy"); at the end of your first line of code and @mysql_select_db("hollandc_italy") or die; on the next line. Delete the first one.
You are also missing a comma and single quotation mark in your values list after the $number_of_room field:
VALUES =
('$hotel_name',
'$connect',
'$cost_per_miute',
'$itf',
'$commission_hotel',
'$commission_agent',
'$contactid',
'$number_of_room', // Added comma here
'$manager', // Added opening single quotation here
'$hotel_name',
'$hotel_address',
'$hotel_phone',
'$city',
'$country',
'$manager_phone',
'$faxnumber',
'$emailname',
'$website',
'$account_nr',
'$password',
'$responsible_agent',
'$notes_on_hotel',
'$bank_name',
'$bank_swift_code',
'$bank_account_nr',
'$bank_location',
'$ani',
'$hotel_man_email');
P.S. $cost_per_miute <-- is spelled wrong ;)