Jump to content

Revolutsio

Members
  • Posts

    35
  • Joined

  • Last visited

About Revolutsio

  • Birthday 10/15/1969

Profile Information

  • Gender
    Male
  • Location
    Manchester, UK

Revolutsio's Achievements

Member

Member (2/5)

1

Reputation

  1. Thank for you reply It was just query if it was possible. I was going to use it only for me
  2. Hi I was just wondering would it be possible to create a database from a input statement and array, if so would it be also possible to create a table with fields the same way?
  3. <?php include('dbh.php'); ?> <?php $sql= "SELECT * FROM games WHERE completed=1 ORDER BY Game_Name;"; $result = mysqli_query($conn, $sql) or die("Bad Query: $sql"); while ($row = mysqli_fetch_assoc($result)):?> <?php $output = ''; for ($i=1; $i<=28; $i++) { $output .= $row['Game_Name']; $i; } ?> <?php endwhile; ?> <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="https://unpkg.com/purecss@1.0.1/build/base-min.css"> <link rel="stylesheet" type="text/css" href="table.css"> <title>My Collection</title> </head> <body> <h1 align:center>#</h1> <div class="grid"> <?= $output ?> </div> </body> </html> As you can see I have added the database entries, but only get the last entry in the database printed horizontal with no spaces, is this correct for a start?
  4. Yes that is what I want This is the way i would like to do it how would i put in the select query into the code?
  5. <table> <thead> <tr> <th>Game</th> <th>Date Finished</th> </tr> </thead> <?php $sql= "SELECT * FROM games WHERE completed=1 ORDER BY Game_Name;"; $result = mysqli_query($conn, $sql) or die("Bad Query: $sql"); $num_rows = mysqli_num_rows($result);?> <?php $counter = 1; while ($row = mysqli_fetch_assoc($result)): ?> <tr> <!-- <td style="text-align:center"><?php echo $row['ID']; ?></td> --> <td style="text-align:center"><?php echo $row['Game_Name']; ?></td> <!-- <td style="text-align:center"><?php echo date ('d F Y', strtotime($row['Date_Finished'])); ?></td> --> <?php $counter++;?> </tr> <?php endwhile; ?> </body> </table> </html>
  6. At the moment the field are displaying downwards and I want to display horizontal
  7. I am currently displaying in a table and no css also there will be 5 across and 28 in total
  8. I want my mysql database to be displayed across the screen similar to the below Entry 1 Entry 2 Entry 3 Entry 4 Entry 5 eventually with a image above the name, but for now just as above. How would I go about this?
  9. Once again @Barand you come to me rescue thanks again
  10. $num1 = (5); $num2 = (2); $num3 = (1); $num4 = (3); echo "<br />"; if ($num1 = 5 echo $names[4]); i have tried this but get an error unexpedted echo
  11. I have five names in an array and also numbers 5,2,1,3 and what i want to do is php to look at the numbers and print out the name that corresponds to the number. so for my example the name it should echo out is 'Lee' $names = array ("Stan", "John", "Dean", "Sam", "Lee"); here are the five names. The idea is to learn php with making a little fixture list with these five names. The problem i have is to make php read the number and then look up the array for the name that corresponds to the number. I hope this explains what I would like to do?
  12. Sorry Barand the second reply wasn't for you Thank you for your code the second one works for me
  13. The code did work my question was how do I put the results in a table
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.