sql / phpbb question

windows

Guest
hello,
i have an sql question with regards to phpbb, but i asked on their support forums and did not get much of a response so since its more of an sql question i thought i'd ask it here :)

I have added a mod to my phpbb, called charts. basically what it is, is a music chart mod to add a chart to your phpbb, and users vote for the songs "hot" or "not".
I had to put this sql into phpmyadmin to get it to work:

CREATE TABLE phpbb_charts (
chart_id mediumint(8) NOT NULL auto_increment,
chart_song_name varchar(80) NOT NULL,
chart_artist varchar(80) NOT NULL,
chart_album varchar(80) default '',
chart_poster_id varchar(80) NOT NULL,
chart_hot mediumint(8) default '0',
chart_not mediumint(8) default '0',
chart_curr_pos mediumint(8) default '0',
chart_last_pos mediumint(8) default '0',
chart_best_pos mediumint(8) default '0',
PRIMARY KEY (chart_id)
) TYPE=MyISAM;

I want to 'reset' (i.e. go back to zero) the fields for chart_hot and chart_not, but keep the rest of the data. Now, i know i can go and do each entry, but if i have 30 songs in the chart that would mean editing them back to zero individually.
Now, my question is, what is the command to make chart_hot and chart_not 0? I Cant drop or empty the whole table as i would loose all the data (like song names, artists etc) which i dont want to loose.
I am a complete novice to php/sql so i hope you understand and can help :)huh?

you said the default was 0 so notthin is entered in the field then it goes 0

chart_hot mediumint(8) default '0',
chart_not mediumint(8) default '0',Scoutt,
I think he is saying he already has the record in the table, and wants to be able to set those two fields back to 0's at any certain time.

FreeFall,
UPDATE phpbb_charts SET chart_hot = 0, chart_not = 0 WHERE chart_id = <whatever value you have>


I could be mis-interpreting also, so let us know.that could be very true Putts. so to change all of them just do as Putts said but leave of the "where clause" and all of them will be changed back.Originally posted by putts
Scoutt,
I think he is saying he already has the record in the table, and wants to be able to set those two fields back to 0's at any certain time.

FreeFall,
UPDATE phpbb_charts SET chart_hot = 0, chart_not = 0 WHERE chart_id = <whatever value you have>


I could be mis-interpreting also, so let us know.
yeah that is what i want to do.
i have loads of songs, so there will be alot of 'chart_id' numbers, so is there a way to set them all to zero? or will i have to have e.g. 30 commands that go from chart_id = 1 to chart_id = 30?

thanx for all the help btw it is apreciated :)he just gave it to you

mysql_query("UPDATE phpbb_charts SET chart_hot = '0', chart_not = '0'");Originally posted by scoutt
he just gave it to you

mysql_query("UPDATE phpbb_charts SET chart_hot = '0', chart_not = '0'");
no he said:
UPDATE phpbb_charts SET chart_hot = 0, chart_not = 0 WHERE chart_id = <whatever value you have>

which means i have to put the ID of the field in...

So back to my last question :)then if you read what I said after him you will see I said take the where clause off. I also gave you the code in my last post as well.Originally posted by scoutt
then if you read what I said after him you will see I said take the where clause off. I also gave you the code in my last post as well.
ahh so you did sorry ;)
Thank you everyone which helped :)ah i have ran into a problem.
I ran the query, but now when i vote for the song it should say 1, however it still says 0.
I am guessing that this is because i said "SET", i dont want the numbers to be set to zero and not to change, i want to just reset the numbers to zero and be able to be changed, if you know what i mean.running this query

mysql_query("UPDATE phpbb_charts SET chart_hot = '0', chart_not = '0'");

has nothing to do with updating it when you want it updated.

you have to "set" it to change them.

must be anther query problem when you want to change them to 1i ran "UPDATE phpbb_charts SET chart_hot = 0, chart_not = 0" again and it seems to have worked now :)
 
Top