Can someone please help me w/the following code? I'm trying to insert data
collected on a form into two tables into my database. I          know the
SQL statements work because I tested them individually, but I keep getting
the error "Couldn't execute query 2". Does               anyone have any
suggestions?

Thanks in Advance


Toni


<?php
$sql = "INSERT INTO users (fname, lname, compid, status, dept, room, bldg,
phone) VALUES ('$fname', '$lname', '$compid',                   '$status',
'$dept', '$room', '$bldg', '$phone')";
$sql1 = "INSERT INTO tickets (ticket_num, compid, date_rpt, time_rpt,
request_type, hardware, model, dci, dci_num, software_type,
software_pkg, problem, comments, entered_by) VALUES ('$ticket_num',
'$compid', '$date_rpt', '$time_rpt', '$request_type',
'$hardware','$model','$dci','$dci_num','$software_type','$software_pkg','$problem','$comments','$entered_by')";

/*create connection*/
$connection = mysql_connect("hostname","user","password") or die ("Couldn't
connect to the server");

/*select database*/
$db = mysql_select_db("db_name", $connection) or die ("Couldn't select
database");

/*execute query and get result*/
$sql_result = mysql_query($sql, $connection) or die ("Couldn't execute
query1");
$sql_result1 = mysql_query($sql1, $connection) or die ("Couldn't execute
query2");

                         if (!sql_result){
                         echo "<p>Couldn't add record!";
                         } else{

                         echo "
                         <p> Record Added!</p>
                         <table cellspacing=5 cellpadding=5>
/*More code down here...*/
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to