selliottsxm
Members-
Posts
32 -
Joined
-
Last visited
selliottsxm's Achievements
Newbie (1/14)
0
Reputation
-
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
-
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)
-
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?
-
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?
-
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>'; ?>
-
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>'; ?>