DarkVision Posted November 28, 2010 Share Posted November 28, 2010 hi guys i need help i started a code of a page Register.php and i need to now what to do now and if this function is 100% ok with the php rules <?php // ---- session_start(); error_reporting(E_ALL); include_once("...\\config.php") //---------------------------------------------------- function getRegisteredBy($Reg); { switch($Reg){ case 0: return "AccountName"; case 1: return "AccountPassword"; case 2: return "AccountEmail"; } } $Reg = mssql_query("INSERT INTO MEMB_INFO (memb___id,memb__pwd,memb_mail,) VALUES ($AccountName,$AccountPassword,$AccountEmail)"); ?> thx for the help and have a good day Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/ Share on other sites More sharing options...
requinix Posted November 28, 2010 Share Posted November 28, 2010 Uh, yeah... You posted a tiny bit of code alongside a very vague and cryptic question. Want to try again? Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/#findComment-1140561 Share on other sites More sharing options...
MrXHellboy Posted November 28, 2010 Share Posted November 28, 2010 Just the function... Yes, According to the syntax, its ok. Dont see the point really..... I agree with requinix, not very clear. Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/#findComment-1140562 Share on other sites More sharing options...
DarkVision Posted November 28, 2010 Author Share Posted November 28, 2010 i need help i started a code of a page Register.php and i need to now what to do now and if this function is 100% ok with the php rules is that more clear ? Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/#findComment-1140596 Share on other sites More sharing options...
Aftiii Posted November 28, 2010 Share Posted November 28, 2010 I would store all your functions in one php file then include them at the top of your register.php file. In regards to implementing functions within your code, I know a little but not enough. I'd have a look at this link http://www.w3schools.com/php/php_functions.asp. Sorry I couldn't be much more help. Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/#findComment-1140618 Share on other sites More sharing options...
DarkVision Posted November 28, 2010 Author Share Posted November 28, 2010 in my php designer it gives an error when i try to type function getRegisterBy($reg) Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/#findComment-1140630 Share on other sites More sharing options...
Pikachu2000 Posted November 28, 2010 Share Posted November 28, 2010 in my php designer it gives an error when i try to type function getRegisterBy($reg) According to your code, the function getRegisterBy() doesn't exist. getRegisteredBy() does. Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/#findComment-1140642 Share on other sites More sharing options...
DarkVision Posted November 28, 2010 Author Share Posted November 28, 2010 still has an error please how to finish the code ? function getRegisteredBy($Reg); { switch($Reg){ case 0: return "AccountName"; case 1: return "AccountPassword"; case 2: return "AccountEmail"; } } $Reg = mssql_query("INSERT INTO MEMB_INFO (memb___id,memb__pwd,memb_mail,) VALUES ($AccountName,$AccountPassword,$AccountEmail)"); Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/#findComment-1140659 Share on other sites More sharing options...
Pikachu2000 Posted November 28, 2010 Share Posted November 28, 2010 It would be helpful to post the actual error instead of making us guess. Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/#findComment-1140667 Share on other sites More sharing options...
DarkVision Posted November 28, 2010 Author Share Posted November 28, 2010 syntax error Unexpected T_Function this is the error in the function line Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/#findComment-1140676 Share on other sites More sharing options...
Pikachu2000 Posted November 28, 2010 Share Posted November 28, 2010 Then the problem is before the function() definition, not in it. The error is saying that php doesn't expect a function there, so something isn't closed properly before it. Could be a missing curly brace, or quote, or semicolon. Post the code that comes before the function also. Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/#findComment-1140684 Share on other sites More sharing options...
DarkVision Posted November 29, 2010 Author Share Posted November 29, 2010 is this 100% ok to do ? function getRegisteredBy($Reg) { switch($Reg){ case 0: return "AccountName"; case 1: return "AccountPassword"; case 2: return "AccountEmail"; } } $Reg = mssql_query("INSERT INTO MEMB_INFO (memb___id,memb__pwd,memb_mail,) VALUES ($AccountName,$AccountPassword,$AccountEmail)"); Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/#findComment-1140892 Share on other sites More sharing options...
Pikachu2000 Posted November 29, 2010 Share Posted November 29, 2010 Since nobody here can tell just what it is you're trying to do with it, and its use isn't apparent from looking at the code, and you're evidently reluctant to provide more code, the best answer you'll get is the one you've already gotten: it is syntactically correct. Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/#findComment-1140894 Share on other sites More sharing options...
DarkVision Posted November 29, 2010 Author Share Posted November 29, 2010 as i am telling for every each and one of you i am trying to finish a web register page using this and i need to now how to finish Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/#findComment-1140902 Share on other sites More sharing options...
Pikachu2000 Posted November 29, 2010 Share Posted November 29, 2010 The function is never used in that code, so there is no way to answer your question other than to say that the function is syntactically correct. There is no way to know if it will work or not, so the best advice is to try it and find out for yourself. Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/#findComment-1140910 Share on other sites More sharing options...
DarkVision Posted November 29, 2010 Author Share Posted November 29, 2010 i didnt finished the code so if i will echo it it should work can you guys show me the finish of my code i am a noob coder please help me to finish the code Quote Link to comment https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/#findComment-1140916 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.