Need help with php review page

i’m having trouble with creating a php review page. I need a page that will display the movie title selected for review, the review, the users email address and the date the review was posted.

This is the test database i am using
CREATE TABLE IF NOT EXISTS accounts (
userID int(8) unsigned NOT NULL AUTO_INCREMENT,
email varchar(40) NOT NULL,
password char(40) NOT NULL,
country varchar(50) NOT NULL,
PRIMARY KEY (userID)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ;

INSERT INTO accounts (userID, email, password, country) VALUES
(1, ‘[email protected]’, ‘5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8’, ‘Australia’),
(2, ‘[email protected]’, ‘fec4145c154a2507df27f513d50594afe8a9d637’, ‘England’),
(3, ‘[email protected]’, ‘a058152295577b4564955f4e4e6672ae721be329’, ‘United States’),
(4, ‘[email protected]’, ‘738ccb64179f8c85f728c0ff00bff7fb58cb577a’, ‘England’),
(17, ‘[email protected]’, ‘4ff1a33e188b7b86123d6e3be2722a23514a83b4’, ‘Marshall Islands’),
(18, ‘[email protected]’, ‘9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684’, ‘Falkland Islands’);

CREATE TABLE IF NOT EXISTS movies (
movieID int(8) unsigned NOT NULL,
movieName text NOT NULL,
movieDescription text NOT NULL,
movieCast text,
movieImage text,
PRIMARY KEY (movieID),
KEY movieID (movieID)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

INSERT INTO movies (movieID, movieName, movieDescription, movieCast, movieImage) VALUES
(1, ‘Stargate’, ‘When a mysterious woman makes Professor Daniel Jackson an offer he can’’’‘t refuse, he ends up in a secret Air Force military base. His mission: to decode an ancient Egyptian artifact known as the Stargate. The mission leader, Colonel Jack O’‘eil, a tough military man with nerves of steel, commandeers their trip through the Stargate to an ancient civilization on the other side of the universe. Once there, they must battle the astoundingly powerful Sun God, Ra, before they can find their way back home.’, ‘Kurt Russell\r\nJames Spader\r\nJaye Davidson\r\nViveca Lindfors\r\nAlexis Cruz\r\nMili Avital\r\nLeon Rippy\r\nJohn Diehl\r\nCarlos Lauchu\r\nDjimon Hounsou\r\nErick Avari\r\nFrench Stewart\r\nGianin Loffler\r\nChristopher John Fields\r\nDerek Webster\r\nJack Moore\r\nSteve Giannelli\r\nDavid Pressman\r\nScott Alan Smith\r\nCecil Hoffman\r\nRae Allen\r\nRichard Kind\r\nJohn Storey\r\nLee Taylor-Allan\r\nGeorge Gray\r\nKelly Vint\r\nErik Holland\r\nNick Wilder\r\nSayed Badreya\r\nMichael Concepcion\r\nJerry Gilmore\r\nMichel Jean-Philippe\r\nDialy N’‘Daiye\r\nGladys Holland\r\nRoger Til\r\nKenneth Danziger\r\nChristopher West\r\nRobert Ackerman\r\nKairon John\r\nDax Biagas\r\nFrank Welker’, ‘stargate.jpg’),
(2, ‘District 9’, ‘You are not welcome here. Thirty years ago, aliens made first contact with Earth. Humans waited for the hostile attack, or the giant advances in technology. Neither came. Instead, the aliens were refugees, the last survivors of their home world. The creatures were set up in a makeshift home in South Africa’’’‘s District 9 as the world’’’‘s nations argued over what to do with them. Now, patience over the alien situation has run out. Control over the aliens has been contracted out to Multi-National United (MNU), a private company uninterested in the aliens welfare - they will receive tremendous profits if they can make the aliens awesome weaponry work. So far, they have failed; activation of the weaponry requires alien DNA. The tension between the aliens and the humans comes to a head when an MNU field operative, Wikus van der Merwe (Sharlto Copley), contracts a mysterious virus that begins changing his DNA. Wikus quickly becomes the most hunted man in the world, as well as the most valuable - he is the key to unlcking the secrets of alien technology. Ostracized and friendless, there is only one place left for him to hide: District 9.’, ‘Sharlto Copley\r\nJason Cope\r\nNathalie Boltt\r\nSylvaine Strike\r\nElizabeth Mkandawie\r\nJohn Sumner\r\nWilliam Allen Young\r\nGreg Melvill-Smith\r\nNick Blake\r\nMorena Busa Sesatsa\r\nThemba Nkosi\r\nMzwandile Nqoba\r\nBarry Strydom\r\nJed Brophy\r\nLouis Minnaar\r\nVanessa Haywood\r\nMarian Hooman\r\nVittorio Leonardi\r\nMandla Gaduka\r\nJohan van Schoor\r\nStella Steenkamp\r\nDavid James\r\nKenneth Nkosi\r\nMampho Brescia\r\nTim Gordon\r\nMorne Erasmus\r\nAnthony Bishop\r\nDavid Clatworthy\r\nMike Huff\r\nAnthony Fridjhon\r\nEugene Khumbanyiwa\r\nHlengiwe Madlala\r\nSiyabonga Radebe\r\nMelt Sieberhagen\r\nAndre Odendaal\r\nJohn Ellis\r\nLouise Saint-Claire\r\nAlan Glauber\r\nNicolas Herbstein\r\nNorman Anstey\r\nNick Boraine\r\nRobert Hobbs\r\nSibulele Gcilitshana\r\nMahendra Raghunath\r\nPhillip Mathebula\r\nClaudine Bennent\r\nMichelle Ayden\r\nAntony Sarak\r\nBilly Somagaca\r\nRyan Whittal\r\nJohn Jacob\r\nYashik Maharaj\r\nFernando Saraiva\r\nSharon Waugh\r\nBrandon Auret\r\nJacques Gombault\r\nJustin Strydom\r\nSimo Mogwaza\r\nTheunis Nel\r\nSonni Chidiebere\r\nMatt Stern\r\nDanny Datnow\r\nDavid Dukas\r\nDaniel Hadebe\r\nWisani Mbokota\r\nCraig Jackson\r\nJustin Duplessis\r\nRodney Downey\r\nDen Antonakas\r\nBongo Mbutuma\r\nJohnny Selema\r\nMashabela Galane\r\nMfazwe Sekobane\r\nNicholas Ratlou\r\nSaint Gregory Nwokedi\r\nDonalson Rabisi\r\nZephania Sibanda\r\nGideon Thodane\r\nMdu Mthabela\r\nDavid Mikhethi\r\nJeffries Simelane\r\nShafique Allan\r\nWendy Mbatha\r\nLeigh Mashupye\r\nBeauty Setai\r\nNkiyase Mondlana\r\nKuda Rusike\r\nMorena Setatsa\r\nMpho Molao\r\nNtombi Nkuua\r\nAbsalom Dikane\r\nMonthandazo Thomo\r\nNorman Thabalala\r\nSiphiwe Mbuko\r\nShiela Nene’, ‘district9.jpg’),
(3, ‘Tombstone’, ‘A high-energy action adventure based on legend rather than historical fact finds Wyatt Earp (Kurt Russell) desiring to retire from law enforcement. With brothers Virgil (Sam Elliot) and Morgan (Bill Paxton), he arrives in Tombstone, Arizona intending to build his fortune. He discovers that long-time friend Doc Holliday (Val Kilmer) is there and that the town is run by a group of brutal outlaws called the Cowboys. Earp, frustrated with his laudanum-addicted wife, begins a romance with traveling stage actress Josephine Marcus (Dana Delany). Meanwhile, the Cowboys terrorize the citizens of Tombstone unchecked. When the town marshal is killed by a Cowboy, Earp steps in to prevent a lynching by an angry mob. He also refuses to hand the killer over to his fellows, beginning the enmity between the Cowboys and the Earp brothers. Virgil, overcome with guilt at doing nothing to help the Tombstone citizens, accepts the position of town marshal. With Wyatt and Morgan as his deputies, and the help of Doc, Virgil attempts to arrest several Cowboys, resulting in the famous OK Corral shoot-out. The Cowboys take revenge by ambushing two of the brothers and injuring Virgil and killing Morgan. The Earps leave town, apparently cowed. Wyatt returns, wearing the badge of a U.S. marshal, vowing to destroy every last Cowboy. He hunts them mercilessly, until the leader, Johnny Ringo (Michael Biehn) challenges Wyatt to a duel.’, ‘Kurt Russell\r\nVal Kilmer\r\nSam Elliott\r\nBill Paxton\r\nPowers Boothe\r\nMichael Biehn\r\nCharlton Heston\r\nJason Priestley\r\nJon Tenney\r\nStephen Lang\r\nThomas Haden Church\r\nDana Delany\r\nPaula Malcomson\r\nLisa Collins\r\nDana Wheeler-Nicholson\r\nJoanna Pacula\r\nMichael Rooker\r\nHarry Carey Jr.\r\nBilly Bob Thornton\r\nTomas Arana\r\nPat Brady\r\nPaul Ben-Victor\r\nJohn Philbin\r\nRobert John Burke\r\nBilly Zane\r\nWyatt Earp\r\nJohn Corbett\r\nBo Greigh\r\nForrie J. Smith\r\nPeter Sherayko\r\nBuck Taylor\r\nTerry O’‘Quinn\r\nCharles Schneider\r\nGary Clarke\r\nBilly Joe Patton\r\nFrank Stallone\r\nBobby Joe McFadden\r\nPedro Armendáriz Jr.\r\nMichael N. Garcia\r\nGrant Wheeler\r\nJim Dunham\r\nStephen C. Foster\r\nGrant James\r\nDon Collier\r\nCecil Hoffman\r\nCharlie Ward\r\nClark Andreas Ray\r\nChristopher Mitchum\r\nSanford Gibbons\r\nEvan Osborne\r\nShane McCabe\r\nRobert Mitchum’, ‘tombstone.jpg’),
(4, ‘Gone With The Wind’, ‘Gone With the Wind boils down to a story about a spoiled Southern girl’‘s hopeless love for a married man. Producer David O. Selznick managed to expand this concept, and Margaret Mitchell’‘s best-selling novel, into nearly four hours’’ worth of screen time, on a then-astronomical 3.7-million-dollar budget, creating what would become one of the most beloved movies of all time. Gone With the Wind opens in April of 1861, at the palatial Southern estate of Tara, where Scarlett O’‘Hara (Vivien Leigh) hears that her casual beau Ashley Wilkes (Leslie Howard) plans to marry “mealy mouthed” Melanie Hamilton (Olivia de Havilland). Despite warnings from her father (Thomas Mitchell) and her faithful servant Mammy (Hattie McDaniel), Scarlett intends to throw herself at Ashley at an upcoming barbecue at Twelve Oaks. Alone with Ashley, she goes into a fit of histrionics, all of which is witnessed by roguish Rhett Butler (Clark Gable), the black sheep of a wealthy Charleston family, who is instantly fascinated by the feisty, thoroughly self-centered Scarlett: "We’‘re bad lots, both of us." The movie’‘s famous action continues from the burning of Atlanta (actually the destruction of a huge wall left over from King Kong) through the now-classic closing line, "Frankly, my dear, I don’‘t give a damn." Holding its own against stiff competition (many consider 1939 to be the greatest year of the classical Hollywood studios), Gone With the Wind won ten Academy Awards, including Best Picture, Best Director, Best Screenplay, Best Actress (Vivien Leigh), and Best Supporting Actress (Hattie McDaniel, the first African-American to win an Oscar). The film grossed nearly 192 million dollars, assuring that, just as he predicted, Selznick’‘s epitaph would be "The Man Who Made Gone With the Wind.’, ‘Thomas Mitchell\r\nBarbara O’‘Neil\r\nVivien Leigh\r\nEvelyn Keyes\r\nAnn Rutherford\r\nGeorge Reeves\r\nFred Crane\r\nHattie McDaniel\r\nOscar Polk\r\nButterfly McQueen\r\nVictor Jory\r\nEverett Brown\r\nHoward C. Hickman\r\nAlicia Rhett\r\nLeslie Howard\r\nOlivia de Havilland\r\nRand Brooks\r\nCarroll Nye\r\nClark Gable\r\nLaura Hope Crews\r\nEddie ‘‘Rochester’’ Anderson\r\nHarry Davenport\r\nLeona Roberts\r\nJane Darwell\r\nOna Munson\r\nPaul Hurst\r\nIsabel Jewell\r\nCammie King Conlon\r\nEric Linden\r\nJ.M. Kerrigan\r\nWard Bond\r\nJackie Moran\r\nCliff Edwards\r\nLillian Kemble-Cooper\r\nYakima Canutt\r\nMarcella Martin\r\nLouis Jean Heydt\r\nMickey Kuhn\r\nOlin Howland\r\nIrving Bacon\r\nRobert Elliott\r\nWilliam Bakewell\r\nMary Anderson’, ‘gonewiththewind.jpg’);

CREATE TABLE IF NOT EXISTS reviews (
reviewID int(8) unsigned NOT NULL AUTO_INCREMENT,
userID int(8) NOT NULL,
movieID int(8) NOT NULL,
reviewDate date NOT NULL,
review text NOT NULL,
PRIMARY KEY (reviewID),
KEY reviewID (reviewID)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;

INSERT INTO reviews (reviewID, userID, movieID, reviewDate, review) VALUES
(1, 1, 1, ‘2011-09-30’, ‘This is how a Sci-fi/adventure movie should be like, truly fascinating and groovy to watch The opening plot was amazing, totally love the historical background! Stargate is a highly unique science fiction film that truly is packed with adventuristic events that really is entertaining. The amount of action is wonderful, and combined with great music from David Arnold couldn’’’‘t the film be more awesome as it is. I’’’‘m going to give this spectacular movie a 9/10, because it didn’’’‘t really feel as a 10, and the ending and the CGI could have been better.!!!’),
(2, 4, 1, ‘2013-03-12’, ‘Stargate is just how I had envisioned it- a fun, thrilling space adventure 3,000 years in the making. And being a sci-fi fan, it wasn’’’‘t too hard to enjoy this movie.’),
(3, 3, 2, ‘2014-01-08’, ‘This is a delicious premise, and Blomkamp, who first played with it in a 2005 short called ‘’’‘Alive in Joburg,’’’’ has magnified and improved it with ferocious energy, wit and style.’),
(4, 1, 2, ‘2013-07-03’, ‘No true fan of science fiction – or, for that matter, cinema – can help but thrill to the action, high stakes and suspense built around a very original chase movie.’),
(5, 2, 3, ‘2010-06-12’, ‘\r\nFrom the opening scene, narrated by the legendary Robert Mitchum, a nod to the great Hollywood Westerns of the past is evident; a gang of outlaws calling themselves ‘‘The Cowboys’’ break up a Mexican wedding in a small town, ruthlessly killing nearly all the men, including village priest Pedro Armendáriz Jr. (son of the legendary Western actor), in a scene reminiscent of ONCE UPON A TIME IN THE WEST, and THE MAGNIFICENT SEVEN. Led by two of Hollywood’‘s flashiest character actors, swaggering Powers Boothe, and coldly psychotic Michael Biehn (playing Johnny Ringo), the presence of such pure evil sets the stage for the Earps’’ arrival in Tombstone.’),
(6, 3, 3, ‘2012-08-16’, ‘Proof that westerns can be fun, Tombstone delivers an action-adventure popcorn movie that doesn’‘t have to be campy and one-dimensional to be enjoyable. Here, Wyatt Earp biography is told like a fable. Sure, the facts are often recalculated in this film. But this is not looking to give a straight-on accurate view of Wyatt Earp’‘s life. This is trying to take a man’‘s life as a basis and then add to it to make a cinematic joyride. As opposed to the overlong and plodding “Wyatt Earp,” this film decides to have a good time with the story and not get too bogged down in the misery. Kurt Russell is powerful as awful, and no man can deny that Val Kilmer, in his finest performance to date, was fully due for an Oscar nomination, if not an Oscar win. And Michael Biehn also gives a first rate performance as the sadistic Johnny Ringo. This is a thrill ride for anyone who loves westerns, or a good film to try to get others to start watching westerns.’),
(7, 4, 4, ‘2013-06-09’, ‘Every time I watch this film, and I’‘ve seen it more times than I can remember, I’‘m always astonished by the freshness of the story, the power of the emotions it conveys and the beautiful, detailed images of a time long gone. That this film was made in the 1930’‘s is almost incomprehensible to me. The challenges that had to be overcome in order to bring it to life must have been monumental. But come to life it did, and still does! A triumph of film-making ingenuity and genius, that will live on for many generations to come.’),
(8, 2, 4, ‘2014-06-18’, ‘“Gone with the Wind” brought together the best people in Hollywood. The end result is the stunning film that for about four hours keep us interested in the story unfolding in the screen. Of course, credit must be due to the director, Victor Fleming, and his vision, as well as the adaptation by Sydney Howard, who gave the right tone to the film. The gorgeous cinematography created by Ernest Haller gives us a vision of the gentle South before the war, and the Phoenix raising from the ashes of a burned Atlanta. The music of Max Steiner puts the right touch behind all that is seen in the movie.’);

and the page for the review details.

<?php # index.php This is the main page for the site. //Set the page title and include the header. $page_title = 'Reviews'; require_once ('./includes/header.php'); //Logged in. if(isset($_SESSION['user_id']) && isset($_COOKIE['moviereviews'])){ //Make the query. $query = "SELECT movies.movieImage, reviews.review, DATE_FORMAT(reviews.reviewDate, '%d %M %Y') AS rd , accounts.email, movies.movieName FROM reviews INNER JOIN accounts ON reviews.userID=accounts.userID INNER JOIN movies on reviews.movieID=movies.movieID"; //Get specific product. if(isset($_GET['ID'])){//Get specific user posts $query .= " WHERE accounts.userID=reviews.userID AND movies.movieID=".$_GET['ID']." ORDER BY DATE_FORMAT(reviewDate, '%d %M, %Y') DESC"; } $result=mysqli_query($dbc, $query); //Table to layout the user records. echo ""; //Set the background color (for alternating row colors). //Grey. $bg = "#dddddd"; //Fetch and display all retrieved records. while($row = mysqli_fetch_array($result, MYSQL_ASSOC)){ //Switch the background color. //Grey. if($bg=="#dddddd"){ //White. $bg = "#ffffff"; }else{ //Grey. $bg="#dddddd"; } //Display contens in table. echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } //close the table echo "
Movie
Review
Member
ReviewDate
", " ", $row['movieName'], "", $row['review'], "", $row['email'], "", $row['rd'], "
"; //Free up the resources. mysqli_free_result ($result); //Close the database connection. mysqli_close($dbc); //End of links section. ?>
				<link href="styles/layout.css" rel="stylesheet" type="text/css">
			</head>
             
            <div id="Review">                 
                <form method="POST" action="review.php">
                <textarea cols="100" rows="5" id="review" name="review" placeholder="Enter your review"></textarea>
                        <br />
					 <input type="submit" name="review" id="review" value="Review Movie">
                     <?php
					 	if(isset($_POST['review'])){
							// Initialize error array.
							$errors = array(); 
							// Check for a review.
							$r = trim($_POST['review']);
							if(empty($r)){
								$errors[1] = 'You forgot to enter your review.';
							}
							if(empty($errors)){
							// Escape an illigal MySql characters in the data
							$r = mysqli_real_escape_string($dbc, $r);
							$e = $_SESSION['user_id'];
							$rd= $_COOKIE['moviereviews'];
							$query="INSERT INTO reviews (review, email, reviewDate) VALUES ('$r', '$e', '$rd')";
							$url = './review.php';
							// Delete the buffer.
							ob_end_clean(); 
							header("Location: $url");
							// Quit the script.
							exit(); 
							}
						}
							?>
						
				</form>
                   
              </div>
			
			<?php
            }else{
				echo "<div class='ErrorForm'>This page has been accessed in error!</div>";
			//end if logged in
			}
			//Include the footer file.
			require_once ('./includes/footer.php');
		?>

First there’s no need to double post, second use code tags for your code and lastly try to keep you script to the area you think where the problem is. You also don’t need to have all that for the structure of the database table, all you need is the structure of the table itself. I am pretty sure the person helping you knows how to setup the table if it is warranted rather quickly. :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service