Jump to content

selliottsxm

Members
  • Posts

    12
  • Joined

  • Last visited

selliottsxm's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. THANKS a million!! I got it working $q = "SELECT movie_id, scene_id, scene_name FROM scenes WHERE movie_id = $movie_id"; $r2 = mysqli_query($dbc, $q); if (!$r2) { echo "Query did not run - error msg is: ".mysqli_error(); exit(); } while ($row = mysqli_fetch_array($r2)){ echo' <a href="movies/'.$row['scene_id'].'.mp4"> <img src="img/scenes/'.$row['scene_id'].'.jpg"> </a> '; }
  2. You are right, the query isn't running.
  3. Thanks ginerjim, should have seen that. The array still isn't populating I think. Even a simple echo with just a scene id doesn't work
  4. I think that I should send you the entire code. I have a section above that used a sql query and an array, although it didn't need to loop as all the data was from one record only. So before I started the sql for the array that needed to loop I closed the database connection and then reopened thinking that the array needed to be emptied. Check you messages I'll send you the code there (I also sent you a message earlier). The database connection is fine, connects ok.
  5. Tried that too: [28-May-2014 07:17:12 America/Vancouver] PHP Warning: mysqli_query(): Couldn't fetch mysqli in /Applications/MAMP/htdocs/movie2.php on line 84 [28-May-2014 07:17:12 America/Vancouver] PHP Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /Applications/MAMP/htdocs/movie2.php on line 85 I sent you a message...
  6. Hiya, Still getting errors. I'm real new to this and I don't understand what the errors are trying to tell me require_once ('../mysqli_connect.php'); $movie_id = $_GET['movie_id']; $q = "SELECT * FROM scenes WHERE movie_id = $movie_id"; $r = mysqli_query($q, $dbc); while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC));{ echo' <a href="movies/' .$row['scene_id']. '.mp4"> <img src="img/scenes/movie_'. $r['movie_id'] .'_1_scene_thumb.jpg"> </a> '; } [28-May-2014 06:54:38 America/Vancouver] PHP Warning: mysqli_query() expects parameter 1 to be mysqli, string given in /Applications/MAMP/htdocs/movie2.php on line 84 [28-May-2014 06:54:38 America/Vancouver] PHP Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /Applications/MAMP/htdocs/movie2.php on line 85
  7. I still can't get it to work, is it the way I'm constructing the a href? $movie_id = $_GET['movie_id']; $q = "SELECT * FROM scenes WHERE movie_id = $movie_id"; $r = @mysqli_query($q, $dbc); while ($row = @mysqli_fetch_array($r, MYSQLI_ASSOC));{ echo '<a href=" '.$row['scene_id'].'.mp4 ">SCENE</a>';}
  8. I tried this and it still won't work. I'm real new to this and I can't get this one right.. $q = "SELECT * FROM scenes WHERE movie_id = $movie_id"; $r = @mysqli_query($q, $dbc); $row = @mysqli_fetch_array($r, MYSQLI_ASSOC); while ($row = @mysqli_fetch_array($r, MYSQLI_ASSOC));{ echo '<a href=" '.$row['scene_id'].'.mp4 ">'.$row['scene_name'].'</a>';}
  9. Hello, Can anyone tell me what I'm doing wrong here? I am trying to run a query against a table for scenes from movies. Each movie would have up to 8 scenes. For the life of me I can't get this loop to work. The movie id is being passed in the url, tested to make sure it's being passed and it is. The code is pasted below. require_once ('../mysqli_connect.php'); $movie_id = $_GET['movie_id']; $q = "SELECT * FROM scenes WHERE movie_id = $movie_id"; $r = @mysqli_fetch_array($dbc, $q); $row = @mysqli_fetch_array($r, MYSQLI_ASSOC); while ($row = @mysqli_fetch_array($r, MYSQLI_ASSOC));{ echo '<a href=" '.$row['scene_id'].'.mp4 ">'.$row['scene_name'].'</a>';} In advance thanks a million!!
  10. Thanks very much for the advice. I really appreciate it!
  11. 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);
  12. Hi, I'm very new to php and to mysql and I was hoping someone would be kind enough to give me a hand. I'm trying to write a query that returns only one record set. I'll paste what I have below and the error. I'm sure that I am doing something wrong that is right in front of my face but for the life of me I can't figure it out. The relevant part of the code is: require_once ('../mysqli_connect.php'); $movie_id = $_GET['movie_id']; $q = "SELECT * FROM movies WHERE movie_id = $movie_id"; $r = mysqli_query($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> The error I'm getting is: PHP Fatal error: Cannot use object of type mysqli_result as array Help!
×
×
  • 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.