my database hates me. Need some wise suggestions
| From: | lazybrain | Date: | Thu, 12 Oct 2000 03:59:52 +0000 |
| Subject: | my database hates me. Need some wise suggestions | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-3535@lists.php.net to get a copy of this message | ||
Hi, I will try to describe this the best i can.
I have three files. right.php , left.php and insert.php both right.php and left.php submit with
forms to insert.php and insert.php inserts the data to mysql.
right.php sends the following varibles to insert.php
username, problem, errors, solution, problemtype, techname, datetime, inumber, first, tnumber
,calls.
left.php sends the following varibles to insert.php
username,problem , errors, solution, problemtype, techname,datatime, inumber, first, tnumber, calls.
In mysql i have two tables. info and records. they are below.
info
+--------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+-------+
| name | varchar(100) | | MUL | | |
| username | varchar(16) | | PRI | | |
| phonenumber | varchar(20) | | MUL | | |
| accessnumber | varchar(20) | YES | | NULL | |
| os | varchar(50) | YES | | NULL | |
| domain | varchar(100) | YES | | NULL | |
| phoneline | varchar(10) | YES | | NULL | |
| modembrand | varchar(100) | YES | | NULL | |
| modemchipset | varchar(20) | YES | | NULL | |
| modemspeed | varchar(20) | YES | | NULL | |
| ipaddress | varchar(20) | YES | | NULL | |
| misc | varchar(255) | YES | | NULL | |
| pcbrand | varchar(100) | YES | | NULL | |
+--------------+--------------+------+-----+---------+-------+
13 rows in set (0.00 sec)
and here is records
+-------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+-------+
| username | varchar(20) | | PRI | | |
| problem | blob | YES | | NULL | |
| errors | blob | YES | | NULL | |
| solution | blob | YES | | NULL | |
| problemtype | varchar(40) | YES | | NULL | |
| techname | varchar(20) | YES | | NULL | |
| datetime | datetime | YES | | NULL | |
| inumber | varchar(4) | YES | | NULL | |
| first | char(3) | YES | | NULL | |
| tnumber | varchar(255) | YES | | NULL | |
| calls | int(255) | YES | | NULL | |
+-------------+--------------+------+-----+---------+-------+
11 rows in set (0.00 sec)
The problem is when a user types in this information they type in the username on left.php and
right.php doesnt know that value.
I need to submit $username into records. It inserts everything fine to the info table, but it only
submits the username into the records table and nothing else!
here is the contents of insert.php
________________________________________________
<?
mysql_connect ("localhost", "root");
mysql_select_db (betalpha);
$username2 =$username;
mysql_query ("insert into info
(name, username, phonenumber, accessnumber, os ,domain, phoneline, modembrand,
modemchipset, modemspeed, ipaddress, misc, pcbrand)
values
('$name' , '$username', '$phonenumber', '$accessnumber',
'$os' , '$domain',
'$phoneline', '$modembrand', '$modemchipset', '$modemspped'
, '$ipaddress' ,
'$misc' , '$pcbrand')
") or die (mysql_error());
mysql_query ("INSERT INTO records
(username,problem,errors,solution,problemtype,techname,datetime,inumber,first,tnumber,calls)
VALUES
('$username2','$problem','$errors','$solution','$problemtype','$techname',now(),'$inumber','$first','$tnumber'/,
'1')
") or die(mysql_error());
?>
thanks alot to whomever responds.
mike