fallenangel1983 Posted March 20, 2008 Share Posted March 20, 2008 Hello, I have a table on a server with 8 columns named the event table. In php and html i am giving the user the ability to create row of this table. However my problem arises as i only want to update certain columns NOT all 8. For example i only want to insert new data into 4 of the columns. so how would i update those specific colmns rather than the entire table? I cannot find a tutorial specific enough to help me. can anybody here? i know that i use: "insert into events where...... values(....... but that does not put them into specific columns. any help would be appreciated. Cheers Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted March 20, 2008 Share Posted March 20, 2008 It sounds like you need an UPDATE query. The rows actually exist already, so you want to update the columns. UPDATE tablename SET column1='new value', column2='new value' WHERE [...] Quote Link to comment Share on other sites More sharing options...
fallenangel1983 Posted March 20, 2008 Author Share Posted March 20, 2008 thankyou for your reply but i dont think the rows are created. The TABLE is created but there are no values inside it to update. What i am trying to say is that if i use the query = "select * from events;" it shows nothing. It is for that reason that i do not think the update query will work. can i use the insert statement into specific columns? e.g. Insert into events (blah,blah,blah) values (newvalue,newvalue,newvalue); and if so how would that statement be worded? Quote Link to comment Share on other sites More sharing options...
fenway Posted March 20, 2008 Share Posted March 20, 2008 If the row isn't already there, it's an insert --- you can specify 4/8 columns if you want. If it is there, it's an update. Whree's the confusion/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.