Doesn't write data in table
Posted by: feinstimmer (---.adsl.wanadoo.nl)
Date: December 01, 2006 06:19PM

Hi, i am new with PHP and MySQL and try to learn.I am making small registration and activation script with two tables in database.Entering data from online form is fine, also after verification muving data from fitst table to second is fine.Part of code is:

$row = $result->fetch_object();
$username = $row->username;
$password = $row->password;
$email = $row->email;

and entering part is:

$result1 = $conn->query("insert into user values
('$username', '$password', '$email')"winking smiley;

Problem comes when i make one more colom in second table:
user_id, int, 11, not null, unsigned, auto_increment, primary key
In this case data can't enter second table.Why???No eror reports.
Thanks in advance(i am using mysqli).


Options: ReplyQuote
Re: Doesn't write data in table
Posted by: feinstimmer (---.adsl.wanadoo.nl)
Date: December 02, 2006 02:18PM

Forgot to tell that i have WAMP5_1.6.6 installed local(practiceing on my PC).And to also say : if i try to add colom with timestamp in second table(alone or with user_id), that also doesn't work.

Options: ReplyQuote
Re: Doesn't write data in table
Posted by: johny12 (---.147.client42.icenet.net)
Date: December 04, 2006 12:17PM

hey there ,
u must follow the right sql statements to be executed otherwise u will definately get errors
whether u r not entering any value manually in timestamp ,id , u hav to write in ur php code as NULL, or NOW() for id and TIMESTAMP column values respectively
hope u got it buddy !
enjoy smiling smiley

Options: ReplyQuote
Re: Doesn't write data in table
Posted by: feinstimmer (---.adsl.wanadoo.nl)
Date: December 04, 2006 10:57PM

Thanks for advice i got it, it works now, i just instead of this:

$result1 = $conn->query("insert into user values
('$username', '$password', '$email')"winking smiley;

did this:

$result1 = $conn->query("insert into user values
('user_id', 'time_id', '$username', '$password', '$email')"winking smiley;

only now i have problem with timestamp(time_id). I can't with phpmyadmin make that colom to write real time, i always get zero's.How to do it?Thanks in advance!!


Options: ReplyQuote
Re: Doesn't write data in table
Posted by: johny12 (---.in2cable.com)
Date: December 05, 2006 11:49AM

hii,
u just hav to select for 'Timestamp' label in the time_id column creation and it will be automaticall done by the server as 'nything gets inserted
thz it!!
still in doubt???

Options: ReplyQuote
Re: Doesn't write data in table
Posted by: yfastud (72.236.169.---)
Date: December 05, 2006 02:29PM

I'm a very lumpsy coder, but my suggestion is use either TIMESTAMP or DATETIME in mysql and NOW() in php, it should work

check my sample code here

[www.jlbn.com]
[test.jlbn.com]
[mail.jlbn.com]
[forum.jlbn.com]
[ftp.jlbn.com]
[jlbn.com]
[jlbn.com]

Options: ReplyQuote
Re: Doesn't write data in table
Posted by: feinstimmer (---.adsl.wanadoo.nl)
Date: December 05, 2006 10:24PM

Thank you johny12 and yfastud , it works now!!


Options: ReplyQuote


Sorry, only registered users may post in this forum.