•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 374,174 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,464 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 486 | Replies: 4 | Solved
![]() |
| |
Hello everyone!
I am writing a music database, and I need to insert into album table the path to its cover. However, not every album has a cover in its directory, so I've made an algorithm that only gets the albumID that has a cover. My question is - how can I insert value into one column in a row with a specific ID (or name)? I have tried this -
but it sais that theres an error at WHERE. How can I do this? I am using sqlite3 and C++. Thanks!
I am writing a music database, and I need to insert into album table the path to its cover. However, not every album has a cover in its directory, so I've made an algorithm that only gets the albumID that has a cover. My question is - how can I insert value into one column in a row with a specific ID (or name)? I have tried this -
"insert into albums (cover_path) values ('%s') WHERE albumID=%d" It sounds like you need to UPDATE rather than insert. Insert is used when the row doesn't exist at all. Update is used when you want to change the value of one or more columns in an existing row.
Hope that helps.
UPDATE albums SET cover_path = Your_Path WHERE albumID = Your_Album_Id
Hope that helps.
Maybe I missed the picture ...
You want to insert into table albums ...
Maybe?
You want to insert into table albums ...
insert into albums (albumID, cover_path) values ('%s', %d)Maybe?
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
- Previous Thread: i need help
- Next Thread: Recommended books?


Hybrid Mode