+ Reply to Thread
Page 9 of 9 FirstFirst ... 7 8 9
Results 161 to 165 of 165

Thread: HTML Website help     submit to reddit submit to twitter

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

    Quote Originally Posted by Aylee View Post
    i figured it was something with the array being overridden... but it was NOT happy about those changes lol! Get these errors when just trying to run it:

    Code:
    Notice: Undefined variable: param in E:\XAMPP\htdocs\NesList-CSS\Slider\database.php on line 53
    
    Warning: array_merge(): Argument #1 is not an array in E:\XAMPP\htdocs\NesList-CSS\Slider\database.php on line 53
    
    Notice: Array to string conversion in E:\XAMPP\htdocs\NesList-CSS\Slider\database.php on line 66
    
    Notice: Array to string conversion in E:\XAMPP\htdocs\NesList-CSS\Slider\database.php on line 66
    
    Notice: Array to string conversion in E:\XAMPP\htdocs\NesList-CSS\Slider\database.php on line 66
    
    Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1 near "console": syntax error' in E:\XAMPP\htdocs\NesList-CSS\Slider\database.php:77 Stack trace: #0 E:\XAMPP\htdocs\NesList-CSS\Slider\database.php(77): PDO->prepare('SELECT rowid, t...') #1 {main} thrown in E:\XAMPP\htdocs\NesList-CSS\Slider\database.php on line 77
    Gonna look at it when i get off work tonight and try to iron it out. Thanks for the start though
    Yeah after looking at it off and on over a few days I'm clueless. Nothing has really changed other than the array_merge and everything looks right syntax wise. Any suggestions?

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

    update: I was able to fix some of the issues to where the page will actually load upon a search but still getting errors from it, and returning 0 results. It is really confusing me because it is saying "Argument #1 is not an array" but when i do a var_dump($param) it shows that it is an array.
    The errors:
    Code:
    Notice: Undefined variable: param in E:\XAMPP\htdocs\NesList-CSS\Slider\database.php on line 53
    
    Warning: array_merge(): Argument #1 is not an array in E:\XAMPP\htdocs\NesList-CSS\Slider\database.php on line 53
    
    Warning: array_merge(): Argument #1 is not an array in E:\XAMPP\htdocs\NesList-CSS\Slider\database.php on line 53
    
    Notice: Array to string conversion in E:\XAMPP\htdocs\NesList-CSS\Slider\database.php on line 66
    Full Code
    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');
            
            // Set PDO error handling to throw exceptions
            $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            
            // Define your SQL statement, myTable = table name in your DB 
            $sql = 'SELECT rowid, title, console, genre, publisher, releaseyear, rarity, details, image FROM Games';
            
            // If there is no POST data, create empty $param array
            if (empty($_POST)) { $param = array(); }
            // Append POST data dynamically to the query
            else {
                
                //Reset counter
                $i = 0;
                
                //Column whitelist
                $columns = array('title', 'console', 'genre', 'publisher', 'dateRange', 'releaseYear', 'rarity',);
    
                //Loop over the $_POST["game"] array
                foreach($_POST["game"] as $key => $value) {
                
                    //Check if key value is a proper column name
                    if(in_array($key, $columns)) {
                    
                        //Only add condition if it's not empty
                        if(!empty($value)) {
                        
                            //If at first loop, use WHERE, otherwise AND
                            if($i == 0) { $sql .= " WHERE "; }
                            else { $sql .= " AND "; }
                            
                            //SQL LIKE syntax for title
                            if($key == 'title'){
                                $sql .= "$key LIKE ?";
                                $param[] = "%{$value}%";
                            }
                            
                            //Console is a multidimensional array due to multiple checkboxes
                            else if(in_array($key, array('console','genre','publisher','rarity'))) {
                                foreach($value as $placeholderName) {
                                    $sql .= "$key = ?";
                                    if($placeholderName != end($value)) { $sql .= " OR "; }
                                }
                                $param = array_merge($param, array_values($value));
                            }
    						
    						//handles the release year statments
                            else if(!empty($value) AND ($key == 'releaseYear' && !in_array("",$value))){
                                $sql .= "$key BETWEEN ? AND ?";
                                $param = array_merge($param, $value);
                            }				
    					
                            
                            //Standard SQL = syntax
                            else {
                                $sql .= "$key = ?";
                                $param[] = "$value";                        
                            }
                            //Increase counter
                            $i++;
                        }
                    }
                    else { exit("Error! $key is not in whitelist"); }
                }
            }
    
            //Prepare the query
            $sth = $dbh->prepare($sql);
            
            //Execute the query with the place holders populated by the data from the array
            $sth->execute($param);
    
            // Fetch the results // 
            $rowset = $sth->fetchAll(PDO::FETCH_ASSOC);
    ;
    		
        ?>
    	
    	
    
    			
    	<head>
    		<title>NES Collection</title>
    		<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
    		<script src="//code.jquery.com/jquery-1.10.2.js"></script>
    		<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
    		<link rel="stylesheet" href="/resources/demos/style.css">
    		<link id="pagestyle" href="style.css" rel="stylesheet" type="text/css">
    		
    	<script type="text/javascript">
           $(function() {
                   $("#startdate").datepicker({ dateFormat: "yy" }).val()
                   $("#enddate").datepicker({ dateFormat: "yy" }).val()
           });
    	</script>
    
    	<body>
    
    		<div id="header">
    			<h1>Retro Game Collection</h1><br><br><br>
    			<a href = "database.php">Home</a>
    		</div>
    		
    		<div id="leftNav">
    		    <form action = "database.php" method = "post">
    				Search By: <br><br>
    				
    				<b> Title: </b> <br> <input type="Text" name="game[title]"> <br>
    				______________________<br>
    				
    				<script>
    					$(document).ready(function() {
    						$('#selecctall-1').click(function(event) {  //on click 
    							if(this.checked) { // check select status
    								$('.checkbox1').each(function() { //loop through each checkbox
    									this.checked = true;  //select all checkboxes with class "checkbox1"               
    								});
    							}else{
    								$('.checkbox1').each(function() { //loop through each checkbox
    									this.checked = false; //deselect all checkboxes with class "checkbox1"                       
    								});         
    							}
    						});
    					});
    				</script>
    				
    				<script>
    					$(document).ready(function() {
    						$('#selecctall-2').click(function(event) {  //on click 
    							if(this.checked) { // check select status
    								$('.checkbox2').each(function() { //loop through each checkbox
    									this.checked = true;  //select all checkboxes with class "checkbox1"               
    								});
    							}else{
    								$('.checkbox2').each(function() { //loop through each checkbox
    									this.checked = false; //deselect all checkboxes with class "checkbox1"                       
    								});         
    							}
    						});
    					});
    				</script>
    
    				<script>
    					$(document).ready(function() {
    						$('#selecctall-3').click(function(event) {  //on click 
    							if(this.checked) { // check select status
    								$('.checkbox3').each(function() { //loop through each checkbox
    									this.checked = true;  //select all checkboxes with class "checkbox1"               
    								});
    							}else{
    								$('.checkbox3').each(function() { //loop through each checkbox
    									this.checked = false; //deselect all checkboxes with class "checkbox1"                       
    								});         
    							}
    						});
    					});
    				</script>
    
    				<script>
    					$(document).ready(function() {
    						$('#selecctall-4').click(function(event) {  //on click 
    							if(this.checked) { // check select status
    								$('.checkbox4').each(function() { //loop through each checkbox
    									this.checked = true;  //select all checkboxes with class "checkbox1"               
    								});
    							}else{
    								$('.checkbox4').each(function() { //loop through each checkbox
    									this.checked = false; //deselect all checkboxes with class "checkbox1"                       
    								});         
    							}
    						});
    					});
    				</script>				
    				
    				<b>Console</b><br>
    					<input type="checkbox" id="selecctall-1"/> All <br>
    					<input class="checkbox1" type = "checkbox" name = "game[console][0]" value = "Nintendo"> Nintendo<br>
    					<input class="checkbox1" type = "checkbox" name = "game[console][1]" value = "Super Nintendo"> Super Nintendo<br>
    					<input class="checkbox1" type = "checkbox" name = "game[console][2]" value = "Nintendo 64"> Nintendo 64<br>
    					<input class="checkbox1" type = "checkbox" name = "game[console][3]" value = "Game Cube"> Game Cube<br>
    					<input class="checkbox1" type = "checkbox" name = "game[console][4]" value = "Playstation"> Playstation<br>
    					<input class="checkbox1" type = "checkbox" name = "game[console][5]" value = "Playstation2"> Playstation2<br>
    					<input class="checkbox1" type = "checkbox" name = "game[console][6]" value = "Xbox"> Xbox<br>
    				______________________<br>				
    				<b>Genre:</b> <br>
    					<input type="checkbox" id="selecctall-2"/> All <br>
    					<input  class="checkbox2" type = "checkbox" name = "game[genre][0]" value = "Action"> Action<br>
    					<input  class="checkbox2" type = "checkbox" name = "game[genre][1]" value = "Beatup"> Beat'em Up<br>
    					<input  class="checkbox2" type = "checkbox" name = "game[genre][2]" value = "Platform"> Platformer<br>
    					<input  class="checkbox2" type = "checkbox" name = "game[genre][3]" value = "Shooter"> Shooter<br>
    					<input  class="checkbox2" type = "checkbox" name = "game[genre][4]" value = "Adventure"> Adventure<br>
    					<input  class="checkbox2" type = "checkbox" name = "game[genre][5]" value = "rpg"> Role-Playing<br>
    					<input  class="checkbox2" type = "checkbox" name = "game[genre][6]" value = "Sim"> Simulation<br>
    					<input  class="checkbox2" type = "checkbox" name = "game[genre][7]" value = "Strategy"> Strategy<br>
    					<input  class="checkbox2" type = "checkbox" name = "game[genre][8]" value = "Sports"> Sports	<br> 
    				______________________<br>	
    				<b>Publisher: </b> <br>
    					<input type="checkbox" id="selecctall-3"/> All <br>				
    					<input  class="checkbox3" type = "checkbox" name = "game[publisher][0]" value = "Aklaim"> Aklaim<br>
    					<input  class="checkbox3" type = "checkbox" name = "game[publisher][1]" value = "Capcom"> Capcom<br>
    					<input  class="checkbox3" type = "checkbox" name = "game[publisher][2]" value = "EA"> EA<br>
    					<input  class="checkbox3" type = "checkbox" name = "game[publisher][3]" value = "KOEI"> KOEI<br>
    					<input  class="checkbox3" type = "checkbox" name = "game[publisher][4]" value = "Konami"> Konami<br>
    					<input  class="checkbox3" type = "checkbox" name = "game[publisher][5]" value = "Nintendo"> Nintendo<br>
    					<input  class="checkbox3" type = "checkbox" name = "game[publisher][6]" value = "Rare"> Rare<br>
    					<input  class="checkbox3" type = "checkbox" name = "game[publisher][7]" value = "SNK"> SNK<br>
    					<input  class="checkbox3" type = "checkbox" name = "game[publisher][8]" value = "SunSoft"> SunSoft<br>
    					<input  class="checkbox3" type = "checkbox" name = "game[publisher][9]" value = "Square Enix"> Square Enix<br>
    					<input  class="checkbox3" type = "checkbox" name = "game[publisher][10]" value = "Tecmo"> Tecmo<br>
    					<input  class="checkbox3" type = "checkbox" name = "game[publisher][11]" value = "TradeWest"> TradeWest<br>		
    					<input  class="checkbox3" type = "checkbox" name = "game[publisher][12]" value = "Broderbund"> Broderbund<br>	
    				______________________<br>
    				<b>Release Year: </b>
    					<br>Between</br>
    					<input type="text" id="startdate" name="game[releaseYear][0]" size="20"/> 
    					and<br>
    					<input type="text" id="enddate" name="game[releaseYear][1]" size="20"/> <br>
    				______________________<br>
    				<b>Rarity: </b><br>
    					<input type="checkbox" id="selecctall-4"/> All <br>	
    					<input  class="checkbox4" type = "checkbox" name = "game[rarity][0]" value = "Common"> Common<br>
    					<input  class="checkbox4" type = "checkbox" name = "game[rarity][1]" value = "Uncommon"> Uncommon<br>
    					<input  class="checkbox4" type = "checkbox" name = "game[rarity][2]" value = "Rare"> Rare<br>
    					<input  class="checkbox4" type = "checkbox" name = "game[rarity][3]" value = "veryRare"> Very Rare<br>
    					<input  class="checkbox4" type = "checkbox" name = "game[rarity][4]" value = "SuperRare"> Super Rare<br>
    					<input  class="checkbox4" type = "checkbox" name = "game[rarity][5]" value = "Ultrarare"> Ultra Rare<br>
    				______________________<br><br><br>				
    					<input type = "submit" value = "Submit" name = "searchSubmit" style="width: 100px; height: 20px;" />	
    			</form>
    		</div>
    		
    		<div id="body">
    			<h1>NES Titles</h1>
    			<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>
    					<th>Details</th>
    					<th>img Path</th>
    				</tr>
    				<tr>
    				
    				<?php foreach($rowset as $row): ?>
    					<tr>
    						<td>
    							<a href="gameDetails.php?rowid=<?php echo $row['rowid']; ?>">
    								<?php echo $row['title']; ?>
    							</a>
    						</td>
    						<td><?php echo $row['console']; ?></td>
    						<td><?php echo $row['genre']; ?></td>
    						<td><?php echo $row['publisher']; ?></td>
    						<td><?php echo $row['releaseYear']; ?></td>
    						<td><?php echo $row['rarity']; ?></td>
    						<td><?php echo $row['details']; ?></td>
    						<td><?php echo $row['image']; ?></td>
    					</tr>
    				<?php endforeach; ?>
    			</table>
    		</div>
    	</body>
    </html>

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

    Was on vacation and now burried in work, because everyone wants their shit done before xmas -_-. All I can offer right now is the full script I had working, should only need to change the DB name/path:

    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');
            
            // Set PDO error handling to throw exceptions
            $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            
            // Define your SQL statement, myTable = table name in your DB 
            $sql = 'SELECT rowid, title, console, genre, publisher, releaseyear, rarity, details, image FROM Games';
            
            // If there is no POST data, create empty $param array
            if (empty($_POST)) { $param = array(); }
            // Append POST data dynamically to the query
            else {
                
                //Reset counter
                $i = 0;
                
                //Column whitelist
                $columns = array('title', 'console', 'genre', 'publisher', 'dateRange', 'releaseYear', 'rarity',);
                $param = array();
    
                //Loop over the $_POST["game"] array
                foreach($_POST["game"] as $key => $value) {
                
                    //Check if key value is a proper column name
                    if(in_array($key, $columns)) {
                    
                        //Only add condition if it's not empty
                        if(!empty($value) AND ($key == 'releaseYear' && !in_array("",$value))){
                        
                            //If at first loop, use WHERE, otherwise AND
                            if($i == 0) { $sql .= " WHERE "; }
                            else { $sql .= " AND "; }
                            
                            //SQL LIKE syntax for title
                            if($key == 'title'){
                                $sql .= "$key LIKE ?";
                                $param[] = "%{$value}%";
                            }
                            
                            //Console is a multidimensional array due to multiple checkboxes
                            else if(in_array($key, array('console','genre','publisher','rarity'))) {
                                foreach($value as $placeholderName) {
                                    $sql .= "$key = ?";
                                    if($placeholderName != end($value)) { $sql .= " OR "; }
                                }
                                $param = array_merge($param, array_values($value));
                            }
                            
                            //handles the release year statments
                            else if ($key == 'releaseYear'){
                                $sql .= "$key BETWEEN ? AND ?";
                                $param = array_merge($param, $value);
                            }                    
                                              
                            //Standard SQL = syntax
                            else {
                                $sql .= "$key = ?";
                                $param[] = "$value";                        
                            }
                            //Increase counter
                            $i++;
                        }
                    }
                    else { exit("Error! $key is not in whitelist"); }
                }
            }
    
            //Prepare the query
            $sth = $dbh->prepare($sql);
            
            //Execute the query with the place holders populated by the data from the array
            $sth->execute($param);
    
            // Fetch the results // 
            $rowset = $sth->fetchAll(PDO::FETCH_ASSOC);
        ?>
        
    
                
        <head>
            <title>NES Collection</title>
            <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
            <script src="//code.jquery.com/jquery-1.10.2.js"></script>
            <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
            <link rel="stylesheet" href="/resources/demos/style.css">
            <link id="pagestyle" href="style.css" rel="stylesheet" type="text/css">
            
        <script type="text/javascript">
           $(function() {
                   $("#startdate").datepicker({ dateFormat: "yy" }).val()
                   $("#enddate").datepicker({ dateFormat: "yy" }).val()
           });
        </script>
    
        <body>
    
            <div id="header">
                <h1>Retro Game Collection</h1><br><br><br>
                <a href = "database.php">Home</a>
            </div>
            
            <div id="leftNav">
                <form action = "database.php" method = "post">
                    Search By: <br><br>
                    
                    <b> Title: </b> <br> <input type="Text" name="game[title]"> <br>
                    ______________________<br>
                    
                    <script>
                        $(document).ready(function() {
                            $('#selecctall-1').click(function(event) {  //on click 
                                if(this.checked) { // check select status
                                    $('.checkbox1').each(function() { //loop through each checkbox
                                        this.checked = true;  //select all checkboxes with class "checkbox1"               
                                    });
                                }else{
                                    $('.checkbox1').each(function() { //loop through each checkbox
                                        this.checked = false; //deselect all checkboxes with class "checkbox1"                       
                                    });         
                                }
                            });
                        });
                    </script>
                    
                    <script>
                        $(document).ready(function() {
                            $('#selecctall-2').click(function(event) {  //on click 
                                if(this.checked) { // check select status
                                    $('.checkbox2').each(function() { //loop through each checkbox
                                        this.checked = true;  //select all checkboxes with class "checkbox1"               
                                    });
                                }else{
                                    $('.checkbox2').each(function() { //loop through each checkbox
                                        this.checked = false; //deselect all checkboxes with class "checkbox1"                       
                                    });         
                                }
                            });
                        });
                    </script>
    
                    <script>
                        $(document).ready(function() {
                            $('#selecctall-3').click(function(event) {  //on click 
                                if(this.checked) { // check select status
                                    $('.checkbox3').each(function() { //loop through each checkbox
                                        this.checked = true;  //select all checkboxes with class "checkbox1"               
                                    });
                                }else{
                                    $('.checkbox3').each(function() { //loop through each checkbox
                                        this.checked = false; //deselect all checkboxes with class "checkbox1"                       
                                    });         
                                }
                            });
                        });
                    </script>
    
                    <script>
                        $(document).ready(function() {
                            $('#selecctall-4').click(function(event) {  //on click 
                                if(this.checked) { // check select status
                                    $('.checkbox4').each(function() { //loop through each checkbox
                                        this.checked = true;  //select all checkboxes with class "checkbox1"               
                                    });
                                }else{
                                    $('.checkbox4').each(function() { //loop through each checkbox
                                        this.checked = false; //deselect all checkboxes with class "checkbox1"                       
                                    });         
                                }
                            });
                        });
                    </script>                
                    
                    <b>Console</b><br>
                        <input type="checkbox" id="selecctall-1"/> All <br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][0]" value = "Nintendo"> Nintendo<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][1]" value = "Super Nintendo"> Super Nintendo<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][2]" value = "Nintendo 64"> Nintendo 64<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][3]" value = "Game Cube"> Game Cube<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][4]" value = "Playstation"> Playstation<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][5]" value = "Playstation2"> Playstation2<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][6]" value = "Xbox"> Xbox<br>
                    ______________________<br>                
                    <b>Genre:</b> <br>
                        <input type="checkbox" id="selecctall-2"/> All <br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][0]" value = "Action"> Action<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][1]" value = "Beatup"> Beat'em Up<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][2]" value = "Platform"> Platformer<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][3]" value = "Shooter"> Shooter<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][4]" value = "Adventure"> Adventure<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][5]" value = "rpg"> Role-Playing<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][6]" value = "Sim"> Simulation<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][7]" value = "Strategy"> Strategy<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][8]" value = "Sports"> Sports    <br> 
                    ______________________<br>    
                    <b>Publisher: </b> <br>
                        <input type="checkbox" id="selecctall-3"/> All <br>                
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][0]" value = "Aklaim"> Aklaim<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][1]" value = "Capcom"> Capcom<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][2]" value = "EA"> EA<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][3]" value = "KOEI"> KOEI<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][4]" value = "Konami"> Konami<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][5]" value = "Nintendo"> Nintendo<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][6]" value = "Rare"> Rare<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][7]" value = "SNK"> SNK<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][8]" value = "SunSoft"> SunSoft<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][9]" value = "Square Enix"> Square Enix<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][10]" value = "Tecmo"> Tecmo<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][11]" value = "TradeWest"> TradeWest<br>        
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][12]" value = "Broderbund"> Broderbund<br>    
                    ______________________<br>
                    <b>Release Year: </b>
                        <br>Between</br>
                        <input type="text" id="startdate" name="game[releaseYear][0]" size="20"/> 
                        and<br>
                        <input type="text" id="enddate" name="game[releaseYear][1]" size="20"/> <br>
                    ______________________<br>
                    <b>Rarity: </b><br>
                        <input type="checkbox" id="selecctall-4"/> All <br>    
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][0]" value = "Common"> Common<br>
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][1]" value = "Uncommon"> Uncommon<br>
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][2]" value = "Rare"> Rare<br>
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][3]" value = "veryRare"> Very Rare<br>
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][4]" value = "SuperRare"> Super Rare<br>
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][5]" value = "Ultrarare"> Ultra Rare<br>
                    ______________________<br><br><br>                
                        <input type = "submit" value = "Submit" name = "searchSubmit" style="width: 100px; height: 20px;" />    
                </form>
            </div>
            
            <div id="body">
                <h1>NES Titles</h1>
                <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>
                        <th>Details</th>
                        <th>img Path</th>
                    </tr>
                    <tr>
                    
                    <?php foreach($rowset as $row): ?>
                        <tr>
                            <td>
                                <a href="gameDetails.php?rowid=<?php echo $row['rowid']; ?>">
                                    <?php echo $row['title']; ?>
                                </a>
                            </td>
                            <td><?php echo $row['console']; ?></td>
                            <td><?php echo $row['genre']; ?></td>
                            <td><?php echo $row['publisher']; ?></td>
                            <td><?php echo $row['releaseYear']; ?></td>
                            <td><?php echo $row['rarity']; ?></td>
                            <td><?php echo $row['details']; ?></td>
                            <td><?php echo $row['image']; ?></td>
                        </tr>
                    <?php endforeach; ?>
                </table>
            </div>
    
        </body>
        
    </html>

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

    Quote Originally Posted by Aevis View Post
    Was on vacation and now burried in work, because everyone wants their shit done before xmas -_-. All I can offer right now is the full script I had working, should only need to change the DB name/path:

    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');
            
            // Set PDO error handling to throw exceptions
            $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            
            // Define your SQL statement, myTable = table name in your DB 
            $sql = 'SELECT rowid, title, console, genre, publisher, releaseyear, rarity, details, image FROM Games';
            
            // If there is no POST data, create empty $param array
            if (empty($_POST)) { $param = array(); }
            // Append POST data dynamically to the query
            else {
                
                //Reset counter
                $i = 0;
                
                //Column whitelist
                $columns = array('title', 'console', 'genre', 'publisher', 'dateRange', 'releaseYear', 'rarity',);
                $param = array();
    
                //Loop over the $_POST["game"] array
                foreach($_POST["game"] as $key => $value) {
                
                    //Check if key value is a proper column name
                    if(in_array($key, $columns)) {
                    
                        //Only add condition if it's not empty
                        if(!empty($value) AND ($key == 'releaseYear' && !in_array("",$value))){
                        
                            //If at first loop, use WHERE, otherwise AND
                            if($i == 0) { $sql .= " WHERE "; }
                            else { $sql .= " AND "; }
                            
                            //SQL LIKE syntax for title
                            if($key == 'title'){
                                $sql .= "$key LIKE ?";
                                $param[] = "%{$value}%";
                            }
                            
                            //Console is a multidimensional array due to multiple checkboxes
                            else if(in_array($key, array('console','genre','publisher','rarity'))) {
                                foreach($value as $placeholderName) {
                                    $sql .= "$key = ?";
                                    if($placeholderName != end($value)) { $sql .= " OR "; }
                                }
                                $param = array_merge($param, array_values($value));
                            }
                            
                            //handles the release year statments
                            else if ($key == 'releaseYear'){
                                $sql .= "$key BETWEEN ? AND ?";
                                $param = array_merge($param, $value);
                            }                    
                                              
                            //Standard SQL = syntax
                            else {
                                $sql .= "$key = ?";
                                $param[] = "$value";                        
                            }
                            //Increase counter
                            $i++;
                        }
                    }
                    else { exit("Error! $key is not in whitelist"); }
                }
            }
    
            //Prepare the query
            $sth = $dbh->prepare($sql);
            
            //Execute the query with the place holders populated by the data from the array
            $sth->execute($param);
    
            // Fetch the results // 
            $rowset = $sth->fetchAll(PDO::FETCH_ASSOC);
        ?>
        
    
                
        <head>
            <title>NES Collection</title>
            <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
            <script src="//code.jquery.com/jquery-1.10.2.js"></script>
            <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
            <link rel="stylesheet" href="/resources/demos/style.css">
            <link id="pagestyle" href="style.css" rel="stylesheet" type="text/css">
            
        <script type="text/javascript">
           $(function() {
                   $("#startdate").datepicker({ dateFormat: "yy" }).val()
                   $("#enddate").datepicker({ dateFormat: "yy" }).val()
           });
        </script>
    
        <body>
    
            <div id="header">
                <h1>Retro Game Collection</h1><br><br><br>
                <a href = "database.php">Home</a>
            </div>
            
            <div id="leftNav">
                <form action = "database.php" method = "post">
                    Search By: <br><br>
                    
                    <b> Title: </b> <br> <input type="Text" name="game[title]"> <br>
                    ______________________<br>
                    
                    <script>
                        $(document).ready(function() {
                            $('#selecctall-1').click(function(event) {  //on click 
                                if(this.checked) { // check select status
                                    $('.checkbox1').each(function() { //loop through each checkbox
                                        this.checked = true;  //select all checkboxes with class "checkbox1"               
                                    });
                                }else{
                                    $('.checkbox1').each(function() { //loop through each checkbox
                                        this.checked = false; //deselect all checkboxes with class "checkbox1"                       
                                    });         
                                }
                            });
                        });
                    </script>
                    
                    <script>
                        $(document).ready(function() {
                            $('#selecctall-2').click(function(event) {  //on click 
                                if(this.checked) { // check select status
                                    $('.checkbox2').each(function() { //loop through each checkbox
                                        this.checked = true;  //select all checkboxes with class "checkbox1"               
                                    });
                                }else{
                                    $('.checkbox2').each(function() { //loop through each checkbox
                                        this.checked = false; //deselect all checkboxes with class "checkbox1"                       
                                    });         
                                }
                            });
                        });
                    </script>
    
                    <script>
                        $(document).ready(function() {
                            $('#selecctall-3').click(function(event) {  //on click 
                                if(this.checked) { // check select status
                                    $('.checkbox3').each(function() { //loop through each checkbox
                                        this.checked = true;  //select all checkboxes with class "checkbox1"               
                                    });
                                }else{
                                    $('.checkbox3').each(function() { //loop through each checkbox
                                        this.checked = false; //deselect all checkboxes with class "checkbox1"                       
                                    });         
                                }
                            });
                        });
                    </script>
    
                    <script>
                        $(document).ready(function() {
                            $('#selecctall-4').click(function(event) {  //on click 
                                if(this.checked) { // check select status
                                    $('.checkbox4').each(function() { //loop through each checkbox
                                        this.checked = true;  //select all checkboxes with class "checkbox1"               
                                    });
                                }else{
                                    $('.checkbox4').each(function() { //loop through each checkbox
                                        this.checked = false; //deselect all checkboxes with class "checkbox1"                       
                                    });         
                                }
                            });
                        });
                    </script>                
                    
                    <b>Console</b><br>
                        <input type="checkbox" id="selecctall-1"/> All <br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][0]" value = "Nintendo"> Nintendo<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][1]" value = "Super Nintendo"> Super Nintendo<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][2]" value = "Nintendo 64"> Nintendo 64<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][3]" value = "Game Cube"> Game Cube<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][4]" value = "Playstation"> Playstation<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][5]" value = "Playstation2"> Playstation2<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][6]" value = "Xbox"> Xbox<br>
                    ______________________<br>                
                    <b>Genre:</b> <br>
                        <input type="checkbox" id="selecctall-2"/> All <br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][0]" value = "Action"> Action<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][1]" value = "Beatup"> Beat'em Up<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][2]" value = "Platform"> Platformer<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][3]" value = "Shooter"> Shooter<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][4]" value = "Adventure"> Adventure<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][5]" value = "rpg"> Role-Playing<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][6]" value = "Sim"> Simulation<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][7]" value = "Strategy"> Strategy<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][8]" value = "Sports"> Sports    <br> 
                    ______________________<br>    
                    <b>Publisher: </b> <br>
                        <input type="checkbox" id="selecctall-3"/> All <br>                
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][0]" value = "Aklaim"> Aklaim<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][1]" value = "Capcom"> Capcom<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][2]" value = "EA"> EA<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][3]" value = "KOEI"> KOEI<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][4]" value = "Konami"> Konami<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][5]" value = "Nintendo"> Nintendo<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][6]" value = "Rare"> Rare<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][7]" value = "SNK"> SNK<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][8]" value = "SunSoft"> SunSoft<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][9]" value = "Square Enix"> Square Enix<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][10]" value = "Tecmo"> Tecmo<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][11]" value = "TradeWest"> TradeWest<br>        
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][12]" value = "Broderbund"> Broderbund<br>    
                    ______________________<br>
                    <b>Release Year: </b>
                        <br>Between</br>
                        <input type="text" id="startdate" name="game[releaseYear][0]" size="20"/> 
                        and<br>
                        <input type="text" id="enddate" name="game[releaseYear][1]" size="20"/> <br>
                    ______________________<br>
                    <b>Rarity: </b><br>
                        <input type="checkbox" id="selecctall-4"/> All <br>    
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][0]" value = "Common"> Common<br>
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][1]" value = "Uncommon"> Uncommon<br>
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][2]" value = "Rare"> Rare<br>
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][3]" value = "veryRare"> Very Rare<br>
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][4]" value = "SuperRare"> Super Rare<br>
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][5]" value = "Ultrarare"> Ultra Rare<br>
                    ______________________<br><br><br>                
                        <input type = "submit" value = "Submit" name = "searchSubmit" style="width: 100px; height: 20px;" />    
                </form>
            </div>
            
            <div id="body">
                <h1>NES Titles</h1>
                <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>
                        <th>Details</th>
                        <th>img Path</th>
                    </tr>
                    <tr>
                    
                    <?php foreach($rowset as $row): ?>
                        <tr>
                            <td>
                                <a href="gameDetails.php?rowid=<?php echo $row['rowid']; ?>">
                                    <?php echo $row['title']; ?>
                                </a>
                            </td>
                            <td><?php echo $row['console']; ?></td>
                            <td><?php echo $row['genre']; ?></td>
                            <td><?php echo $row['publisher']; ?></td>
                            <td><?php echo $row['releaseYear']; ?></td>
                            <td><?php echo $row['rarity']; ?></td>
                            <td><?php echo $row['details']; ?></td>
                            <td><?php echo $row['image']; ?></td>
                        </tr>
                    <?php endforeach; ?>
                </table>
            </div>
    
        </body>
        
    </html>
    I understand and appricate it. Once i get this stupid search working i'll be done with this damn thing. Tried you code and it fixed the errors, although when I search it just reloads the page. When I do a var_dump($param) it is showing the array is empty. Thinking I should be able to fix that one on my own though. and again I appropriate the help!

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

    Ok So got everything working. The problem with the code you provided was the following line:

    Code:
    if(!empty($value) AND ($key == 'releaseYear' && !in_array("",$value))){
    Because of the and it was always skipping over the entire section and not going though any of the if statements to append the sql statement. I deleted the And statement and it worked however it keep fucking up because of the start and end date being empty. I cant figure out how to fix it and honestly im sick of beating my head over it so I just added a work around and made it so when the page is loaded the field is auto populated with values that encase every game that is in the table. Still curious of how to do it properly... but Finals are next week and i have to get to preparing for them.

    Full code:
    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');
            
            // Set PDO error handling to throw exceptions
            $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            
            // Define your SQL statement, myTable = table name in your DB 
            $sql = 'SELECT rowid, title, console, genre, publisher, releaseyear, rarity, details, image FROM Games';
            
            // If there is no POST data, create empty $param array
            if (empty($_POST)) { $param = array(); }
            // Append POST data dynamically to the query
            else {
                
                //Reset counter
                $i = 0;
                
                //Column whitelist
                $columns = array('title', 'console', 'genre', 'publisher', 'dateRange', 'releaseYear', 'rarity',);
                $param = array();
    
                //Loop over the $_POST["game"] array
                foreach($_POST["game"] as $key => $value) {
                
                    //Check if key value is a proper column name
                    if(in_array($key, $columns)) {
                    
                        //Only add condition if it's not empty
                        if(!empty($value)){
                        
                            //If at first loop, use WHERE, otherwise AND
                            if($i == 0) { $sql .= " WHERE "; }
                            else { $sql .= " AND "; }
                            
                            //SQL LIKE syntax for title
                            if($key == 'title'){
                                $sql .= "$key LIKE ?";
                                $param[] = "%{$value}%";
                            }
                            
                            //Console is a multidimensional array due to multiple checkboxes
                            else if(in_array($key, array('console','genre','publisher','rarity'))) {
                                foreach($value as $placeholderName) {
                                    $sql .= "$key = ?";
                                    if($placeholderName != end($value)) { $sql .= " OR "; }
                                }
                                $param = array_merge($param, array_values($value));
                            }
                            
                            //handles the release year statments
                            else if ($key == 'releaseYear'){
                                $sql .= "$key BETWEEN ? AND ?";
                                $param = array_merge($param, $value);
                            }                    
                                              
                            //Standard SQL = syntax
                            else {
                                $sql .= "$key = ?";
                                $param[] = "$value";                        
                            }
                            //Increase counter
                            $i++;
                        }
                    }
                    else { exit("Error! $key is not in whitelist"); }
                }
            }
    
            //Prepare the query
            $sth = $dbh->prepare($sql);
            
            //Execute the query with the place holders populated by the data from the array
            $sth->execute($param);
    
            // Fetch the results // 
            $rowset = $sth->fetchAll(PDO::FETCH_ASSOC);
    		
    		var_dump($param);
    		echo $sql;
        ?>
        
    
                
        <head>
            <title>NES Collection</title>
            <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
            <script src="//code.jquery.com/jquery-1.10.2.js"></script>
            <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
            <link rel="stylesheet" href="/resources/demos/style.css">
            <link id="pagestyle" href="style.css" rel="stylesheet" type="text/css">
            
        <script type="text/javascript">
           $(function() {
                   $("#startdate").datepicker({ dateFormat: "yy" }).val()
                   $("#enddate").datepicker({ dateFormat: "yy" }).val()
           });
        </script>
    
        <body>
    
            <div id="header">
                <h1>Retro Game Collection</h1><br><br><br>
                <a href = "database.php">Home</a>
            </div>
            
            <div id="leftNav">
                <form action = "database.php" method = "post">
                    Search By: <br><br>
                    
                    <b> Title: </b> <br> <input type="Text" name="game[title]"> <br>
                    ______________________<br>
                    
                    <script>
                        $(document).ready(function() {
                            $('#selecctall-1').click(function(event) {  //on click 
                                if(this.checked) { // check select status
                                    $('.checkbox1').each(function() { //loop through each checkbox
                                        this.checked = true;  //select all checkboxes with class "checkbox1"               
                                    });
                                }else{
                                    $('.checkbox1').each(function() { //loop through each checkbox
                                        this.checked = false; //deselect all checkboxes with class "checkbox1"                       
                                    });         
                                }
                            });
                        });
                    </script>
                    
                    <script>
                        $(document).ready(function() {
                            $('#selecctall-2').click(function(event) {  //on click 
                                if(this.checked) { // check select status
                                    $('.checkbox2').each(function() { //loop through each checkbox
                                        this.checked = true;  //select all checkboxes with class "checkbox1"               
                                    });
                                }else{
                                    $('.checkbox2').each(function() { //loop through each checkbox
                                        this.checked = false; //deselect all checkboxes with class "checkbox1"                       
                                    });         
                                }
                            });
                        });
                    </script>
    
                    <script>
                        $(document).ready(function() {
                            $('#selecctall-3').click(function(event) {  //on click 
                                if(this.checked) { // check select status
                                    $('.checkbox3').each(function() { //loop through each checkbox
                                        this.checked = true;  //select all checkboxes with class "checkbox1"               
                                    });
                                }else{
                                    $('.checkbox3').each(function() { //loop through each checkbox
                                        this.checked = false; //deselect all checkboxes with class "checkbox1"                       
                                    });         
                                }
                            });
                        });
                    </script>
    
                    <script>
                        $(document).ready(function() {
                            $('#selecctall-4').click(function(event) {  //on click 
                                if(this.checked) { // check select status
                                    $('.checkbox4').each(function() { //loop through each checkbox
                                        this.checked = true;  //select all checkboxes with class "checkbox1"               
                                    });
                                }else{
                                    $('.checkbox4').each(function() { //loop through each checkbox
                                        this.checked = false; //deselect all checkboxes with class "checkbox1"                       
                                    });         
                                }
                            });
                        });
                    </script>                
                    
                    <b>Console</b><br>
                        <input type="checkbox" id="selecctall-1"/> All <br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][0]" value = "Nintendo"> Nintendo<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][1]" value = "Super Nintendo"> Super Nintendo<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][2]" value = "Nintendo 64"> Nintendo 64<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][3]" value = "Game Cube"> Game Cube<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][4]" value = "Playstation"> Playstation<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][5]" value = "Playstation2"> Playstation2<br>
                        <input class="checkbox1" type = "checkbox" name = "game[console][6]" value = "Xbox"> Xbox<br>
                    ______________________<br>                
                    <b>Genre:</b> <br>
                        <input type="checkbox" id="selecctall-2"/> All <br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][0]" value = "Action"> Action<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][1]" value = "Beatup"> Beat'em Up<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][2]" value = "Platform"> Platformer<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][3]" value = "Shooter"> Shooter<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][4]" value = "Adventure"> Adventure<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][5]" value = "rpg"> Role-Playing<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][6]" value = "Sim"> Simulation<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][7]" value = "Strategy"> Strategy<br>
                        <input  class="checkbox2" type = "checkbox" name = "game[genre][8]" value = "Sports"> Sports    <br> 
                    ______________________<br>    
                    <b>Publisher: </b> <br>
                        <input type="checkbox" id="selecctall-3"/> All <br>                
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][0]" value = "Aklaim"> Aklaim<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][1]" value = "Capcom"> Capcom<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][2]" value = "EA"> EA<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][3]" value = "KOEI"> KOEI<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][4]" value = "Konami"> Konami<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][5]" value = "Nintendo"> Nintendo<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][6]" value = "Rare"> Rare<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][7]" value = "SNK"> SNK<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][8]" value = "SunSoft"> SunSoft<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][9]" value = "Square Enix"> Square Enix<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][10]" value = "Tecmo"> Tecmo<br>
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][11]" value = "TradeWest"> TradeWest<br>        
                        <input  class="checkbox3" type = "checkbox" name = "game[publisher][12]" value = "Broderbund"> Broderbund<br>    
                    ______________________<br>
                    <b>Release Year: </b>
                        <br>Between</br>
                        <input type="text" id="startdate" name="game[releaseYear][0]" size="20" value="1900"/> 
                        and<br>
                        <input type="text" id="enddate" name="game[releaseYear][1]" size="20" value="2015"/> <br>
                    ______________________<br>
                    <b>Rarity: </b><br>
                        <input type="checkbox" id="selecctall-4"/> All <br>    
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][0]" value = "Common"> Common<br>
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][1]" value = "Uncommon"> Uncommon<br>
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][2]" value = "Rare"> Rare<br>
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][3]" value = "veryRare"> Very Rare<br>
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][4]" value = "SuperRare"> Super Rare<br>
                        <input  class="checkbox4" type = "checkbox" name = "game[rarity][5]" value = "Ultrarare"> Ultra Rare<br>
                    ______________________<br><br><br>                
                        <input type = "submit" value = "Submit" name = "searchSubmit" style="width: 100px; height: 20px;" />    
                </form>
            </div>
            
            <div id="body">
                <h1>NES Titles</h1>
                <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>
                        <th>Details</th>
                        <th>img Path</th>
                    </tr>
                    <tr>
                    
                    <?php foreach($rowset as $row): ?>
                        <tr>
                            <td>
                                <a href="gameDetails.php?rowid=<?php echo $row['rowid']; ?>">
                                    <?php echo $row['title']; ?>
                                </a>
                            </td>
                            <td><?php echo $row['console']; ?></td>
                            <td><?php echo $row['genre']; ?></td>
                            <td><?php echo $row['publisher']; ?></td>
                            <td><?php echo $row['releaseYear']; ?></td>
                            <td><?php echo $row['rarity']; ?></td>
                            <td><?php echo $row['details']; ?></td>
                            <td><?php echo $row['image']; ?></td>
                        </tr>
                    <?php endforeach; ?>
                </table>
            </div>
    
        </body>
        
    </html>

+ Reply to Thread
Page 9 of 9 FirstFirst ... 7 8 9

Similar Threads

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