Warning: mysql_query(): supplied argument is not a valid
Posted: Fri Aug 12, 2005 4:33 pm
Hi. I have been stuck this on a while now and I can't seem to figure this out. Connection is good after I put up a test on it. I check the columns and that looks good too.
Here are the columns:
Im getting this error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\AppServ\www\projects\addressbook\addcont.php on line 24
Here is the php script to insert values into table 0001tran of database addressbk:
First line is line 9. Line 24 is the $query. On a side note, whats up with the php offset. I tried putting [php = 9] but it didnt go through.
Here are the columns:
Code: Select all
mysql> describe 0001tran;
+------------+---------------------+------+-----+-------------------+-----------
-----+
| Field | Type | Null | Key | Default | Extra
|
+------------+---------------------+------+-----+-------------------+-----------
-----+
| contact_id | int(11) | | PRI | NULL | auto_incre
ment |
| fname | varchar(50) | | | |
|
| lname | varchar(50) | | | |
|
| hphone | varchar(13) | | | |
|
| cphone | varchar(13) | | | |
|
| wphone | varchar(13) | | | |
|
| email | varchar(50) | | | |
|
| address | varchar(70) | | | |
|
| city | varchar(50) | | | |
|
| state | char(2) | | | |
|
| zip | bigint(20) unsigned | | | 0 |
|
| bday | date | | | 0000-00-00 |
|
| note | text | | | |
|
| date_added | timestamp | YES | | CURRENT_TIMESTAMP |
|
+------------+---------------------+------+-----+-------------------+-----------
-----+
14 rows in set (0.00 sec)Here is the php script to insert values into table 0001tran of database addressbk:
First line is line 9. Line 24 is the $query. On a side note, whats up with the php offset. I tried putting [php = 9] but it didnt go through.
Code: Select all
<?php
$conn = mysql_connect("localhost", "root", "huidaoguoqu123");
mysql_select_db("addressbk", $conn);
/* $sql = "INSERT INTO 0001tran (fname, lname, hphone, cphone,
wphone, email, address, city, state, zip, note)
values ('".$_POST['addfname']."', '".$_POST['addlname']."', '".$_POST['addhphone']."',
'".$_POST['addcphone']."', '".$_POST['addwphone']."', '".$_POST['addemail']."',
'".$_POST['addaddress']."', '".$_POST['addcity']."', '".$_POST['addstate']."',
'".$_POST['addzip']."', '".$_POST['addnote']."')"; */
$query = "INSERT INTO 0001tran (fname, lname, email)
VALUES ('Abdullah', 'Hamad', 'test@test.com')";
echo $query;
$test = mysql_query($query, Sconn);
echo "Contact added!";
?>