Forum Moderators: open
Oh and the commented out lines work, but not the "insert into customer" one...
Yes both tables are in the same db.
<?php
$user=wuser;
$pass=wpass;
$host='localhost';
$dbase='test';
echo "Before connecting to MySQL<br>";
$sql = mysql_connect($host, $user, $pass) or die (mysql_error());
echo "Connected to MySQL via PHP<br>";
mysql_select_db($dbase, $sql) or die (mysql_error());
$sql_query = mysql_query("INSERT INTO customer (cid,uname,upass,fname,lname,email,custaddress,custphone,zipcode) VALUES ("2","u2","u2pass","u2fn","u2ln","u2email","u2addy","u2phone","93307"[smilestopper])"[smilestopper]) or die (mysql_error());
# $sql_query = mysql_query("INSERT INTO t1(t1data) VALUES ('row1')"[smilestopper]) or die (mysql_error());
# $result = mysql_query("select * from t1"[smilestopper]);
# $row = mysql_fetch_array($result);
# echo "Return value = ".$row[0]."<br>";
mysql_close($sql);
echo "Goodbye!";
?>
=====================
Info on table:
mysql> describe customer;
+-------------+-----------------------+------+-----+---------+----------------+
¦ Field ¦ Type ¦ Null ¦ Key ¦ Default ¦ Extra ¦
+-------------+-----------------------+------+-----+---------+----------------+
¦ cid ¦ mediumint(8) unsigned ¦ NO ¦ PRI ¦ NULL ¦ auto_increment ¦
¦ uname ¦ varchar(12) ¦ NO ¦ ¦ ¦ ¦
¦ upass ¦ varchar(32) ¦ NO ¦ ¦ ¦ ¦
¦ fname ¦ varchar(10) ¦ NO ¦ ¦ ¦ ¦
¦ lname ¦ varchar(10) ¦ NO ¦ ¦ ¦ ¦
¦ email ¦ varchar(45) ¦ NO ¦ ¦ ¦ ¦
¦ custaddress ¦ varchar(45) ¦ NO ¦ ¦ ¦ ¦
¦ custphone ¦ varchar(14) ¦ NO ¦ ¦ ¦ ¦
¦ zipcode ¦ varchar(5) ¦ NO ¦ ¦ ¦ ¦
+-------------+-----------------------+------+-----+---------+----------------+
9 rows in set (0.00 sec)
mysql> select * from customer;
+-----+-------+--------+-------+-------+---------+-------------+-----------+----
-----+
¦ cid ¦ uname ¦ upass ¦ fname ¦ lname ¦ email ¦ custaddress ¦ custphone ¦ zipcode ¦
+-----+-------+--------+-------+-------+---------+-------------+-----------+----
-----+
¦ 1 ¦ u1 ¦ u1pass ¦ u1fn ¦ u1ln ¦ u1email ¦ u1addy ¦ u1phone ¦ 93306 ¦
+-----+-------+--------+-------+-------+---------+-------------+-----------+----
-----+
1 row in set (0.00 sec)
============
Going insane and cannot figure this out, same permissions on commented "t1" table as "customer" table, AYUDA ME!
Yes, I get output if I don't do the "customer" query.
And the worste part, if I paste the INSERT in console, it works...