Jump to content

OilSheikh

Members
  • Posts

    69
  • Joined

  • Last visited

    Never

About OilSheikh

  • Birthday 04/29/1985

Profile Information

  • Gender
    Not Telling

OilSheikh's Achievements

Member

Member (2/5)

0

Reputation

  1. 2. Calculate average salary of all employees excl. the highest paid fat cat CREATE OR REPLACE FUNCTION average_emp RETURN AVGSAL IS BEGIN SELECT SAL FROM EMP2 WHERE EMPNO != NULL AND AVGSAL (NUMBER ) = AVG(SUM(SAL) - MAX(SAL)) ; DBMS_OUTPUT.PUT_LINE('Average Salary is : ' || AVGSAL);
  2. Help would be much appreciated. 1. User prompted for values... values checked ... values entered into table. ACCEPT eno NUMBER - PROMPT "Enter Employee no :" ACCEPT enam VARCHAR2 - PROMPT "Enter Employee name :" ACCEPT jo VARCHAR2 - PROMPT "Enter Job Title :" ACCEPT man NUMBER - PROMPT "Enter Manager no :" ACCEPT hd DATE - PROMPT "Enter Starting Date :" ACCEPT sala NUMBER - PROMPT "Enter Employee's salary :" ACCEPT com NUMBER - PROMPT "Enter Employee commission :" ACCEPT dno NUMBER - PROMPT "Enter Employee's Department number :" EXECUTE add_any_emp ( 'eno','enam','jo','man','hd','sala','com','dno'); CREATE OR REPLACE PROCEDURE add_any_emp (aEMPNO IN NUMBER, aENAME IN VARCHAR2, aJOB IN VARCHAR2, aMGR IN NUMBER, aHIREDATE IN DATE, aSAL IN NUMBER, aCOMM IN NUMBER, aDEPTNO IN NUMBER ) AS BEGIN SELECT EMPNO FROM EMP2; IF EMP2.EMPNO = aEMPNO THEN raise_application_error(-20101, 'Employee exists'); ELSE IF aSAL > 20000 THEN aSAL = 20000 ELSE INSERT INTO EMP2 VALUES ( aEMPNO, aENAME, aJOB, aMGR, aHIREDATE, aSAL, aCOMM, aDEPTNO ); END IF; END IF; end;
  3. It's been a long time sicne I cam here. Well, I finished my degree and went the tech support road rather than the Programming road for work. But, I m now back in uni and am once again doomed! I need some help with SQL. Help would be much appreciated. Please tell me on how to fix the incorrect code I have. 1. A script that asks for two hire dates and enables finding employees between them. ( Yes, I already have a table! ) Output required: EMPLOYEES HIRE DATE __________ ________ Empname, job date PROMPT Enter First Date ACCEPT a DATE PROMPT Enter Second Date ACCEPT b DATE SELECT ENAME, JOB, HIREDATE FROM EMP WHERE HIREDATE BETWEEN a AND b COLUMN ENAME HEADING Employees COLUMN ENAME FORMAT ENAME, JOB
  4. Here's the Code. I can't seem to find any errors! Even printed and checked - but can't find nothing. Help would be greatly appreciated. <html> <head> <title>Welcome to Glory Community Accounting services</title> </head> <body> <?php include("menu.php"); ?> <p><br /> <b> <font face="Lucida Sans Unicode" style="font-size: 11pt" color="#808080"> Services for Charity Organizations </font></b> <!-- BIG LIST 1 --> </p> <ul imagesrc="sqblue.gif"> <font face="Lucida Sans Unicode" style="font-size: 11pt" color="#0033CC"> <li>Financial Reporting</li><br /> <!-- SUBLIST 1 --> <ul imagesrc="sqpink.gif"> <font face="Lucida Sans Unicode" style="font-size: 11pt" color="#808080"> <li>Budgeting and Forecasting</li> <li>CashFlow Statement</li> <li>Year End Accounts</li><br /> </font> </ul> <li>Payroll Processing</li><br /><br /> <li>Fixed Assets : <font face="Lucida Sans Unicode" style="font-size: 11pt" color="#808080"> Maintenance & Processing to a Register </font> </li> </font> </ul> <p><br /><b> <font face="Lucida Sans Unicode" style="font-size: 11pt" color="#808080"> Services for Businesses </font></b> <!-- BIG LIST 2 --> </p> <ul imagesrc="sqblue.gif"> <font face="Lucida Sans Unicode" style="font-size: 11pt" color="#0033CC"> <li>Bookkeeping and Accounting Services</li><br /> <!-- SUBLIST 2 --> <ul imagesrc="sqpink.gif"> <font face="Lucida Sans Unicode" style="font-size: 11pt" color="#808080"> <li>Day-to-day Bookkeeping service</li> <li>Year-end Accounts</li> <li>Independent Examiner's Report</li> <li>Quarterly Management accounts report</li> <li>Budget preparation & Business plan</li> <li>Financial and PAYE advice</li> <li>Professionally manage Source Documents</li> <li>Support new Organizations with Accountancy needs</li> <li>Advice on completing Funding applications</li> <br /> </font> </ul> <li>Payroll Services</li><br /> <!-- SUBLIST 3 --> <ul imagesrc="sqpink.gif"> <font face="Lucida Sans Unicode" style="font-size: 11pt" color="#808080"> <li>Process Payrll on a Monthly/Weekly/Fortnightly basis</li> <li>Provide Payslips</li> <li>Submit Year-End Returns (P35/P14 & P60)</li> <li>Deal with PAYE queries</li> <li>Taking responsibility for Inland Revenue inspections</li> <br /> </font> </ul> <li>Other Services</li><br /> <!-- SUBLIST 4 --> <ul imagesrc="sqpink.gif"> <font face="Lucida Sans Unicode" style="font-size: 11pt" color="#808080"> <li>Bookkeeping consultation available at client's premises</li> <li>Volunteer scheme available for Accounting Students</li> <li>Employment and Training for Accounting students</li> <li>Training on Computerized Accounts and Book keeping</li> <br /> </font> </ul> </font> </ul> </body> </html>
  5. Just one last thing, I have a Shopping Cart code which works perfectly. In that, Session registration is done , but this time, in the form of a cookie. If I first Login via login.php and then proceed to cart.php , which uses this session creation : session_start(); setcookie("cartid", session_id(), time() + ((3600 * 24) * 30)); return session_id(); will it cause any conflict ?
  6. I'll send something to both you and PHPFreak
  7. ;D :D FINAAAAAAAALLLLLLLLY, It works! Thanks very much Frost. All the more reason to be generous. PHPFreaks or you need a small payment from me.
  8. Error's gone. BUT ... nothing appears now after loggin in. Just the menu and blank space. ??? Changed back to $rows=mysql_fetch_array($sql); and I am then back at Square One. User Details still DO NOT show up.
  9. kenrbnsn , tried what you said ... I get No rows found for - http://expresspc.110mb.com/page2.php frost, thanks for the rectified code. But, the header already sent error comes again Warning: Cannot modify header information - headers already sent by (output started at /www/110mb.com/e/x/p/r/e/s/s/p/expresspc/htdocs/menu.php: in /www/110mb.com/e/x/p/r/e/s/s/p/expresspc/htdocs/login.php on line 28
  10. If I use the code that Frost suggested : <?php include("SQL.php"); $sql = mysql_query("SELECT * FROM customer WHERE username = '" . $_SESSION[usern] . "' ") or die(mysql_error()); $rows=mysql_fetch_assoc($sql) or die(mysql_error()); echo $rows['Firstname']; ?> ... I still get nothing !
  11. Got rid off the HTML in SQL.PHP Removed ob 's but then 2 errors popped up about Header information already being sent .. blah blah .. Put them back. Wildbug, I put single quotes in relevant places where session was used. Good thing is, the undefined blah blah.. error has gone. Bad thing is, I still can't get to see what I wanted in the first place.
  12. I just thought of something, there is an pay feature on 110mb.com ( $1 only !) to turn Register_Globals ON . At the moment, I haven;t purchased that ... so it's OFF. Could this be the reason?
  13. Ok, systematically, ... LOGIN.PHP > ACC.PHP ( this is the problem is ) SQL.PHP ( connects to database) LOGIN.PHP <?php ob_start(); include("menu.php"); include("SQL.php"); ######### CHECKS THAT FIELDS ARE NOT EMPTY ########## if (isset($_POST ['submit'])) { $usern = $_POST['username']; $passw = $_POST['pass']; $encryptedpass = md5($_POST['pass']); if (!$usern | !$passw) { die ('<br><br><br><font face="Verdana" size="4" color = red>ERROR: Please make sure that all Information is provided.</font> <br><br> <input type="button" value=" Retry " onClick="history.go(-1)"> '); } ######### CHECKS IF username AND CORRESPONDING password EVEN EXIST ! ########## $check = mysql_query("SELECT * FROM customer WHERE username = '$usern' AND password = '$encryptedpass' ") or die(mysql_error()); $check2 = mysql_num_rows($check); if ($check2 == 1) { session_register("usern"); session_register("passw"); header("location:acc.php"); } else if ($check2 == 0) { die ('<br><br><br><font face="Verdana" size="4" color = red>ERROR : The Username and/or Password you have entered does not exist. <br><br>If you are a New User, please <a href = "register.php"><u>Register</u></a> first. </font> <br><br> <input type="button" value=" Retry " onClick="history.go(-1)">'); } } else { ob_end_flush(); ?> <html> <head> <title>Login to your Account or Register for a new Account</title> <link rel="stylesheet" href="styler.css"> </head> <body> <br><br><br> <h2>Please Log in to view Your Account<br><br></h2> <h3> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table border="0" width="101%" cellspacing="1" id="table1" bordercolorlight="#0066FF" height="75"> <tr> <td width="106" height="48">Username</td> <td height="48" width="259"> <input type = "text" name = "username" size="34" maxlength ="7" style = "color:blue"></td> <td height="48" width="32"> </td> <td height="95" rowspan="2">Are you a New User ? Please Register.</td> </tr> <tr> <td width="106" height="47">Password</td> <td height="47" width="259"> <input type = "password" name = "pass" size="34" maxlength = "7" style = "color:blue"></td> <td height="47" width="32"> </td> </tr> <tr> <td width="106"> </td> <td width="259"> </td> <td width="32"> </td> <td> </td> </tr> <tr> <td width="106"> </td> <td width="259"> <p align="center"> <input type = "submit" name = "submit" value = "" style="background : url(login.jpg); width:107px; height:25px; "> </td> <td width="32"> </td> <td> <a href="register.php"> <img border="0" src="reg.jpg" width="101" height="20"></a></td> </tr> <tr> <td width="106"> </td> <td width="259"> </td> <td width="32"> </td> <td> </td> </tr> <tr> <td width="365" colspan="2"><font size="2">Forgotten your Password? <span style="background-color: #FFFFFF"> <a href="recover.php">Recover your password</a>.</span></font></td> <td width="32"> </td> <td> </td> </tr> </table> </form> </h3> <?php include("base.php"); ?> </body> </html> <?php } ?> ACC.PHP <?php error_reporting(E_ALL); session_start(); if(!session_is_registered(usern)) { header("location:home.php"); } include("SQL.php"); include("menu.php"); $sql = mysql_query("SELECT * FROM customer WHERE username = '" . $_SESSION['usern'] . "'") or die(mysql_error()); $rows=mysql_fetch_assoc($sql) or die(mysql_error()); ?> <html> <head> <title>Your Account</title> <link rel="stylesheet" href="styler.css"> </head> <body> <br><br><br> <h1>MY ACCOUNT</h1> <br> <h3>Welcome to Your Account Area , <font size="5" color = blue><?php print $_SESSION[usern] ?> </font></h3> <br> <table border="0" width="101%" cellspacing="0" id="table1" bordercolorlight="#0066FF" height="130" cellpadding="0"> <tr> <td height="27" colspan="2"> <a href="acc.php"><img border="0" src="det2.jpg"></a> <a href="orders.php"> <img border="0" src="ord.jpg"></a> <a href="returns.php"> <img border="0" src="ret.jpg"></a></td> </tr> <tr> <td width="148" height="27"></td> <td width="593"> </td> </tr> <tr> <td width="148" height="27">Customer ID</td> <td width="593"> <? printf ("%04d", $rows['custid']); ?></td> </tr> <tr> <td width="148" height="27">First Name</td> <td height="27" width="593"> <? echo $rows['Firstname']; ?> </td> </tr> <tr> <td width="148" height="23">Surname</td> <td height="23" width="593"><? echo $rows['Surname']; ?></td> </tr> <tr> <td width="148" height="27">Delivery Address</td> <td width="593" height="27"><? echo $rows['address']; ?> * </td> </tr> <tr> <td width="148" height="26">Post Code</td> <td width="593" height="26"><? echo $rows['postcode']; ?> * </td> </tr> <tr> <td width="148" height="27">E-mail Address</td> <td width="593"><? echo $rows['email']; ?> * </td> </tr> </table> <br> <br> <a href="change.php"><img border="0" src="change.jpg"></a> <br><br> </p> </body> <?php include("base.php"); ?> </html> SQL.PHP <head> <title>Connector</title> </head> <body> <?php mysql_connect ("localhost", "expresspc_***" , "***") or die (mysql_error()); mysql_select_db("expresspc_sql") or die (mysql_error()); ?> </body> </html> Go to http://expresspc.110mb.com/home.php and use username - mona and password - 1234 at Login page to check things out.
  14. Since $_SESSION ... didn't change things and even screwed up things ( users can go directly to MY ACCOUNT AREA without logging in) , I went back to using session_register. frost and Wildbug, after using error_reporting(E_ALL); , I get : Notice: Use of undefined constant usern - assumed 'usern' in /www/110mb.com/e/x/p/r/e/s/s/p/expresspc/htdocs/acc.php on line 6 Notice: Use of undefined constant usern - assumed 'usern' in /www/110mb.com/e/x/p/r/e/s/s/p/expresspc/htdocs/acc.php on line 31 And frost110, after using the last code you asked me to apply, I get erm... NOTHING! Just blank space. http://expresspc.110mb.com/page2.php
×
×
  • 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.