Jump to content

chiba

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Posts posted by chiba

  1. I am new to Oracle and need to write a script to extract data from three tables.

     

    The code below works and produces results. For every transaction in the  transaction_table it produces a row with the customers details.

    select
    u.account_id,
    u.currency_code,
    u.country_of_residence_name,
    t.bet_desc,
    t.event_name,
    t.amount,
    t.settled_dt,
    t.acc_stat_summ_id
    
    from transaction_table t
    
    inner join customer_details u
    on t.account_id = u.account_id
    
    where u.country_of_residence_name = 'Canada'
    and t.bet_desc = 'Withdrawal'
    and t.event_name = 'Bank Transfer'
    and t.settled_dt> '01 Aug 2012'
    
    

     

    But I need to link it to a further table , how can this be done? I tried he following but got no results.

    select
    u.account_id,
    u.currency_code,
    u.country_of_residence_name,
    t.bet_desc,
    t.event_name,
    t.amount,
    t.settled_dt,
    t.acc_stat_summ_id
    
    from transaction_table t
    
    inner join customer_details u
    on t.account_id = u.account_id
    
    
    inner join bank_transfers b
    on t.acc_stat_summ_id = b.bank_transfer_id
    
    where u.country_of_residence_name = 'Canada'
    and t.bet_desc = 'Withdrawal'
    and t.event_name = 'Bank Transfer'
    and t.settled_dt> '01 Aug 2012'
    
    

  2. Why am I getting this error message after I fill out the form and press submit? The data is entered correctly into the database, but the header doesn't work.  :'(

     

    Warning: Cannot modify header information - headers already sent by (output started at /home/content/27/9433527/html/site/includes/overall/header.php:3) in /home/content/27/9433527/html/site/register.php on line 69

     

    <?php
    include 'core/init.php';
    include 'includes/overall/header.php';
    if(empty($_POST)===false)
    {
    $required_fields = array('username','password','password_again','first_name','last_name','email');
    foreach ($_POST as $key=>$value)
    {
    	if (empty($value) && in_array($key, $required_fields)===true)
    	{
    		//if one error is found then break out
    		$errors[] = 'Fields marked with an asterisk are required';
    		break 1;
    	}
    }
    if(empty($errors)===true)
    {
    	// triple === type checks as well as the value
    	if (user_exists($_POST['username']) ===true)
    	{
    		$errors[] = 'Sorry the username \''.htmlentities($_POST['username']) . '\' is already taken.';	
    	}
    	if (preg_match("/\\s/",$_POST['username']) == true)
    	{
    
    		$errors[] = 'Your username must not contain any spaces.';	
    	}
    	if (strlen($_POST['password']) < 6)
    	{
    		$errors[] = 'Your password must be at least 6 characters';
    	}
    	if ($_POST['password'] !== $_POST['password_again'])
    	{
    		$errors[] = 'Your passwords do not match';	
    	}
    	if (filter_var($_POST['email'],FILTER_VALIDATE_EMAIL)===false)
    	{
    		$errors[] = 'A valid email address is required';
    
    	}
    	if (email_exists($_POST['email'])===true)
    	{
    		$errors[] = 'Sorry the email \'' .$_POST['email'] . '\' is already in use';
    	}
    }
    }
    ?>
    <h1>Register</h1>
    <?php
    if (isset($_GET['sucess']) && empty($_GET['sucess']))
    {
    echo 'You\'ve been registered sucessfully.';
    }
    else
    {
    	if (empty($_POST) === false && empty($errors)===true)
    	{
    		$register_data = array(
    			'username' => $_POST['username'],
    			'password' => $_POST['password'],
    			'first_name' => $_POST['first_name'],
    			'last_name' => $_POST['last_name'],
    			'email' => $_POST['email']
    		);
    		register_user($register_data);
    		header('Location: register.php?sucess');
    		exit();
    	}
    	else if (empty($errors) === false)
    	{
    		echo output_errors($errors);	
    	}
    ?>
    <p>Please fill out the form below to register an account.</p>
    <form action="" method="post">
    	<ul>
    		<li>
    		Username*:<br />
    		<input type="text" name="username">
    		</li>
    		<li>
    		Password*<br />
    		<input type="password" name="password">
    		</li>
    		<li>
    		Password again*<br />
    		<input type="password" name="password_again">
    		</li>
    		<li>
    		First Name*:<br />
    		<input type="text" name="first_name">
    		</li>
    		<li>
    		Last Name*:<br />
    		<input type="text" name="last_name">
    		</li>
    		<li>
    		Email address*:<br />
    		<input type="text" name="email">
    		</li>
    		<li>
    		<input type="submit" value="Register">
    		</li>
    	</ul>
    </form>
    <?php
    }
    include 'includes/overall/footer.php'; 
    ?>

  3. Can someone explain why this table sits outside of the div?

     

    <?PHP
    mysql_connect('mickey','mouse', 'donald');
    mysql_select_db('duck');
    
    $sql = mysql_query("SELECT * FROM Links");
    
    $limit = 1;
    $count = 0;
    $output = "";
    
    echo "<table border='1'>";
    
    while ($row = mysql_fetch_array($sql))
    {
    $Name = $row['Name'];
    $Description = $row['Description'];
    $Link = $row['Link'];
    if ($count < $limit)
    {
    	if ($count ==0)
    	{
    		$output .=  "<tr>";
    	}
    	// Title
    	$output .= "<td>Site name</td><td>Category</td>";
    
    }
    else
    {
    	$count = 0;
    	$output .= "</tr><tr><td><a href='$Link'>$Name</a></td><td>$Description</td>";
    }
    $count++;
    }
    $output .= "</tr></table>";
    ?>

     

    <body>
    <div id="page">
    
    <?php include("include_header.php"); ?>
    
    <div id="mainContainer">
    <?php include("include_menu.php"); ?>
    
    <div id="main">
    <h2>Links</h2>
    
    <p>The contents of the table below are held in a MySQL database and the table is rendered dynamically when the page is loaded.</p>
    <?php echo $output ?>
    <p>Table</p>
    <div class="clear">
    
    </div><!--main end-->
    <div class="clear">
    </div>
    </div><!--mainContainer end-->
    <div class="clear">
    </div>
    
    <?php include("include_footer.php"); ?>
    
    </body>
    </html>

     

    #page
    {
    margin-right:auto;
    margin-left:auto;
    width:900px;
    /*height:590px;*/
    height:auto;
    }
    
    #header
    {
    width:900px;
    height:80px;
    }
    
    #mainContainer
    {
    margin-top:5px;
    margin-left:auto;
    margin-right:auto;
    background-color:#6e6e6e;
    -moz-border-radius: 5px;
    border-radius: 5px;
    width:890px;
    /*height:700px;*/
    height:auto;
    padding:5px;
    overflow:hidden;
    }
    #main
    {
    background-color:#FFFFFF;
    -moz-border-radius: 5px;
    border-radius: 5px;
    width:736px;
    /*height:695px;*/
    height:auto;
    margin:0 auto;
    float:right;
    /*overflow: auto;*/
    padding-left:5px;
    border: 2px solid #000; 
    overflow:hidden;
    }
    #menu
    {
    background-color:#FFFFFF;
    -moz-border-radius: 5px;
    border-radius: 5px;
    width:135px;
    /*height:695px;*/
    height:100%;
    float: left;
    padding-left:5px;
    padding-bottom:5px;
    border: 2px solid #000;
    }
    #footer
    {
    width:890px;
    height:60px;
    background-color:#6e6e6e;
    -moz-border-radius: 5px;
    border-radius: 5px;
    margin-top:5px;
    padding:5px;
    }
    #footerContent
    {
    background-color:#FFFFFF;
    -moz-border-radius: 5px;
    border-radius: 5px;
    width:886px;
    height:56px;
    text-align:center;
    border: 2px solid #000;
    }

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