Jump to content

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 ++;

}

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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