Page 1 of 1
Musqli prepared statements
Posted: Sun Nov 18, 2007 4:19 pm
by feinstimmer
I have table with colom colled- ID, and it is int, not null, auto_increment and primary key.If i try to insert values in that table using msqli prepared statement, which specification character i use for bind_param for ID colom and which value has to be inserted to that colom?Thanks in advance!!
Posted: Sun Nov 18, 2007 4:22 pm
by RobertGonzalez
What have you coded so far? And can you use a stored procedure instead of a prepared statement?
Posted: Sun Nov 18, 2007 5:50 pm
by feinstimmer
I am still learning, trying to make registration script using prepered statements to store data in DB.Everything is working till now or et least i can myself make it work except that problem i posted. Didn't read much about stored procedures, is that better solution?Even if it is, i would like to get answer on my question.
Re: Musqli prepared statements
Posted: Mon Nov 19, 2007 9:34 am
by RobertGonzalez
feinstimmer wrote:I have table with colom colled- ID, and it is int
feinstimmer wrote:which specification character i use for bind_param for ID colom
Posted: Mon Nov 19, 2007 9:55 am
by feinstimmer
Ok, i solved it, missed one "?" in prepare and used "i' for specification character.Variable $id needed in bind_param but value is not needed.Thank you Everah.
Posted: Mon Nov 19, 2007 9:56 am
by RobertGonzalez
You got it. Glad I could help.
Posted: Tue Nov 20, 2007 2:43 am
by jmut
Everah wrote:What have you coded so far? And can you use a stored procedure instead of a prepared statement?
No that question is answered, in same context...would you recommend stored procedure and why?
Posted: Tue Nov 20, 2007 9:00 am
by RobertGonzalez
I like stored procs because they live on the database server so you do not constantly have to build queries and send them to the database server. You just call a stored query that is in the DB server. They are safer, faster and centralized.