I was following a tutorial on this site on how to make a login using ajax, php and MySQL.
I got stuck however (obviously)
My question is near the end of this post in bold text
Thanks for reading..
1
I have made a database named 'barnoldswickinbloom'..
Made a table in there called 'members'..
In the table are 4 columns: id (int) , username (varchar), email (varchar) and password (varchar).
2
Now obviously I am not going to paste the password although there is nothing on there anyway but here is the php script..
<?php header('Access-Control-Allow-Origin: *');
$username = $_GET['fname'];
$password = $_GET['fpass'];
$con=mysqli_connect('theipadress','theusername','thepassword','barnoldswickinbloom');
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$qz = "SELECT id FROM members WHERE username='$username' AND password='$password'" ;
$qz = str_replace("\'","",$qz);
$result = mysqli_query($con,$qz);
while($row = mysqli_fetch_array($result))
{
echo $row['id'];
}
mysqli_close($con);
?>
3
And here is a screenshot of the eventsheet:
Now my QUESTION!!!!
I would expect at least to see a return value in my Text field. The Textfield does change from the initial "..." to blank so the AJAX is getting to completion.
But nothing at all. It does not give me any error which I have had before due to using localhost insetad of an ipadress in the php script. I had a NaN and a Can't connect to server error before, but those are both fixed. Now I simply get nothing.
If you want to see how it currently works and that the text field does indeed change in it's current state, here it is online http://barnoldswickinbloom.co.uk/
As username use: Guest
As password use: 1234
Even if it fails from what I understand it should return a 0 instead of a positive number.
Here is a link to both the capx and the php script. I did ofcourse change the login information in the php script.
https://dl.dropboxusercontent.com/u/175 ... truct.capx
https://dl.dropboxusercontent.com/u/1750576/login.php