Jump to content
Larry Ullman's Book Forums

selliottsxm

Members
  • Posts

    32
  • Joined

  • Last visited

selliottsxm's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Got it: require_once ('../mysqli_connect.php'); $movie_id = $_GET['movie_id']; $q = mysqli_query($dbc,"SELECT * FROM movies WHERE movie_id = $movie_id"); $r = mysqli_fetch_array($q); Thanks for making me figure it out
  2. I'm still doing it wrong, am I using the mysqli_query function incorrectly? Tried this: require_once ('../mysqli_connect.php'); $movie_id = $_GET['movie_id']; $q = mysqli_query("SELECT * FROM movies WHERE movie_id = $movie_id"); $r = mysqli_query($q, $dbc); Got this: PHP Warning: mysqli_query() expects at least 2 parameters, 1 given in /Applications/MAMP/htdocs/movie2.php on line 29 PHP Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /Applications/MAMP/htdocs/movie2.php on line 30
  3. Still getting errors. Here I am right now (I'll only include the relevant part and then the error require_once ('../mysqli_connect.php'); $movie_id = $_GET['movie_id']; $q = "SELECT * FROM movies WHERE movie_id = $movie_id"; $r = mysqli_fetch_array ($dbc, $q); echo '<table cols="2" width="1100px" align="center"> <tr> <td align="left" width="240px"><img src="img/boxcovers/small/movie_' . $r['movie_id'] .'_small.jpg"></td> <td></td> </tr> <tr> <td align="center" width="960px"> ERROR IS: PHP Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, object given in /Applications/MAMP/htdocs/movie2.php on line 30 (Line 30 is $r)
  4. Correction: The query is actually: $q = "SELECT * FROM movies WHERE movie_id = $movie_id";
  5. Hello, I am trying, without success I might add, to execute a simple query. One variable is passed as a $_GET value which is movie_id. I defined a variable $movie_id = $_GET['movie_id']; I then wrote a query: SELECT * FROM movies WHERE movie_id = $movie_id I'll paste the relevant script below. require_once ('../mysqli_connect.php'); $movie_id = $_GET['movie_id']; $q = mysqli_query("SELECT * FROM movies WHERE movie_id = '$movie_id'"); $r = mysqli_fetch_array ($dbc, $q); echo ' <table cols="2" width="1100px" align="center"> <tr> <td align="left" width="240px"><img src="img/boxcovers/small/movie_' . $r['movie_id'] .'_small.jpg"></td> <td></td> </tr> <tr> <td align="center" width="960px"> Can anyone help?
  6. Scratching my head too. Left outer join didn't work. All spelling is correct and table have all the fields. Going to leave it for a day and look at it again. Thanks again Antonio, very nice of you to help
  7. Hi Antonio, Thanks very much for the help. Didn't work though. Taking out the genre part and replacing it with actor names gave me the same result. Left outer join didn't make a difference either. I think that I have the relationships correct. Back to the drawing board! Steve
  8. I am having a devil of a time with joining up my tables. I have 7 tables: movies, studios,scenes are all joining up fine using this query: SELECT movies.movie_id, movies.movie_title, movies.movie_desc, studio, scene_name FROM movies INNER JOIN studios ON movies.studio_id=studios.studio_id INNER JOIN scenes ON movies.movie_id=scenes.movie_id ORDER BY movie_id ASC, scene_name ASC i am trying to join up the remaining four which is where I am having problems. The tables are: actors movie_actor (movie_actor being the child and related to movies by the movie_id genres movie_genres (movie_genres being the child and related to movies by the movie_id I have tried joining up actors and genres. In the query below I tried with the genres table, then tried with the actors table. The error result is the same with the exception of the field name: SELECT movies.movie_id, movies.movie_title, movies.movie_desc, studio, scene_name, genre FROM movies INNER JOIN studios ON movies.studio_id=studios.studio_id INNER JOIN scenes ON movies.movie_id=scenes.movie_id INNER JOIN movie_genres ON movies.movie_id=movie_genres.movie_id ORDER BY movie_id ASC, scene_name ASC returns an error: unknown column 'genre' in the field list. Does anyone know what I might be doing wrong?
  9. I started fooling around with the incrementing variable $i It's getting there. Now I have 8 images in each row (each one appearing twice)
  10. I tried that one already. All it does is give me the same graphic four times in one row
  11. I'm trying to display the results of a query in a table. The query returns graphic file names so that I can display images in a table. I'm trying to display them so that there are four images in one row, but all I get is one per row. Does anyone know what I might try? My script is below: <?php # feeds_user.php This script will advertise the feeds on the index.php page (page for non members) require_once ('../mysqli_connect.php'); $q= "SELECT feed_id, feed_graphic AS graphic FROM feeds_user ORDER By feed_id"; $r= @mysqli_query ($dbc, $q); while ($row = mysqli_fetch_array ($r, MYSQLI_ASSOC)){ echo '<table align="center" cellspacing="0" cellpaddin g="5" border="10" width="1100px"> <tr> . <td align="center" colspan="4"><a href="join.php"><img src="'. $row['graphic'] .'"></a></td> </tr>' ; } echo '</table>'; ?>
  12. I figured it out. My file permissions were not set correctly and therefore only one image (which for some reason was set right) was displaying!
  13. I am having trouble getting this to work. I have a table in my database which contains graphics I need to use in a table. So I want to create a query and array to populate the table. My php is below. Can anyone see what I'm doing wrong? <?php # feeds_user.php This script will advertise the feeds on the index.php page (page for non members) require_once ('../mysqli_connect.php'); $q= "SELECT feed_id, feed_graphic AS graphic FROM feeds_user ORDER By feed_id"; $r= @mysqli_query ($dbc, $q); while ($row = mysqli_fetch_array ($r, MYSQLI_ASSOC)){ echo '<table align="center" cellspacing="0" cellpaddin g="5" border="10" width="1100px"> <tr> . <td align="center"><a href="join.php"><img src="'. $row['graphic'] .'"></a></td> <td align="center"><a href="join.php"><img src="'. $row['graphic'] .'"></a></td> <td align="center"><a href="join.php"><img src="'. $row['graphic'] .'"></a></td> <td align="center"><a href="join.php"><img src="'. $row['graphic'] .'"></a></td> </tr>' ; } echo '</table>'; ?>
  14. Yes I think so. What I've done is to modify the SQL statement including expiry_date in the SELECT and expiry_date > NOW() in the WHERE clause. It returns the error array but I can't figure out how to add the error "You membership has expired" to the array.
×
×
  • Create New...