pazzy Posted June 18, 2007 Share Posted June 18, 2007 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 More sharing options...
chocopi Posted June 18, 2007 Share Posted June 18, 2007 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 ~ Chocopi Link to comment https://forums.phpfreaks.com/topic/56017-php-mini-project-film-library/#findComment-276649 Share on other sites More sharing options...
pazzy Posted June 18, 2007 Author Share Posted June 18, 2007 Cheers !! works a treat !! I knew i could use POST or GET ... but wasn't clear on the syntax... Link to comment https://forums.phpfreaks.com/topic/56017-php-mini-project-film-library/#findComment-276710 Share on other sites More sharing options...
pazzy Posted June 18, 2007 Author Share Posted June 18, 2007 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 ++; } Link to comment https://forums.phpfreaks.com/topic/56017-php-mini-project-film-library/#findComment-276797 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.