For this week I have been working on setting up by SQL database on localhost but I know nothing about it and I will be researching on how to make a table, learning the right syntax to use in php to communicate with the SQL server.
Next, we need to form a connection to the database and check if we are connected before we can go ahead, this is a small optimization. In order to connect to the database, we declare a reference $conn which will equal to mysqli_Connect which is the syntax needed in the PHP script in order to form a connection. The if condition only checks if a connection is made and if it has not then it will kill the connection with a die function the case below displays an error too.
Next is an optimization I worked on towards the end of the week however it is put before as the code is organized in that manner. In order to check if the email exists there needs to be a search within the database however the language used in SQl is different in order to request for a search the request is sent via a string and it is very strange forward, it simply compares the two emails and throws an error if it exists.
The login is very similar to the email check mentioned above, I actually got the idea to incorporate it from doing the checks in the login script . over here we are sent data using www forms in unity and using $username=$_POST [“usernamePost”] we are pulling it .




Comments
Post a Comment