Jump to content

[Help]Register.php file


DarkVision

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/220053-helpregisterphp-file/
Share on other sites

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.

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)");

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.

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)");

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.