+ Reply to Thread
Page 3 of 9 FirstFirst 1 2 3 4 5 ... LastLast
Results 41 to 60 of 165

Thread: HTML Website help     submit to reddit submit to twitter

  1. #41
    Salvage Bans
    Join Date
    Jun 2011
    Posts
    927
    BG Level
    5
    FFXI Server
    Sylph

    Quote Originally Posted by octopus View Post
    Try something like this in a php file and change according to what you want it to look like:

    Code:
    <?php
    	// Specify your sqlite database name and path //
    	$dir = 'sqlite:NESCollection.db';
    				 
    	// Instantiate PDO connection object and failure msg //
    	$dbh = new PDO($dir) or die("cannot open database");
    				 
    	// Define your SQL statement, myTable = table name in your DB //
    	$sql = "SELECT * FROM NES";
    				 
    	// Apply statement //
    	$statement = $dbh->query($sql);
    
    	// Fetch the results // 
    	$rowset = $statement->fetchAll();
    ?>
    
    <html>
    <body>
    	<table>
    		<tr>
    			<?php foreach ( $rowset as $row ) : ?>
    			<td><?=$row['Title']?></td>
    			<td><?=$row['Rarity']?></td>
    			<td><?=$row['NumCopies']?></td>
    			<?php endforeach; ?>
    		</tr>
    	</table>
    </body>
    </html>
    Edited it a little and fixed the formatting. For some reason if you do </tr> after the <?php endforeach; ?> line it fucks the formatting all up.

    </tr> after <?php endforeach; ?>

    Spoiler: show




    </tr> after the last </td>
    Spoiler: show




    But alas it works! I appreciate all the help so far. I'm gonna have to re do the scrolling banner thing now because professor wants to be able to navigate himself (or if he doesnt click arrow it changes it its self)

    Code:
    <html>
    
    			
    	<?php
    				 
    		// Specify your sqlite database name and path //
    		$dir = 'sqlite:NESCollection.db';
    			 
    		// Instantiate PDO connection object and failure msg //
    		$dbh = new PDO($dir) or die("cannot open database");
    				 
    		// Define your SQL statement, myTable = table name in your DB //
    		$sql = "SELECT * FROM NES";
    			 
    		// Apply statement //
    		$statement = $dbh->query($sql);
    
    		// Fetch the results // 
    		$rowset = $statement->fetchAll();
    	?>
    			
    
    	<head>
    		<link id="pagestyle" href="style.css" rel="stylesheet" type="text/css">
    		<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
    		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    		<script src="js/dw_event.js" type="text/javascript"></script>
    		<script src="js/dw_rotator.js" type="text/javascript"></script>
    		
    		<script type="text/javascript">
    			var rotator1 = {
    			path:   'images/',
    			id:   'r1', // id of image that rotates
    			speed:  3000, // default 4500
    			images: ["nes.jpg", "snes.jpg", "n64.jpg", "gc.jpg"]
    			}
    		
    			function initRotator() {
    				dw_Rotator.setup(rotator1);
    			}
    		
    			dw_Event.add( window, 'load', initRotator);
    		</script>
    		
    	</head>
    	
    	<body>
    
    		<div id="header">
    			<h1>Retro Game Collection</h1>
    		</div>
    
    		
    		<div id="body">
    			
    			<img id="r1" src="images/nes.jpg" alt="">
    
    			<h1>NES Titles</h1>
    			
    			<div id="contentBox" style="margin:0px auto; width:100%">
    					
    				<div id="column1" style="float:left; margin:3; width:30%;">
    					content (scrolls overflow)
    				</div>
    
    				<div id="column2" style="float:left; margin:3;width:30%;">
    					content (scrolls overflow)
    				</div>
    
    				<div id="column3" style="float:left; margin:3;width:30%;">
    					content (scrolls overflow)
    				</div>
    			</div>
    
    			<table border ="1" width: "100%">
    				<tr>
    					<?php foreach ( $rowset as $row ) : ?>
    						<td><?=$row['Title']?></td>
    						<td><?=$row['Rarity']?></td>
    						<td><?=$row['NumCopies']?></td></tr>
    					<?php endforeach; ?>
    			</table>
    			
    		</div>
    
    	</body>
    
    	
    </html>
    Oh also how do i get the column Names to show up? Like so it will Say:

    Title Rarity NumQuantity

  2. #42

    Before the first <tr>, add this:

    Code:
      <tr>
        <th>Title</th>
        <th>Rarity</th> 
        <th># Copies</th>
      </tr>

  3. #43
    Salvage Bans
    Join Date
    Jun 2011
    Posts
    927
    BG Level
    5
    FFXI Server
    Sylph

    Quote Originally Posted by octopus View Post
    Before the first <tr>, add this:

    Code:
      <tr>
        <th>Title</th>
        <th>Rarity</th> 
        <th># Copies</th>
      </tr>
    OH... duh lmao was thinking I had to actually pull from the file but that works lol. I fixed the width and stuff in the style sheet, fairly easy, but now my professor wants the stuiped slider to work. EDIT: Have it working just have to clean it up, one thing that is bothering me is the table. When i have the page half screen its perfect, although when I full screen the page the table is positioned to the right side of the columns. How do force it below the columns without creating pannels and doing it that way?

    Slider Code + Mine:
    Code:
    <html>
    		
    	<?php
    				 
    		// Specify your sqlite database name and path //
    		$dir = 'sqlite:NESCollection.db';
    			 
    		// Instantiate PDO connection object and failure msg //
    		$dbh = new PDO($dir) or die("cannot open database");
    				 
    		// Define your SQL statement, myTable = table name in your DB //
    		$sql = "SELECT * FROM NES";
    			 
    		// Apply statement //
    		$statement = $dbh->query($sql);
    
    		// Fetch the results // 
    		$rowset = $statement->fetchAll();
    	?>
    			
    	<head>
    		<meta charset="utf-8">
    		<meta name="viewport" content="width=device-width">
    		<title>NES Collection</title>
    		<link id="pagestyle" href="style.css" rel="stylesheet" type="text/css">
    		<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
    		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    	</head>
    	
    	<body>
    
    		<div id="header">
    			<h1>Retro Game Collection</h1>
    		</div>
    		
    		<!-- Caption Style -->
    		<style> 
    			.captionOrange, .captionBlack
    			{
    				color: #fff;
    				font-size: 20px;
    				line-height: 30px;
    				text-align: center;
    				border-radius: 4px;
    			}
    			.captionOrange
    			{
    				background: #EB5100;
    				background-color: rgba(235, 81, 0, 0.6);
    			}
    			.captionBlack
    			{
    				font-size:16px;
    				background: #000;
    				background-color: rgba(0, 0, 0, 0.4);
    			}
    			a.captionOrange, A.captionOrange:active, A.captionOrange:visited
    			{
    				color: #ffffff;
    				text-decoration: none;
    			}
    			a.captionOrange:hover
    			{
    				color: #eb5100;
    				text-decoration: underline;
    				background-color: #eeeeee;
    				background-color: rgba(238, 238, 238, 0.7);
    			}
    			.bricon
    			{
    				background: url(../img/browser-icons.png);
    			}
    		</style>
    		<!-- it works the same with all jquery version from 1.x to 2.x -->
    		<script type="text/javascript" src="../js/jquery-1.9.1.min.js"></script>
    		<!-- use jssor.slider.mini.js (40KB) or jssor.sliderc.mini.js (32KB, with caption, no slideshow) or jssor.sliders.mini.js (28KB, no caption, no slideshow) instead for release -->
    		<!-- jssor.slider.mini.js = jssor.sliderc.mini.js = jssor.sliders.mini.js = (jssor.js + jssor.slider.js) -->
    		<script type="text/javascript" src="../js/jssor.js"></script>
    		<script type="text/javascript" src="../js/jssor.slider.js"></script>
    		<script>
    			jQuery(document).ready(function ($) {
    				//Reference http://www.jssor.com/development/slider-with-slideshow-jquery.html
    				//Reference http://www.jssor.com/development/tool-slideshow-transition-viewer.html
    
    				var _SlideshowTransitions = [
    					//Rotate Overlap
    					{ $Duration: 1200, $Zoom: 11, $Rotate: -1, $Easing: { $Zoom: $JssorEasing$.$EaseInQuad, $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInQuad }, $Opacity: 2, $Round: { $Rotate: 0.5 }, $Brother: { $Duration: 1200, $Zoom: 1, $Rotate: 1, $Easing: $JssorEasing$.$EaseSwing, $Opacity: 2, $Round: { $Rotate: 0.5 }, $Shift: 90 } },
    					//Switch
    					{ $Duration: 1400, x: 0.25, $Zoom: 1.5, $Easing: { $Left: $JssorEasing$.$EaseInWave, $Zoom: $JssorEasing$.$EaseInSine }, $Opacity: 2, $ZIndex: -10, $Brother: { $Duration: 1400, x: -0.25, $Zoom: 1.5, $Easing: { $Left: $JssorEasing$.$EaseInWave, $Zoom: $JssorEasing$.$EaseInSine }, $Opacity: 2, $ZIndex: -10 } },
    					//Rotate Relay
    					{ $Duration: 1200, $Zoom: 11, $Rotate: 1, $Easing: { $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInQuad }, $Opacity: 2, $Round: { $Rotate: 1 }, $ZIndex: -10, $Brother: { $Duration: 1200, $Zoom: 11, $Rotate: -1, $Easing: { $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInQuad }, $Opacity: 2, $Round: { $Rotate: 1 }, $ZIndex: -10, $Shift: 600 } },
    					//Doors
    					{ $Duration: 1500, x: 0.5, $Cols: 2, $ChessMode: { $Column: 3 }, $Easing: { $Left: $JssorEasing$.$EaseInOutCubic }, $Opacity: 2, $Brother: { $Duration: 1500, $Opacity: 2 } },
    					//Rotate in+ out-
    					{ $Duration: 1500, x: -0.3, y: 0.5, $Zoom: 1, $Rotate: 0.1, $During: { $Left: [0.6, 0.4], $Top: [0.6, 0.4], $Rotate: [0.6, 0.4], $Zoom: [0.6, 0.4] }, $Easing: { $Left: $JssorEasing$.$EaseInQuad, $Top: $JssorEasing$.$EaseInQuad, $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInQuad }, $Opacity: 2, $Brother: { $Duration: 1000, $Zoom: 11, $Rotate: -0.5, $Easing: { $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInQuad }, $Opacity: 2, $Shift: 200 } },
    					//Fly Twins
    					{ $Duration: 1500, x: 0.3, $During: { $Left: [0.6, 0.4] }, $Easing: { $Left: $JssorEasing$.$EaseInQuad, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2, $Outside: true, $Brother: { $Duration: 1000, x: -0.3, $Easing: { $Left: $JssorEasing$.$EaseInQuad, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2 } },
    					//Rotate in- out+
    					{ $Duration: 1500, $Zoom: 11, $Rotate: 0.5, $During: { $Left: [0.4, 0.6], $Top: [0.4, 0.6], $Rotate: [0.4, 0.6], $Zoom: [0.4, 0.6] }, $Easing: { $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInQuad }, $Opacity: 2, $Brother: { $Duration: 1000, $Zoom: 1, $Rotate: -0.5, $Easing: { $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInQuad }, $Opacity: 2, $Shift: 200 } },
    					//Rotate Axis up overlap
    					{ $Duration: 1200, x: 0.25, y: 0.5, $Rotate: -0.1, $Easing: { $Left: $JssorEasing$.$EaseInQuad, $Top: $JssorEasing$.$EaseInQuad, $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInQuad }, $Opacity: 2, $Brother: { $Duration: 1200, x: -0.1, y: -0.7, $Rotate: 0.1, $Easing: { $Left: $JssorEasing$.$EaseInQuad, $Top: $JssorEasing$.$EaseInQuad, $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInQuad }, $Opacity: 2 } },
    					//Chess Replace TB
    					{ $Duration: 1600, x: 1, $Rows: 2, $ChessMode: { $Row: 3 }, $Easing: { $Left: $JssorEasing$.$EaseInOutQuart, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2, $Brother: { $Duration: 1600, x: -1, $Rows: 2, $ChessMode: { $Row: 3 }, $Easing: { $Left: $JssorEasing$.$EaseInOutQuart, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2 } },
    					//Chess Replace LR
    					{ $Duration: 1600, y: -1, $Cols: 2, $ChessMode: { $Column: 12 }, $Easing: { $Top: $JssorEasing$.$EaseInOutQuart, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2, $Brother: { $Duration: 1600, y: 1, $Cols: 2, $ChessMode: { $Column: 12 }, $Easing: { $Top: $JssorEasing$.$EaseInOutQuart, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2 } },
    					//Shift TB
    					{ $Duration: 1200, y: 1, $Easing: { $Top: $JssorEasing$.$EaseInOutQuart, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2, $Brother: { $Duration: 1200, y: -1, $Easing: { $Top: $JssorEasing$.$EaseInOutQuart, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2 } },
    					//Shift LR
    					{ $Duration: 1200, x: 1, $Easing: { $Left: $JssorEasing$.$EaseInOutQuart, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2, $Brother: { $Duration: 1200, x: -1, $Easing: { $Left: $JssorEasing$.$EaseInOutQuart, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2 } },
    					//Return TB
    					{ $Duration: 1200, y: -1, $Easing: { $Top: $JssorEasing$.$EaseInOutQuart, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2, $ZIndex: -10, $Brother: { $Duration: 1200, y: -1, $Easing: { $Top: $JssorEasing$.$EaseInOutQuart, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2, $ZIndex: -10, $Shift: -100 } },
    					//Return LR
    					{ $Duration: 1200, x: 1, $Delay: 40, $Cols: 6, $Formation: $JssorSlideshowFormations$.$FormationStraight, $Easing: { $Left: $JssorEasing$.$EaseInOutQuart, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2, $ZIndex: -10, $Brother: { $Duration: 1200, x: 1, $Delay: 40, $Cols: 6, $Formation: $JssorSlideshowFormations$.$FormationStraight, $Easing: { $Top: $JssorEasing$.$EaseInOutQuart, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2, $ZIndex: -10, $Shift: -100 } },
    					//Rotate Axis down
    					{ $Duration: 1500, x: -0.1, y: -0.7, $Rotate: 0.1, $During: { $Left: [0.6, 0.4], $Top: [0.6, 0.4], $Rotate: [0.6, 0.4] }, $Easing: { $Left: $JssorEasing$.$EaseInQuad, $Top: $JssorEasing$.$EaseInQuad, $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInQuad }, $Opacity: 2, $Brother: { $Duration: 1000, x: 0.2, y: 0.5, $Rotate: -0.1, $Easing: { $Left: $JssorEasing$.$EaseInQuad, $Top: $JssorEasing$.$EaseInQuad, $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInQuad }, $Opacity: 2 } },
    					//Extrude Replace
    					{ $Duration: 1600, x: -0.2, $Delay: 40, $Cols: 12, $During: { $Left: [0.4, 0.6] }, $SlideOut: true, $Formation: $JssorSlideshowFormations$.$FormationStraight, $Assembly: 260, $Easing: { $Left: $JssorEasing$.$EaseInOutExpo, $Opacity: $JssorEasing$.$EaseInOutQuad }, $Opacity: 2, $Outside: true, $Round: { $Top: 0.5 }, $Brother: { $Duration: 1000, x: 0.2, $Delay: 40, $Cols: 12, $Formation: $JssorSlideshowFormations$.$FormationStraight, $Assembly: 1028, $Easing: { $Left: $JssorEasing$.$EaseInOutExpo, $Opacity: $JssorEasing$.$EaseInOutQuad }, $Opacity: 2, $Round: { $Top: 0.5 } } }
    				];
    
    				var _CaptionTransitions = [
    				//CLIP|LR
    				{$Duration: 900, $Clip: 3, $Easing: $JssorEasing$.$EaseInOutCubic },
    				//CLIP|TB
    				{$Duration: 900, $Clip: 12, $Easing: $JssorEasing$.$EaseInOutCubic },
    
    				//DDGDANCE|LB
    				{$Duration: 1800, x: 0.3, y: -0.3, $Zoom: 1, $Easing: { $Left: $JssorEasing$.$EaseInJump, $Top: $JssorEasing$.$EaseInJump, $Zoom: $JssorEasing$.$EaseOutQuad }, $Opacity: 2, $During: { $Left: [0, 0.8], $Top: [0, 0.8] }, $Round: { $Left: 0.8, $Top: 2.5} },
    				//DDGDANCE|RB
    				{$Duration: 1800, x: -0.3, y: -0.3, $Zoom: 1, $Easing: { $Left: $JssorEasing$.$EaseInJump, $Top: $JssorEasing$.$EaseInJump, $Zoom: $JssorEasing$.$EaseOutQuad }, $Opacity: 2, $During: { $Left: [0, 0.8], $Top: [0, 0.8] }, $Round: { $Left: 0.8, $Top: 2.5} },
    
    				//TORTUOUS|HL
    				{$Duration: 1500, x: 0.2, $Zoom: 1, $Easing: { $Left: $JssorEasing$.$EaseOutWave, $Zoom: $JssorEasing$.$EaseOutCubic }, $Opacity: 2, $During: { $Left: [0, 0.7] }, $Round: { $Left: 1.3} },
    				//TORTUOUS|VB
    				{$Duration: 1500, y: -0.2, $Zoom: 1, $Easing: { $Top: $JssorEasing$.$EaseOutWave, $Zoom: $JssorEasing$.$EaseOutCubic }, $Opacity: 2, $During: { $Top: [0, 0.7] }, $Round: { $Top: 1.3} },
    
    				//ZMF|10
    				{$Duration: 600, $Zoom: 11, $Easing: { $Zoom: $JssorEasing$.$EaseInExpo, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2 },
    
    				//ZML|R
    				{$Duration: 600, x: -0.6, $Zoom: 11, $Easing: { $Left: $JssorEasing$.$EaseInCubic, $Zoom: $JssorEasing$.$EaseInCubic }, $Opacity: 2 },
    				//ZML|B
    				{$Duration: 600, y: -0.6, $Zoom: 11, $Easing: { $Top: $JssorEasing$.$EaseInCubic, $Zoom: $JssorEasing$.$EaseInCubic }, $Opacity: 2 },
    
    				//ZMS|B
    				{$Duration: 700, y: -0.6, $Zoom: 1, $Easing: { $Top: $JssorEasing$.$EaseInCubic, $Zoom: $JssorEasing$.$EaseInCubic }, $Opacity: 2 },
    
    				//ZM*JDN|LB
    				{$Duration: 1200, x: 0.8, y: -0.5, $Zoom: 11, $Easing: { $Left: $JssorEasing$.$EaseLinear, $Top: $JssorEasing$.$EaseOutCubic, $Zoom: $JssorEasing$.$EaseInCubic }, $Opacity: 2, $During: { $Top: [0, 0.5]} },
    				//ZM*JUP|LB
    				{$Duration: 1200, x: 0.8, y: -0.5, $Zoom: 11, $Easing: { $Left: $JssorEasing$.$EaseLinear, $Top: $JssorEasing$.$EaseInCubic, $Zoom: $JssorEasing$.$EaseInCubic }, $Opacity: 2, $During: { $Top: [0, 0.5]} },
    				//ZM*JUP|RB
    				{$Duration: 1200, x: -0.8, y: -0.5, $Zoom: 11, $Easing: { $Left: $JssorEasing$.$EaseLinear, $Top: $JssorEasing$.$EaseInCubic, $Zoom: $JssorEasing$.$EaseInCubic }, $Opacity: 2, $During: { $Top: [0, 0.5]} },
    
    				//ZM*WVR|LT
    				{$Duration: 1200, x: 0.5, y: 0.3, $Zoom: 11, $Easing: { $Left: $JssorEasing$.$EaseLinear, $Top: $JssorEasing$.$EaseInWave }, $Opacity: 2, $Round: { $Rotate: 0.8} },
    				//ZM*WVR|RT
    				{$Duration: 1200, x: -0.5, y: 0.3, $Zoom: 11, $Easing: { $Left: $JssorEasing$.$EaseLinear, $Top: $JssorEasing$.$EaseInWave }, $Opacity: 2, $Round: { $Rotate: 0.8} },
    				//ZM*WVR|TL
    				{$Duration: 1200, x: 0.3, y: 0.5, $Zoom: 11, $Easing: { $Left: $JssorEasing$.$EaseInWave, $Top: $JssorEasing$.$EaseLinear }, $Opacity: 2, $Round: { $Rotate: 0.8} },
    				//ZM*WVR|BL
    				{$Duration: 1200, x: 0.3, y: -0.5, $Zoom: 11, $Easing: { $Left: $JssorEasing$.$EaseInWave, $Top: $JssorEasing$.$EaseLinear }, $Opacity: 2, $Round: { $Rotate: 0.8} },
    
    				//RTT|10
    				{$Duration: 700, $Zoom: 11, $Rotate: 1, $Easing: { $Zoom: $JssorEasing$.$EaseInExpo, $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInExpo }, $Opacity: 2, $Round: { $Rotate: 0.8} },
    
    				//RTTL|R
    				{$Duration: 700, x: -0.6, $Zoom: 11, $Rotate: 1, $Easing: { $Left: $JssorEasing$.$EaseInCubic, $Zoom: $JssorEasing$.$EaseInCubic, $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInCubic }, $Opacity: 2, $Round: { $Rotate: 0.8} },
    				//RTTL|B
    				{$Duration: 700, y: -0.6, $Zoom: 11, $Rotate: 1, $Easing: { $Top: $JssorEasing$.$EaseInCubic, $Zoom: $JssorEasing$.$EaseInCubic, $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInCubic }, $Opacity: 2, $Round: { $Rotate: 0.8} },
    
    				//RTTS|R
    				{$Duration: 700, x: -0.6, $Zoom: 1, $Rotate: 1, $Easing: { $Left: $JssorEasing$.$EaseInQuad, $Zoom: $JssorEasing$.$EaseInQuad, $Rotate: $JssorEasing$.$EaseInQuad, $Opacity: $JssorEasing$.$EaseOutQuad }, $Opacity: 2, $Round: { $Rotate: 1.2} },
    				//RTTS|B
    				{$Duration: 700, y: -0.6, $Zoom: 1, $Rotate: 1, $Easing: { $Top: $JssorEasing$.$EaseInQuad, $Zoom: $JssorEasing$.$EaseInQuad, $Rotate: $JssorEasing$.$EaseInQuad, $Opacity: $JssorEasing$.$EaseOutQuad }, $Opacity: 2, $Round: { $Rotate: 1.2} },
    
    				//RTT*JDN|RT
    				{$Duration: 1000, x: -0.8, y: 0.5, $Zoom: 11, $Rotate: 0.2, $Easing: { $Left: $JssorEasing$.$EaseLinear, $Top: $JssorEasing$.$EaseOutCubic, $Zoom: $JssorEasing$.$EaseInCubic }, $Opacity: 2, $During: { $Top: [0, 0.5]} },
    				//RTT*JDN|LB
    				{$Duration: 1000, x: 0.8, y: -0.5, $Zoom: 11, $Rotate: 0.2, $Easing: { $Left: $JssorEasing$.$EaseLinear, $Top: $JssorEasing$.$EaseOutCubic, $Zoom: $JssorEasing$.$EaseInCubic }, $Opacity: 2, $During: { $Top: [0, 0.5]} },
    				//RTT*JUP|RB
    				{$Duration: 1000, x: -0.8, y: -0.5, $Zoom: 11, $Rotate: 0.2, $Easing: { $Left: $JssorEasing$.$EaseLinear, $Top: $JssorEasing$.$EaseInCubic, $Zoom: $JssorEasing$.$EaseInCubic }, $Opacity: 2, $During: { $Top: [0, 0.5]} },
    				{$Duration: 1000, x: -0.5, y: 0.8, $Zoom: 11, $Rotate: 1, $Easing: { $Left: $JssorEasing$.$EaseInCubic, $Top: $JssorEasing$.$EaseLinear, $Zoom: $JssorEasing$.$EaseInCubic }, $Opacity: 2, $During: { $Left: [0, 0.5] }, $Round: { $Rotate: 0.5 } },
    				//RTT*JUP|BR
    				{$Duration: 1000, x: -0.5, y: -0.8, $Zoom: 11, $Rotate: 0.2, $Easing: { $Left: $JssorEasing$.$EaseInCubic, $Top: $JssorEasing$.$EaseLinear, $Zoom: $JssorEasing$.$EaseInCubic }, $Opacity: 2, $During: { $Left: [0, 0.5]} },
    
    				//R|IB
    				{$Duration: 900, x: -0.6, $Easing: { $Left: $JssorEasing$.$EaseInOutBack }, $Opacity: 2 },
    				//B|IB
    				{$Duration: 900, y: -0.6, $Easing: { $Top: $JssorEasing$.$EaseInOutBack }, $Opacity: 2 },
    
    				];
    
    				var options = {
    					$AutoPlay: true,                                    //[Optional] Whether to auto play, to enable slideshow, this option must be set to true, default value is false
    					$AutoPlaySteps: 1,                                  //[Optional] Steps to go for each navigation request (this options applys only when slideshow disabled), the default value is 1
    					$AutoPlayInterval: 4000,                            //[Optional] Interval (in milliseconds) to go for next slide since the previous stopped if the slider is auto playing, default value is 3000
    					$PauseOnHover: 1,                               //[Optional] Whether to pause when mouse over if a slider is auto playing, 0 no pause, 1 pause for desktop, 2 pause for touch device, 3 pause for desktop and touch device, 4 freeze for desktop, 8 freeze for touch device, 12 freeze for desktop and touch device, default value is 1
    
    					$ArrowKeyNavigation: true,   			            //[Optional] Allows keyboard (arrow key) navigation or not, default value is false
    					$SlideDuration: 500,                                //[Optional] Specifies default duration (swipe) for slide in milliseconds, default value is 500
    					$MinDragOffsetToSlide: 20,                          //[Optional] Minimum drag offset to trigger slide , default value is 20
    					//$SlideWidth: 600,                                 //[Optional] Width of every slide in pixels, default value is width of 'slides' container
    					//$SlideHeight: 300,                                //[Optional] Height of every slide in pixels, default value is height of 'slides' container
    					$SlideSpacing: 0, 					                //[Optional] Space between each slide in pixels, default value is 0
    					$DisplayPieces: 1,                                  //[Optional] Number of pieces to display (the slideshow would be disabled if the value is set to greater than 1), the default value is 1
    					$ParkingPosition: 0,                                //[Optional] The offset position to park slide (this options applys only when slideshow disabled), default value is 0.
    					$UISearchMode: 1,                                   //[Optional] The way (0 parellel, 1 recursive, default value is 1) to search UI components (slides container, loading screen, navigator container, arrow navigator container, thumbnail navigator container etc).
    					$PlayOrientation: 1,                                //[Optional] Orientation to play slide (for auto play, navigation), 1 horizental, 2 vertical, 5 horizental reverse, 6 vertical reverse, default value is 1
    					$DragOrientation: 3,                                //[Optional] Orientation to drag slide, 0 no drag, 1 horizental, 2 vertical, 3 either, default value is 1 (Note that the $DragOrientation should be the same as $PlayOrientation when $DisplayPieces is greater than 1, or parking position is not 0)
    
    					$SlideshowOptions: {                                //[Optional] Options to specify and enable slideshow or not
    						$Class: $JssorSlideshowRunner$,                 //[Required] Class to create instance of slideshow
    						$Transitions: _SlideshowTransitions,            //[Required] An array of slideshow transitions to play slideshow
    						$TransitionsOrder: 1,                           //[Optional] The way to choose transition to play slide, 1 Sequence, 0 Random
    						$ShowLink: true                                    //[Optional] Whether to bring slide link on top of the slider when slideshow is running, default value is false
    					},
    
    					$CaptionSliderOptions: {                            //[Optional] Options which specifies how to animate caption
    						$Class: $JssorCaptionSlider$,                   //[Required] Class to create instance to animate caption
    						$CaptionTransitions: _CaptionTransitions,       //[Required] An array of caption transitions to play caption, see caption transition section at jssor slideshow transition builder
    						$PlayInMode: 1,                                 //[Optional] 0 None (no play), 1 Chain (goes after main slide), 3 Chain Flatten (goes after main slide and flatten all caption animations), default value is 1
    						$PlayOutMode: 3                                 //[Optional] 0 None (no play), 1 Chain (goes before main slide), 3 Chain Flatten (goes before main slide and flatten all caption animations), default value is 1
    					},
    
    					$BulletNavigatorOptions: {                                //[Optional] Options to specify and enable navigator or not
    						$Class: $JssorBulletNavigator$,                       //[Required] Class to create navigator instance
    						$ChanceToShow: 2,                               //[Required] 0 Never, 1 Mouse Over, 2 Always
    						$AutoCenter: 0,                                 //[Optional] Auto center navigator in parent container, 0 None, 1 Horizontal, 2 Vertical, 3 Both, default value is 0
    						$Steps: 1,                                      //[Optional] Steps to go for each navigation request, default value is 1
    						$Lanes: 1,                                      //[Optional] Specify lanes to arrange items, default value is 1
    						$SpacingX: 10,                                   //[Optional] Horizontal space between each item in pixel, default value is 0
    						$SpacingY: 10,                                   //[Optional] Vertical space between each item in pixel, default value is 0
    						$Orientation: 1                                 //[Optional] The orientation of the navigator, 1 horizontal, 2 vertical, default value is 1
    					},
    
    					$ArrowNavigatorOptions: {
    						$Class: $JssorArrowNavigator$,              //[Requried] Class to create arrow navigator instance
    						$ChanceToShow: 2                                //[Required] 0 Never, 1 Mouse Over, 2 Always
    					}
    				};
    
    				var jssor_slider1 = new $JssorSlider$("slider1_container", options);
    				//responsive code begin
    				//you can remove responsive code if you don't want the slider scales while window resizes
    				function ScaleSlider() {
    					var parentWidth = jssor_slider1.$Elmt.parentNode.clientWidth;
    					if (parentWidth)
    						jssor_slider1.$ScaleWidth(Math.min(parentWidth, 600));
    					else
    						window.setTimeout(ScaleSlider, 30);
    				}
    
    				ScaleSlider();
    
    				if (!navigator.userAgent.match(/(iPhone|iPod|iPad|BlackBerry|IEMobile)/)) {
    					$(window).bind('resize', ScaleSlider);
    				}
    
    
    				//if (navigator.userAgent.match(/(iPhone|iPod|iPad)/)) {
    				//    $(window).bind("orientationchange", ScaleSlider);
    				//}
    				//responsive code end
    			});
    		</script>
    		<!-- Jssor Slider Begin -->
    		<!-- You can move inline styles to css file or css block. -->
    		<div id="slider1_container" style="position: relative; width: 600px;
    			height: 300px; overflow: hidden;">
    
    			<!-- Loading Screen -->
    			<div u="loading" style="position: absolute; top: 0px; left: 0px;">
    				<div style="filter: alpha(opacity=70); opacity:0.7; position: absolute; display: block;
    					background-color: #000; top: 0px; left: 0px;width: 100%;height:100%;">
    				</div>
    				<div style="position: absolute; display: block; background: url(../img/loading.gif) no-repeat center center;
    					top: 0px; left: 0px;width: 100%;height:100%;">
    				</div>
    			</div>
    			
    			<!-- Slides Container -->
    			<div u="slides" style="cursor: move; position: absolute; left: 0px; top: 0px; width: 600px; height: 300px;
    				overflow: hidden;">
    				<div>
    					<a u=image href="#"><img src="../img/landscape/01.jpg" /></a>
    					<div u=caption t="*" class="captionOrange"  style="position:absolute; left:20px; top: 30px; width:300px; height:30px;"> 
    					slideshow transition twins
    					</div>
    				</div>
    				<div>
    					<a u=image href="#"><img src="../img/landscape/02.jpg" /></a>
    					<div u=caption t="*" class="captionOrange"  style="position:absolute; left:20px; top: 30px; width:300px; height:30px;"> 
    					random caption transition
    					</div>
    				</div>
    				<div>
    					<a u=image href="#"><img src="../img/landscape/03.jpg" /></a>
    					<div u=caption t="*" class="captionOrange"  style="position:absolute; left:20px; top: 30px; width:300px; height:30px;"> 
    					mobile ready, touch swipe
    					</div>
    				</div>
    				<div>
    					<a u=image href="#"><img src="../img/landscape/04.jpg" /></a>
    					<div u=caption t="*" class="captionOrange"  style="position:absolute; left:20px; top: 30px; width:300px; height:30px;"> 
    					responsive, scale smoothly
    					</div>
    				</div>
    			</div>
    			
    			<!-- Bullet Navigator Skin Begin -->
    			<!-- jssor slider bullet navigator skin 01 -->
    			<style>
    				/*
    				.jssorb01 div           (normal)
    				.jssorb01 div:hover     (normal mouseover)
    				.jssorb01 .av           (active)
    				.jssorb01 .av:hover     (active mouseover)
    				.jssorb01 .dn           (mousedown)
    				*/
    				.jssorb01 div, .jssorb01 div:hover, .jssorb01 .av
    				{
    					filter: alpha(opacity=70);
    					opacity: .7;
    					overflow:hidden;
    					cursor: pointer;
    					border: #000 1px solid;
    				}
    				.jssorb01 div { background-color: gray; }
    				.jssorb01 div:hover, .jssorb01 .av:hover { background-color: #d3d3d3; }
    				.jssorb01 .av { background-color: #fff; }
    				.jssorb01 .dn, .jssorb01 .dn:hover { background-color: #555555; }
    			</style>
    			<!-- bullet navigator container -->
    			<div u="navigator" class="jssorb01" style="position: absolute; bottom: 16px; right: 10px;">
    				<!-- bullet navigator item prototype -->
    				<div u="prototype" style="POSITION: absolute; WIDTH: 12px; HEIGHT: 12px;"></div>
    			</div>
    			<!-- Bullet Navigator Skin End -->
    			
    			<!-- Arrow Navigator Skin Begin -->
    			<style>
    				/* jssor slider arrow navigator skin 05 css */
    				/*
    				.jssora05l              (normal)
    				.jssora05r              (normal)
    				.jssora05l:hover        (normal mouseover)
    				.jssora05r:hover        (normal mouseover)
    				.jssora05ldn            (mousedown)
    				.jssora05rdn            (mousedown)
    				*/
    				.jssora05l, .jssora05r, .jssora05ldn, .jssora05rdn
    				{
    					position: absolute;
    					cursor: pointer;
    					display: block;
    					background: url(../img/a17.png) no-repeat;
    					overflow:hidden;
    				}
    				.jssora05l { background-position: -10px -40px; }
    				.jssora05r { background-position: -70px -40px; }
    				.jssora05l:hover { background-position: -130px -40px; }
    				.jssora05r:hover { background-position: -190px -40px; }
    				.jssora05ldn { background-position: -250px -40px; }
    				.jssora05rdn { background-position: -310px -40px; }
    			</style>
    			<!-- Arrow Left -->
    			<span u="arrowleft" class="jssora05l" style="width: 40px; height: 40px; top: 123px; left: 8px;">
    			</span>
    			<!-- Arrow Right -->
    			<span u="arrowright" class="jssora05r" style="width: 40px; height: 40px; top: 123px; right: 8px">
    			</span>
    			<!-- Arrow Navigator Skin End -->
    			<a style="display: none" href="http://www.jssor.com">javascript image slider</a>
    		</div>
    		<!-- Jssor Slider End -->
    		
    		<div id="body">
    
    			<h1>NES Titles</h1>
    			
    			<div id="contentBox" style="margin:0px auto; width:100%">
    					
    				<div id="column1" style="float:left; margin:3; width:30%;">
    					content (scrolls overflow)
    				</div>
    
    				<div id="column2" style="float:left; margin:3;width:30%;">
    					content (scrolls overflow)
    				</div>
    
    				<div id="column3" style="float:left; margin:3;width:30%;">
    					content (scrolls overflow)
    				</div>
    			</div>
    
    			<table border ="1" width: "100%">
    				<tr>
    					<th>Title</th>
    					<th>Rarity</th> 
    					<th># Copies</th>
    				</tr>
    				<tr>
    					<?php foreach ( $rowset as $row ) : ?>
    						<td><?=$row['Title']?></td>
    						<td><?=$row['Rarity']?></td>
    						<td><?=$row['NumCopies']?></td></tr>
    					<?php endforeach; ?>
    			</table>
    			
    		</div>
    
    	</body>
    
    		
    	</body>
    </html>
    OK nevermind apprently I was editing something I shouldent have... started over fresh with slider code and resaved and making progress now.

  4. #44
    wotg torrent kitty :3
    Join Date
    Jun 2007
    Posts
    1,643
    BG Level
    6

    For our own sanity, put all the css and js code into external files and include them in the <head> part of your page. Also, I see two closing </body> tags.

  5. #45
    Salvage Bans
    Join Date
    Jun 2011
    Posts
    927
    BG Level
    5
    FFXI Server
    Sylph

    Quote Originally Posted by Aevis View Post
    For our own sanity, put all the css and js code into external files and include them in the <head> part of your page. Also, I see two closing </body> tags.
    Idk why they didn't put it all in js and can pages... they have js pages linked and used >.> I'll try and clean it up after this class. Didn't notice the two /body's thx

  6. #46
    Salvage Bans
    Join Date
    Jun 2011
    Posts
    927
    BG Level
    5
    FFXI Server
    Sylph

    OK new part of project that the professor wants done. He wants me to enlarge the database with more information and a picture . After that he wants the user to be able to add games to the database. I'm fairly sure I can create the text fields and a buttons to store the information, but I'm not sure on how to take that information and add it to the database, can anyone provide some insight on this?

    Also fixed my formatting issues, just created another div to hold the table

  7. #47
    Falcom is better than SE. Change my mind.
    Join Date
    Jun 2006
    Posts
    17,291
    BG Level
    9

    1. You're using PHP you said, correct?
    2. Can you show me an example of your database table? Particularly your column names and data types?

  8. #48
    Salvage Bans
    Join Date
    Jun 2011
    Posts
    927
    BG Level
    5
    FFXI Server
    Sylph

    Quote Originally Posted by Corrderio View Post
    1. You're using PHP you said, correct?
    2. Can you show me an example of your database table? Particularly your column names and data types?
    Yes using php for it. Code should be above

    I havent re-created the database with the information hes wanting but I expect it to be something like this

    Column Names:

    img (will hold the thumbnail image) - No clue what type this will be im 100% lost on this and will be done last once rest is working

    title - varchar(40)
    console - varchar(40)
    genre - varchar(20)
    releaseYear - int(4)
    rarity- varchar(10)

  9. #49
    Falcom is better than SE. Change my mind.
    Join Date
    Jun 2006
    Posts
    17,291
    BG Level
    9

    I'd suggest an autoincrement field in there too. I normally use those as my primary key for databases.

    Anyway, the statement syntax itself to add a row would be:

    Code:
    INSERT INTO table_name
    VALUES (title_value, console_value, genre_value, releaseYear_value, rarity_value)
    However, if you want to add a bit of length to it and have a bit more control over what order to add the values to the columns, you can do it this way:

    Code:
    INSERT INTO table_name (title, console, genre, releaseYear, rarity)
    VALUES (title_value, console_value, genre_value, releaseYear_value, rarity_value)
    EDIT: Holy crap I may have made this more complex for you than it needs to be. Ignore that upload stuff unless it's something your instructor wants or you want to go the extra mile.

  10. #50
    Salvage Bans
    Join Date
    Jun 2011
    Posts
    927
    BG Level
    5
    FFXI Server
    Sylph

    Awesome ty i'll try and get that to work this afternoon. Here is everything I have so far.

    I've hidden the slider code to help make it easier on your eyes
    Code:
    <html>
    		
    	<?php
    				 
    		// Specify your sqlite database name and path //
    		$dir = 'sqlite:GameCollection';
    			 
    		// Instantiate PDO connection object and failure msg //
    		$dbh = new PDO($dir) or die("cannot open database");
    				 
    		// Define your SQL statement, myTable = table name in your DB //
    		$sql = "SELECT * FROM Games";
    			 
    		// Apply statement //
    		$statement = $dbh->query($sql);
    
    		// Fetch the results // 
    		$rowset = $statement->fetchAll();
    	?>
    			
    	<head>
    		<meta charset="utf-8">
    		<meta name="viewport" content="width=device-width">
    		<title>NES Collection</title>
    		<link id="pagestyle" href="style.css" rel="stylesheet" type="text/css">
    		<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
    		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    	</head>
    	
    	<body>
    
    		<div id="header">
    			<h1>Retro Game Collection</h1>
    		</div>
    
    		
    		<div id="body">
    
    			<h1>NES Titles</h1>
    			
    			<div id="contentBox" style="margin:0px auto; width:100%">
    					
    				<div id="column1" style="float:left; margin:3; width:30%;">
    					content (scrolls overflow)
    				</div>
    
    				<div id="column2" style="float:left; margin:3;width:30%;">
    					content (scrolls overflow)
    				</div>
    
    				<div id="column3" style="float:left; margin:3;width:30%;">
    					content (scrolls overflow)
    				</div>
    			</div>
    
    		</div>
    		
    		<div id="midBody">
    			<form>
    				Add a Game to the database:<br>
    				<!-- Image place holder -->
    				Title: <input type="Text" name="title"><br>
    				Console:
    				<select>
    					<option value ="Nintendo"> Nintendo </option>
    					<option value ="Super Nintendo"> Super Nintendo </option>
    					<option value ="Nintendo 64"> Nintendo 64 </option>
    					<option value ="Game Cube"> Game Cube </option>
    					<Option value ="Playstation"> Playstation </option>
    					<option Value ="Playstation2"> Playstaiton 2 </option>
    					<option value ="Xbox"> Xbox </option>
    				</select><br>
    				Genre:
    				<select>
    					<option value="Action"> Action </option>
    					<option value="Beatup"> Beat'em Up </option>
    					<option value="Platform"> Platformer </option>
    					<option value="shooter"> Shooter </option>
    					<option value="Adventure"> Adventure </option>
    					<option value="rpg"> Role-Playing </option>
    					<option value="Sim"> Simulation </option>
    					<option value="strategy"> Strategy </option>
    					<option value="Sports"> Sports </option>
    				</select><br>				
    				Publisher:
    				<select>
    					<option value="Capcom">Capcom </option>
    					<option value="KOEI">KOEI</option>
    					<option value="snk">SNK</option>
    					<option value="sunSoft">SunSoft </option>
    				</select><br>
    				Release Year: <input type="Text" name="releaseYear"><br>
    				Rarity:
    				<select>
    					<option value="Common"> Common </option>
    					<option value="Uncommon"> Uncommon </option>
    					<option value="Rare"> Rare </option>
    					<option value="veryRare"> Very Rare </option>
    					<option value="SuperRare"> Super Rare </option>
    					<option value="Ultrarare"> Ultra Rare </option>
    				</select><br>
    				<input type = "submit" value="submit">
    			</form>
    		</div>
    		
    		<div id="LowerBody">
    			<table border ="1" width: "100%">
    				<tr>
    					<th>Title</th>
    					<th>Console</th> 
    					<th>Genre</th>
    					<th>Publisher</th>
    					<th>Release Year</th>
    					<th>Rarity</th>
    				</tr>
    				<tr>
    					<?php foreach ( $rowset as $row ) : ?>
    						<td><?=$row['title']?></td>
    						<td><?=$row['console']?></td>
    						<td><?=$row['genre']?></td>
    						<td><?=$row['publisher']?></td>
    						<td><?=$row['releaseYear']?></td>
    						<td><?=$row['rarity']?></td></tr>
    					<?php endforeach; ?>
    			</table>			
    		
    		</div>
    		
    	</body>
    	
    </html>


    Link to the database: https://drive.google.com/file/d/0B1A...ew?usp=sharing

    The names and data types are as follows:
    title - varchar(40)
    console - varchar(40)
    genre - varchar(20)
    publisher - varChar(40)
    releaseYear - int(4)
    rarity- varchar(10)

    Also I screwed up the entry for the last game 'Bandit Kings of Ancient china' and entered Role-Playing instead of Super Rare How do i modify that entry?

  11. #51
    Falcom is better than SE. Change my mind.
    Join Date
    Jun 2006
    Posts
    17,291
    BG Level
    9

    Syntax for updating is:
    Code:
    UPDATE table_name
    SET column1=value1,column2=value2,...
    WHERE some_column=some_value;
    In this case, the query would be:
    Code:
    UPDATE Games
    SET rarity = 'Super Rare'
    WHERE title = 'Bandit Kings of Ancient China'
    This is one reason why I'd suggest having an autoincrement column, that way you can reference that for your WHERE clause when you need to update/delete a row

  12. #52
    Salvage Bans
    Join Date
    Jun 2011
    Posts
    927
    BG Level
    5
    FFXI Server
    Sylph

    Awesome thank you that worked. I'm kind of confused on how to add rows now (via the input from my page) I'm sure it its something like

    insert into Games values (title, releaseYear)

    but i have no clue how to actually do that when the submit button is pressed. Also is there a simple way to get the values of each of the drop down menus instead of doing like a if statement? Not asking for answers, just a point in the right direction.

    Edit: I found this snippit of code, am i on the right track?
    Code:
    db:exec[[
      CREATE TABLE test (id INTEGER PRIMARY KEY, content);
      INSERT INTO test VALUES (NULL, 'Hello World');
      INSERT INTO test VALUES (NULL, 'Hello Lua');
      INSERT INTO test VALUES (NULL, 'Hello Sqlite3')
    ]]
    
    local tablefill = [[INSERT INTO test VALUES (NULL, ']]..testvalue[1]..[[',']]..testvalue[2]..[['); ]]
    local tablefill2 = [[INSERT INTO test VALUES (NULL, ']]..testvalue[2]..[[',']]..testvalue[1]..[['); ]]
    local tablefill3 = [[INSERT INTO test VALUES (NULL, ']]..testvalue[1]..[[',']]..testvalue[3]..[['); ]]
    db:exec( tablefill )
    Maybe change it to something like

    Code:
    db:exec[[
        not sure what to do here lol
    ]]
    
    local addgame = [[insert into Games values (title, releaseYear); ]]
    db:exec(addgame)

  13. #53
    Falcom is better than SE. Change my mind.
    Join Date
    Jun 2006
    Posts
    17,291
    BG Level
    9

    To add a row? That's what I posted beforehand with the INSERT statement. Do you mean you need code how to make the Submit button work?

  14. #54
    Salvage Bans
    Join Date
    Jun 2011
    Posts
    927
    BG Level
    5
    FFXI Server
    Sylph

    Quote Originally Posted by Corrderio View Post
    To add a row? That's what I posted beforehand with the INSERT statement. Do you mean you need code how to make the Submit button work?
    oh so when the submit button is hit I just need to say:

    Code:
    INSERT INTO Games VALUES (title, console_value, genre_value, publisher_value, releaseYear, rarity_value)
    How does it know which option value the drop down is? with the text fields I see that its assigning them a variable name but with the selects its never assigning it to anything so kinda confuses me.

    So something like this?:

    Code:
    			<form>
    				Add a Game to the database:<br>
    				<!-- Image place holder -->
    				Title: <input type="Text" name="title"><br>
    				Console:
    				<select>
    					<option value ="Nintendo"> Nintendo </option>
    					<option value ="Super Nintendo"> Super Nintendo </option>
    					<option value ="Nintendo 64"> Nintendo 64 </option>
    					<option value ="Game Cube"> Game Cube </option>
    					<Option value ="Playstation"> Playstation </option>
    					<option Value ="Playstation2"> Playstaiton 2 </option>
    					<option value ="Xbox"> Xbox </option>
    				</select><br>
    				Genre:
    				<select>
    					<option value="Action"> Action </option>
    					<option value="Beatup"> Beat'em Up </option>
    					<option value="Platform"> Platformer </option>
    					<option value="shooter"> Shooter </option>
    					<option value="Adventure"> Adventure </option>
    					<option value="rpg"> Role-Playing </option>
    					<option value="Sim"> Simulation </option>
    					<option value="strategy"> Strategy </option>
    					<option value="Sports"> Sports </option>
    				</select><br>				
    				Publisher:
    				<select>
    					<option value="Capcom">Capcom </option>
    					<option value="KOEI">KOEI</option>
    					<option value="snk">SNK</option>
    					<option value="sunSoft">SunSoft </option>
    				</select><br>
    				Release Year: <input type="Text" name="releaseYear"><br>
    				Rarity:
    				<select>
    					<option value="Common"> Common </option>
    					<option value="Uncommon"> Uncommon </option>
    					<option value="Rare"> Rare </option>
    					<option value="veryRare"> Very Rare </option>
    					<option value="SuperRare"> Super Rare </option>
    					<option value="Ultrarare"> Ultra Rare </option>
    				</select><br>
    				<button type ="submit" formaction = "INSERT INTO GAMES VALUE(title)">Submit Submission </button>
    			</form>

  15. #55
    Falcom is better than SE. Change my mind.
    Join Date
    Jun 2006
    Posts
    17,291
    BG Level
    9

    Not exactly. You can go about this multiple ways such as having JQuery/Javascript do it for you, but for the sake of time and the fact I know next to nothing about either of those, let's go down the PHP route for inserting into a database.

    First off, you need to have your form header tag know where to go. In the header you want it to look like:

    Code:
    <form action = name_of_your_page.php method = "post">
    ...
    </form>
    The action attribute specifies where to send the form data. In this case you want to go back to your current page. I'll explain why in a bit. The method value can either be POST or GET, we want Post to avoid the query string in our URL. You can read more on GET/POST at:

    http://www.w3schools.com/tags/ref_httpmethods.asp

    Next we will want to change your button to a different type. We want it to be a submit form object:

    Code:
    <input type = "submit" value = "Submit" name = "gameSubmit" />
    Now that we got your form and submit button set up, we need give your text boxes and drop downs a name attribute. The name attributes are the identifier for each form object when we request the submitted data:

    Code:
    <select name="insert_name_here">
    ...
    </select>
    
    <input type = "text" name = "insert_name_here" />
    Now that your form is completed, we rely on PHP to get the requested data and put it into a variable using $_REQUEST like so:

    Code:
    <?php
    $title = $_REQUEST["name_of_title_textbox"]
    $console = $_REQUEST["name_of_console_dropdown"]
    $genre = $_REQUEST["name_of_genre_dropdown"]
    $publisher = $_REQUEST["name_of_publisher_dropdown"]
    $releaseYear = $_REQUEST["name_of_release_year_textbox"]
    $rarity = $_REQUEST["name_of_rarity_dropdown"]
    //SQL INSERT STATEMENT AFTER THIS LINE USING THE ABOVE VARIABLES
    ?>
    However, you'll also want to check if form data was sent. That can be done by putting the code into an if statement:

    Code:
    <?php
    if (empty($_POST))
    {
    }
    else
    {
         $title = $_REQUEST["name_of_title_textbox"]
         $console = $_REQUEST["name_of_console_dropdown"]
         $genre = $_REQUEST["name_of_genre_dropdown"]
         $publisher = $_REQUEST["name_of_publisher_dropdown"]
         $releaseYear = $_REQUEST["name_of_release_year_textbox"]
         $rarity = $_REQUEST["name_of_rarity_dropdown"]
         //SQL INSERT STATEMENT AFTER THIS LINE USING THE ABOVE VARIABLES
    }
    ?>
    If you need a quick refresher on PHP SQL Statements:

    http://www.w3schools.com/php/php_mysql_insert.asp

    Hope that helps

  16. #56
    Salvage Bans
    Join Date
    Jun 2011
    Posts
    927
    BG Level
    5
    FFXI Server
    Sylph

    Quote Originally Posted by Corrderio View Post
    Not exactly. You can go about this multiple ways such as having JQuery/Javascript do it for you, but for the sake of time and the fact I know next to nothing about either of those, let's go down the PHP route for inserting into a database.

    First off, you need to have your form header tag know where to go. In the header you want it to look like:

    Code:
    <form action = name_of_your_page.php method = "post">
    ...
    </form>
    The action attribute specifies where to send the form data. In this case you want to go back to your current page. I'll explain why in a bit. The method value can either be POST or GET, we want Post to avoid the query string in our URL. You can read more on GET/POST at:

    http://www.w3schools.com/tags/ref_httpmethods.asp

    Next we will want to change your button to a different type. We want it to be a submit form object:

    Code:
    <input type = "submit" value = "Submit" name = "gameSubmit" />
    Now that we got your form and submit button set up, we need give your text boxes and drop downs a name attribute. The name attributes are the identifier for each form object when we request the submitted data:

    Code:
    <select name="insert_name_here">
    ...
    </select>
    
    <input type = "text" name = "insert_name_here" />
    Now that your form is completed, we rely on PHP to get the requested data and put it into a variable using $_REQUEST like so:

    Code:
    <?php
    $title = $_REQUEST["name_of_title_textbox"]
    $console = $_REQUEST["name_of_console_dropdown"]
    $genre = $_REQUEST["name_of_genre_dropdown"]
    $publisher = $_REQUEST["name_of_publisher_dropdown"]
    $releaseYear = $_REQUEST["name_of_release_year_textbox"]
    $rarity = $_REQUEST["name_of_rarity_dropdown"]
    //SQL INSERT STATEMENT AFTER THIS LINE USING THE ABOVE VARIABLES
    ?>
    However, you'll also want to check if form data was sent. That can be done by putting the code into an if statement:

    Code:
    <?php
    if (empty($_POST))
    {
    }
    else
    {
         $title = $_REQUEST["name_of_title_textbox"]
         $console = $_REQUEST["name_of_console_dropdown"]
         $genre = $_REQUEST["name_of_genre_dropdown"]
         $publisher = $_REQUEST["name_of_publisher_dropdown"]
         $releaseYear = $_REQUEST["name_of_release_year_textbox"]
         $rarity = $_REQUEST["name_of_rarity_dropdown"]
         //SQL INSERT STATEMENT AFTER THIS LINE USING THE ABOVE VARIABLES
    }
    ?>
    If you need a quick refresher on PHP SQL Statements:

    http://www.w3schools.com/php/php_mysql_insert.asp

    Hope that helps
    It helps a lot. Tried that and got some errors. Googled it and said I needed ; at the end of all the lines so added those. the SqL statment also gave me errors when using it, so i added $sql = " "; around it (that's how its called in the php file to load the database so was hoping that was how it needed to be called here). No errors but when I fill in the form and submit it reloads page, but nothing was added to the database. I think it has to do with the php not being attached to the submit code?

    Heres what I have:

    Code:
    			<form action = database.php = "post">
    				Add a Game to the database:<br>
    				<!-- Image place holder -->
    				Title: <input type="Text" name="title"><br>
    				Console:
    				<select name = "console">
    					<option value ="Nintendo"> Nintendo </option>
    					<option value ="Super Nintendo"> Super Nintendo </option>
    					<option value ="Nintendo 64"> Nintendo 64 </option>
    					<option value ="Game Cube"> Game Cube </option>
    					<Option value ="Playstation"> Playstation </option>
    					<option Value ="Playstation2"> Playstaiton 2 </option>
    					<option value ="Xbox"> Xbox </option>
    				</select><br>
    				Genre:
    				<select name= "genre">
    					<option value="Action"> Action </option>
    					<option value="Beatup"> Beat'em Up </option>
    					<option value="Platform"> Platformer </option>
    					<option value="shooter"> Shooter </option>
    					<option value="Adventure"> Adventure </option>
    					<option value="rpg"> Role-Playing </option>
    					<option value="Sim"> Simulation </option>
    					<option value="strategy"> Strategy </option>
    					<option value="Sports"> Sports </option>
    				</select><br>				
    				Publisher:
    				<select name = "publisher">
    					<option value="Capcom">Capcom </option>
    					<option value="KOEI">KOEI</option>
    					<option value ="Rare">Rare</option>
    					<option value="Snk">SNK</option>
    					<option value="SunSoft">SunSoft </option>
    				</select><br>
    				Release Year: <input type="Text" name="releaseYear"><br>
    				Rarity:
    				<select name= "rarity">
    					<option value="Common"> Common </option>
    					<option value="Uncommon"> Uncommon </option>
    					<option value="Rare"> Rare </option>
    					<option value="veryRare"> Very Rare </option>
    					<option value="SuperRare"> Super Rare </option>
    					<option value="Ultrarare"> Ultra Rare </option>
    				</select><br>
    				<input type = "submit" value = "Submit" name = "gameSubmit" />
    				<?php
    					if (empty($_POST))
    					{
    					}
    					else
    					{
    						 $title = $_REQUEST["title"];
    						 $console = $_REQUEST["console"];
    						 $genre = $_REQUEST["genre"];
    						 $publisher = $_REQUEST["publisher"];
    						 $releaseYear = $_REQUEST["releaseYear"];
    						 $rarity = $_REQUEST["rarity"];
    						$sql = "insert into Games Value(title, console, genre, publisher, releaseYear, rarity)";
    					}
    				?>
    			</form>

  17. #57
    wotg torrent kitty :3
    Join Date
    Jun 2007
    Posts
    1,643
    BG Level
    6

    <form action = database.php = "post">
    You're missing the method tag here. Also, Firefox/Chrome have a webconsole. In Firefox, open it, go into the network tab and once you hit the submit button, select the post entry in the console. On the right side under the parameters tab you'll see your POST variables and the values you sent. Chrome's similar. Very useful for debugging.

  18. #58
    Falcom is better than SE. Change my mind.
    Join Date
    Jun 2006
    Posts
    17,291
    BG Level
    9

    Whoops, my bad about the ;s. My last project used VBScript (Which doesn't require those at an end of a life) so I kinda forgot about them...

    And you are submitting it, but I'm not seeing a SQL SELECT query. You'd want that after the if statement.

  19. #59
    Salvage Bans
    Join Date
    Jun 2011
    Posts
    927
    BG Level
    5
    FFXI Server
    Sylph

    Quote Originally Posted by Aevis View Post
    You're missing the method tag here. Also, Firefox/Chrome have a webconsole. In Firefox, open it, go into the network tab and once you hit the submit button, select the post entry in the console. On the right side under the parameters tab you'll see your POST variables and the values you sent. Chrome's similar. Very useful for debugging.
    So it should be like this?
    Code:
    <form action = "database.php" method = "post">
    Quote Originally Posted by Corrderio View Post
    Whoops, my bad about the ;s. My last project used VBScript (Which doesn't require those at an end of a life) so I kinda forgot about them...

    And you are submitting it, but I'm not seeing a SQL SELECT query. You'd want that after the if statement.
    Kinda confused about this. Why do i need a Select statement? I thought select was basically just to pick specific things out of the database. For example

    Select * from Games; displays all objects inside of the games database

    or

    Select * from Games
    Where console = "nintendo"; Displays all the nintendo games in the games database

  20. #60
    Falcom is better than SE. Change my mind.
    Join Date
    Jun 2006
    Posts
    17,291
    BG Level
    9

    Oh whoops, misreead that.

    The first issue I see is Values needs to be plural, also you need to use the variables you created above. You want your Values clause to look something like:

    Code:
    VALUES ('$val1', '$val2', '$val3')"
    After that, all you really did was create a string. Now you need to run the query with that string on your SQLite DB like so:

    Code:
    $ok = sqlite_exec($dir, $sql);
    if (!$ok) die("Cannot execute statement.");

+ Reply to Thread
Page 3 of 9 FirstFirst 1 2 3 4 5 ... LastLast

Similar Threads

  1. Replies: 3
    Last Post: 2011-04-29, 05:09
  2. Replies: 14
    Last Post: 2009-09-11, 13:12