mirror of
https://github.com/ClaytonWWilson/FightHub.git
synced 2025-12-13 06:18:46 +00:00
index.php now gets 10 rows from video table and prints them sorted by date
This commit is contained in:
parent
5e5043f6b2
commit
815a876d2f
0
images/upload.png
Normal file → Executable file
0
images/upload.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
71
index.php
71
index.php
@ -10,12 +10,75 @@
|
||||
<input type="text" name="query" class="search" placeholder="Search..">
|
||||
<input type="submit" name="submit" class="submit" value="Search">
|
||||
<a href="upload.php"><img src="images/upload.png" class="upload" alt="upload"></a>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
<!-- code for connecting to mysql -->
|
||||
<?php
|
||||
function writeEntryforIndex() {
|
||||
|
||||
$servername = "localhost";
|
||||
$username = "fighthubuser";
|
||||
$password = "cC33dC8W";
|
||||
$database = "fighthubdata";
|
||||
|
||||
// Create MySQL connection
|
||||
$conn = mysqli_connect($servername, $username, $password, "fighthubdata");
|
||||
|
||||
// Check connection - if it fails, output will include the error message
|
||||
if (!$conn) {
|
||||
echo 'death';
|
||||
die('<p>Connection failed: <p>' . mysql_error());
|
||||
}
|
||||
|
||||
echo '<font color="#FF3D5"><p>Connect1ed successfully</p></font>';
|
||||
|
||||
// $sql = 'SELECT video_id, video_url, video_name, username, date_upload, date_video, video_length, description, characters, players, game, stage, approved FROM video';
|
||||
|
||||
//$sql = 'select * from video';
|
||||
// mysqli_select_db('fighthubdata');
|
||||
//echo 'hello';
|
||||
$retval = mysqli_query( $conn, "select * from video order by date_video DESC ");
|
||||
//echo 'test';
|
||||
if(!$retval ) {
|
||||
//echo '<p>death</p>'
|
||||
die('Could not get data: ' . mysqli_error());
|
||||
|
||||
}
|
||||
//echo '<font color="blue">not death</font>';
|
||||
|
||||
$search = $_GET['query'];
|
||||
$i = 0;
|
||||
|
||||
while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC)) {
|
||||
|
||||
if($i > 9){
|
||||
break;
|
||||
}
|
||||
|
||||
echo "<font color='#FF3D53'> VIDEO ID :{$row['video_id']} <br> ".
|
||||
"VIDEO URL : {$row['video_url']} <br> ".
|
||||
"VIDEO NAME : {$row['video_name']} <br> ".
|
||||
"USERNAME : {$row['username']} <br> ".
|
||||
"DATE UPLOAD : {$row['date_upload']} <br> ".
|
||||
"DATE VIDEO : {$row['date_video']} <br> ".
|
||||
"VIDEO LENGTH : {$row['video_length']} <br> ".
|
||||
"DESCRIPTION : {$row['description']} <br> ".
|
||||
"CHARACTERS : {$row['characters']} <br> ".
|
||||
"PLAYERS : {$row['players']} <br> ".
|
||||
"GAME : {$row['game']} <br> ".
|
||||
"STAGE : {$row['stage']} <br> ".
|
||||
"APPROVED : {$row['approved']} <br> ".
|
||||
"--------------------------------<br></font>";
|
||||
|
||||
|
||||
echo "<font color='#FF3D53'>Fetched data successfully\n</font>";
|
||||
mysqli_close($conn);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
writeEntryforIndex();
|
||||
|
||||
?>
|
||||
<!-- This is where php code for loading preview videos below the titlebar will go -->
|
||||
</body>
|
||||
</html>
|
||||
|
||||
0
scripts/main.js
Normal file → Executable file
0
scripts/main.js
Normal file → Executable file
0
upload.php
Normal file → Executable file
0
upload.php
Normal file → Executable file
Loading…
Reference in New Issue
Block a user