Mahesh Godavarti
0

Hello, looks like you have some null values in your table. You will have to first remove them and then enter your command


UPDATE customerFeedback SET score=0 WHERE score IS NULL;

ALTER TABLE customerFeedback MODIFY COLUMN score ENUM('1', '2', '3', '4', '5');


Anonymous
0
I made a new column and set the type as enum but now when I am submitting the rating, I am getting 1 as a result regardless of how many starts I select? What do I need to include on HTML in order for it to label the stars correctly​?
Mahesh Godavarti
0
Do you have any more information you can share? What commands have worked so far? Or this is the first command you are trying?
Prajeeth Emanuel
0
0 is not permitted in the ENUM that you have set. Try setting the score to a default value which is present in your ENUM.
Mahesh Godavarti
0
Prajeeth, thanks. I was wondering about that.
Anonymous
0
I created a whole new column so I didn't use the command above. What I am having trouble is is labeling 1 star as a rating of 1 and 2 stars as a rating of 2 and so forth.
Mahesh Godavarti
0
Okay, I think I am getting the picture. Your column contains strings '1', '2', '3' etc. You want to replace them with numbers 1, 2, 3 etc. Is that correct?
Mahesh Godavarti
0
Okay, looks like our posts crossed. Can you share the exact commands you are using to insert the star rating into the table? Can you also share how you defined your table? "CREATE TABLE" command.
Anonymous
0

Vivekanand Vellanki
0
You still haven't told me how the html is updating the database. What is the html page doing to set the score in the database?
Vivekanand Vellanki
0

Before answering the question, I want to understand how you are modelling data.


I am assuming that users can rate content posted by someone. And, you are trying to capture the users's rating on the content.


If so, how do you capture the rating from multiple users in a single field? For e.g., if UserA gives 5 stars, and UserB gives 1 star - what will the score field contain (5 or 1)? Shouldn't it actually store both 5 and 1?


You mentioned that are trying to update the value in the database from html and it is always storing 1 in the score. How are you updating the score from html?

Zayna Jamjoum
0
Yes so I want every users input to be stored. So if a user presses on the fourth star, the feedback list should display 4 not 1. That’s what it’s currently doing
Anonymous
0
//Stars
PHP: /create insert SQL string $Insert = "INSERT INTO customerFeedback (Name, Feedback, Score, Product, Stars) VALUES ('$name', '$feedback', '$score', '$product','$stars')";*/
Anonymous
0

Vivekanand Vellanki
0
You have used name="star" in the input tag; and the php variable is $stars. Change the php variable to $star and see if this fixes the issue.