Firstly, I don't know what tools you have other than a table saw.
To properly prepare lumber=joint one face on a jointer then one edge making it square to the flat face. The go to a thickness planer and with the board flat side down plane it until flat. Then to the table saw and with the jointed edge against the rip fence rip the untouched edge to square it all up. This will give you a board that is flat and square all around. The ends still have to be squared up amd this is best done with a chop saw.
Another method is to make a router sled to flatten the lumber. If you Google router sleds you will find how to make one.
The foregoing can also be done with hand planes but that is a learning curve and takes a lot calories to do.