Jump to content

php mini project film library


pazzy

Recommended Posts

I have a small php personal project i am doing, it's a film library,

I have a list of films on a page, which is just a select title FROM films..

 

I want each of these titles to be a link to another page

that shows all details of this film (SELECT * from films where title = xxx)

 

Now  , I can do this with forms using the POST method, but i dont wanna have buttons beside the film title, it's better to just use the links ...

is there a way of using links to pass the argument (in this case film title)..

Link to comment
https://forums.phpfreaks.com/topic/56017-php-mini-project-film-library/
Share on other sites

use $_GET

 

<?php

$title = 1; // select statement

echo "<a href=\"page.php?title=$title\">$title</a>";

?>

 

Then on page.php have:

 

<?php

$title = $_GET['title'];

mysql_query("SELECT fieldname FROM tablename WHERE title='$title'");

?>

 

Or something like that  ;D

 

~ Chocopi

another small Question :

i have :

 

while($row = mysql_fetch_array($result))
  {
  
  echo "<B>Title : </B>".$row["Title"] . "<br>";
  echo  $row['Director']."<br>";
  echo  $row['actor1']." & ".$row['actor2']." & ".$row['actor3']. "<br>";
  echo  $row['year']."<br>";
  echo  $row['medium']."<br>";
  echo  $row['comments']."<br>";
  
  }

 

Now this isn't nice code becuase if i want to expand the DB, add more fields ill have to update this

surely i can loop through the array but the below code only prints the 1st field value($i = 0)

 

$i = 0;
while($row = mysql_fetch_array($result))
{
echo $row[$i]. "<br>";
$i ++;

}

 

 

 

Archived

This topic is now archived and is closed to further replies.

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