- Home /
PHP Login not returning anything
Hello, I have been trying to code a login script. My problem is, it appears that my w.text is always empty when it returns to unity. Below I have linked to my codes. What am I doing wrong? Everything seems right but nothing is getting returned to unity from the php file. Am I not supposed to use echo? Should I use return?
Answer by flamy · Jul 18, 2012 at 05:51 AM
You are doing it all correctly execpt one thing, there is a no function in PHP that will be called automatically. Your main function has to be called somewhere inside that php script. probally like
<?php
function main($formUse = true){.....}
// calling the main funciton here
main(true);
// Close mySQL Connection
mysql_close();
?>
other than that everything looks fine. Or you can remove the whole function setup and jus write the statements inside that function outside. Both the ways it would work
So, I can just delete the function and put everthing inside the php file? I'm not quite sure on how to call a function otherwise.
Okay so I would put all code into a function called main? then at the top of the php file call the function main with main(true)?
You are using a form, so the method is not GET but POST.
Try to learn a bit about PHP and HTTP GET and POST method. You can find lots of material about it on the web.
Your answer
![](https://koobas.hobune.stream/wayback/20220613074332im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
PHP Login won't return true no matter what 0 Answers
How to use php login Form [POST] with c# 1 Answer
WebHosting with phpMyAdmin PHP 0 Answers