#Why saving data for 3 columns into 1 column?

1 messages · Page 1 of 1 (latest)

tough vesselBOT
#

<@&987246584574140416> please have a look, thanks.

#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

indigo stream
#

What?

south dome
# indigo stream What?

Is sqlite if you may help, want to insert data into table, but the inserion is wrong, if you can see the image

indigo stream
#

Print out in the code what is actually in guide.getMobileNumber() at the point it is retrieved by this method

south dome
indigo stream
#

Cool, put this line:
System.out.println("guide.getQualifications() contains: %s".formated(guide.getQualifications()));
right under this line:
pstmt.setString(6, guide.getQualifications());
And send what gets printed out

south dome
#

Connection to SQLite has been established.
guide.getQualifications() contains: null
Inserting the following data:
First Name: halanad
Last Name: manc
Email: [email protected]
password: manc4521
mobileNumber:789621,professional,102145
qualifications:null
VerificationStatus:false
account number:0
role:guide
Data inserted successfully!

severe plinth
#

This look correct though?

#

In your logs it says mobileNumber:789621,professional,102145

#

in your column it's mobileNumber:789621,professional,102145

#

so your guide.getMobileNumber() is wrong

indigo stream
#

Ok, that is interesting, because is says: guide.getQualifications() contains: null, which means it got null from that method - why would it insert something like that...

#

Observation - all the values before mobile number in that log contain ":", the rest don't.
I would try to search where that log comes from and start looking for something fucky in there

#

Also, I would try inserting plain string there, see what happens

#

Actually, what I would like to see is
System.out.println("guide.getPassword() contains: %s".formated(guide.getPassword()));

south dome
#

Thankz, all, the error was coming from here

#

<label for="mobileNumber">Mobile Number:</label>
<input type="tel" id="mobileNumber" name="mobileNumber" required/>

    <label for="qualifications"> qualifications:</label>
    <input type="qualifications" id="qualifications" name="mobileNumber" required/>

    <label for="">accountNr:</label>
    <input type="accountNr" id="accountNr " name="mobileNumber" required/>
indigo stream
#

What sort of definition is that?

#

I am assuming you are using some framework, but this does not ring a bell...

south dome
indigo stream
#

I am talking about that XML up there, never saw that before

indigo stream
south dome
#

seems like this now

#

<label for="mobileNumber">Mobile Number:</label>
<input type="tel" id="mobileNumber" name="mobileNumber" required/>

    <label for="qualifications">Qualifications:</label>
    <input type="text" id="qualifications" name="qualifications" required/>

    <label for="accountNr">Account Number:</label>
    <input type="text" id="accountNr" name="accountNr" required/>
#

Do you see the difference? I was sitting 5hrs only those

indigo stream
#

May I ask what is the name of the file this html is in?

south dome
indigo stream
#

Thymeleaf...yeah, I never used that 🙂

south dome
tough vesselBOT
indigo stream
#

Dammit, ignore that

south dome
indigo stream
#

Expert? No, but I know things

south dome
#

for logical help

#

I have this method: ``` public boolean updateUserProfile(String email, String password) {
Connection conn = null;
try {
conn = DbConfig.connectDb();
String query = "UPDATE user SET password = ? WHERE email = ?";
PreparedStatement statement = conn.prepareStatement(query);
statement.setString(1, password);
statement.setString(2, email);
int rowsUpdated = statement.executeUpdate();

        // Check if any rows were updated; if yes, the update operation was successful.
        if (rowsUpdated > 0) {
            return true;
        }
    } catch (SQLException e) {
        System.out.println(e.getMessage());
    } finally {
        try {
            if (conn != null) {
                conn.close();
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
    return false;
}                                                                                                            ```
#

in two classes those are almost the same, so I want to abstract as interface and both implement, so I want to make crud operatio without interacting with the database?

indigo stream
#

...what you are doing is pretty low level, I wonder why are you not using any framework

#

Anyway, sorry, gotta go, but unless anybody else helps I should be around in couple of hours

indigo stream
# south dome I can only use what is allowed

Sure - so my first thought in this case would be to go abstract - make abstract class that has all the functionality and a abstract method that retrieves the non-common part (just the table name?) Then extend it by two classes, one for user, other for that other table and implement just that method

south dome
indigo stream
#

Best of luck