Breaking down a database insert query
Posted: Sat Mar 27, 2004 12:08 pm
I started a thread last night "Changing WebDate Code" but not seeing the light yet I figured I could ask some more questions. Can someone break down this insert query for me?
This is how I translate and what I don't understand, please tell me if I am wrong.
What does the "q" stand for?
"INSERT INTO dt_message" is calling the table.
(sid, rid, subject, message, timesent) is the table column names. What do you think sid and rid stand for?
VALUES (".$fMember[id].", $rid, '$subject', '$message', ".(strtotime(date("d M Y H:i:s"))).")"); are variables collecting values from a form.
Now I changed to code (to below) to simply add a fixed subject and message but it did not insert anything into the database. Please tell me what I did wrong?
Thanks for your help.
Code: Select all
q("INSERT INTO dt_messages (sid, rid, subject, message, timesent) VALUES (".$fMemberїid].", $rid, '$subject', '$message', ".(strtotime(date("d M Y H:i:s"))).")");What does the "q" stand for?
"INSERT INTO dt_message" is calling the table.
(sid, rid, subject, message, timesent) is the table column names. What do you think sid and rid stand for?
VALUES (".$fMember[id].", $rid, '$subject', '$message', ".(strtotime(date("d M Y H:i:s"))).")"); are variables collecting values from a form.
Now I changed to code (to below) to simply add a fixed subject and message but it did not insert anything into the database. Please tell me what I did wrong?
Code: Select all
VALUES (".$fMemberїid].", $rid, 'Virtual Kiss', 'You have been Virtual Kissed', ".(strtotime(date("d M Y H:i:s"))).")");