Jump to content

audiovisuaali

New Members
  • Posts

    2
  • Joined

  • Last visited

audiovisuaali's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Here's what I see when I go to the page: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL,1' at line 1' in FILE_LOCATION/test.php:21 Stack trace: #0 FILE_LOCATION/test.php(21): PDOStatement->execute() #1 {main} thrown in FILE_LOCATION/test.php on line 21
  2. When I'm doing this it can't handle the query line. When I change the :count to a number it works correctly. So I want to know how can I use a string to determine a number for the mysql request. Thank you! <?php // Error report ini_set('display_errors', 1); error_reporting(~0); // Getting video ID from URL $video = $_GET['v']; // Including database connection include 'db.php'; //$query = "SELECT file_name, videos FROM videos ORDER BY RAND() LIMIT 1;"; $query = "SELECT file_name, videos FROM videos LIMIT :count,1;"; // Prepare $statement = $handler->prepare($query); $statement->bindParam(":count",$video); // Execute $statement->execute(); // Fetch $videos = $statement->fetch(PDO::FETCH_ASSOC); $comment = $videos["file_name"]; $videos = $videos["videos"]; echo $comment; echo $videos; ?>
×
×
  • 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.