Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since you're seemingly using prepared statements, I'd recommend using them to their fullest extent so that you can avoid traditional problems like SQL injection (this is when someone passes malicious SQL code to your application, it's partially avoided by cleansing user inputs and/or using bound prepared statements).</p> <p>Beyond that, you've got to actually fetch the results of your query in order to display them (assuming that's your goal). PHP has very strong documentation with good examples. Here are some links: <a href="http://php.net/manual/en/pdostatement.fetchall.php" rel="nofollow">fetchAll</a>; <a href="http://php.net/manual/en/pdo.prepare.php" rel="nofollow">prepare</a>; <a href="http://us.php.net/manual/en/pdostatement.bindparam.php" rel="nofollow">bindParam</a>.</p> <p>Here is an example:</p> <pre><code>try { $db = new PDO("mysql:host=$db_host;dbname=$db_name", $db_user, $db_pass); } catch (PDOException $e) { exit('Error connecting to database: ' . $e-&gt;getMessage()); } $user = $_SESSION['user']; $pickedyet = $db-&gt;prepare('SELECT game1 FROM user WHERE user = :user'); /* Bind the parameter :user using bindParam - no need for quotes */ $pickedyet-&gt;bindParam(':user', $user); $pickedyet-&gt;execute(); /* fetchAll used for example, you may want to just fetch one row (see fetch) */ $results = $pickedyet-&gt;fetchAll(PDO::FETCH_ASSOC); /* Dump the $results variable, which should be a multi-dimensional array */ var_dump($results); </code></pre> <p><strong>EDIT</strong> - I'm also assuming that there is a table called 'user' with a column called 'user' and another column called 'game1' (i.e. that your SQL statement is correct aside from the usage of bound parameters).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload