Jump to content

shivabharat

Members
  • Posts

    371
  • Joined

  • Last visited

    Never

Posts posted by shivabharat

  1. You dont have to explicitly check for true or false.

    [code]$insert = sprintf("INSERT INTO Users (FirstName, LastName, Usrname,Passwrd, AccessLevel, last_login,UserID)
                            VALUES ('%s', '%s', '%s', '%s', '%d', '%s', '%d')",
                                $FirstName, $Surname, $uname, $passwd,$accesslevel, $regdate, $_SESSION['UID']);
    $Reply = mssql_query($insert, $link);
    if ($Reply)
    {
        echo "Data Inserted";
    }
    else
    {
      echo "Not Inserted";
    }
    [/code]
  2. This is the output of the program


                            ****************************
                            ****************************
                            ******** L-G-H Team ********
                            ****************************
                            ****************************
                                the result is 6.285714
                                    you got it :D

    press any key to exit...



  3. Hi Cohan,

    Thanks for the posting. Whenever you feel you need help please make sure you can narrow down the issue to an extend. I dont think we can go thorugh the long code which you have posted. Let uu know exactly were you think the issue is.

    Thanks
  4. Hi,

    I guess your query needs to be like this. There needs to be some mapping between the two table (primary-foriegn) key relation.

    [b]assignmentdata table values[/b]

    [table][tr][td]3, 3, 'Sports (Action)', 10
    2, 2, 'Portraits (1 straight, 1 environmental)', 10
    1, 1, 'Photograph Something Meaningful', 10
    [/table]

    [b]grades table values[/b]

    [table][tr][td]1, 1, 1, '9.0', 'Nice solution to a difficult...etc. etc.'
    2, 1, 1, '8.0', 'Nice solution to a difficult...etc. etc.'[/table]



    [CODE] SELECT SUM(a.maxgradepoints) AS maxgrade, AVG(g.earned) AS avgrade FROM assignmentdata a, grades g where a.id=g.id[/CODE]

    [b]Output[/b]

    [table][tr][td]20    8.50000[/table]

    What I would suggest is to have your tables relations fixed. Go through the basics.
  5. You can set the privelage that the user will have on the database.

    Refer manual to set the privelage.

     

    You can also store the database that the user will be accesing along with the user name and password. You can retrive this information and make him access the database thats is specified.

  6. First thing Please DOnt double post .....

     

    Now to your question

     

    You can use DATE_ADD function which is quiet handy

     

    select DATE_ADD(\'2004-01-11\',INTERVAL 7 DAY) 

     

    We know a week has 7 days

     

    The above query will add 7 days to the given date

     

    The result of the above query would be 2004-01-18

     

    Now you have to save the result and add till the date difference is ZERO

    
    SELECT (TO_DAYS(\'2004-04-17\')-TO_DAYS(\'2004-01-11\'))

     

    This query will give the date difference which is 97

     

    So you need to maintain a variable which would also subtract \"7\" from this total and also add to the date.

     

    So when the result is ZERO it means that you have finished.

     

    I hope I am clear

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