Jump to content
Old threads will finally start getting archived ×

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.