0

I have decide to update my old MySQL code to mysqli but when creating a SELECT query it is just showing a white page here is my code

<?php
session_start();
include('./includes/connections.php');
error_reporting(-1);
ini_set('display_errors',1);
$chk_name = $db->prepare("SELECT `playerid`
             FROM `members` 
             WHERE `playername` = '?' ||
                   `player_login_name` = '?'";
$chk_name->bind_param($_POST['name'],$_POST['name'])
$chk_name->execute();
$chk_name->fetch();
$exsist = $chk_name->num_rows;
if($exsist) 
{ 
  echo "&nbsp;&nbsp;&nbsp;&nbsp;Sorry, This username is already in use.<br/>
        &nbsp;&nbsp;&nbsp;&nbsp;&#187;<a href='home.php";
        if($_GET['PID']) { echo '?PID=' . $_GET['PID']; } echo "'>Okay</a>";
}
else{
    echo "username available";
}

here is my connection script `

<?php
$db = new mysqli("localhost", "******", "*****", "******");
if($db->connect_errno > 0) {
    die('Connection failed [' . $db->connect_error . ']');
}
Dharman
  • 21,838
  • 18
  • 57
  • 107
Adam Hull
  • 214
  • 2
  • 10
  • You missed a `;` at this line : `$exsist = $chk_name->num_rows`. –  Nov 24 '14 at 13:41
  • yes i realised that i just missed it off while copying it over it is in my file and still nothing – Adam Hull Nov 24 '14 at 13:43
  • If the page is blank, you should have a look at [this question](http://stackoverflow.com/questions/78296/reasons-why-php-would-echo-errors-even-with-error-reporting0) to configure errors displaying. –  Nov 24 '14 at 13:44
  • Still a `;` missing here : `$chk_name->bind_param($_POST['name'],$_POST['name'])`. ;) –  Nov 24 '14 at 13:45
  • fyi: you do not need quotations on those placeholders – Kevin Nov 24 '14 at 13:45
  • i have error reporting switched on but it still shows blank and i have added the ; into that line to no avail – Adam Hull Nov 24 '14 at 13:49
  • Change `error_reporting(-1)` into `error_reporting(E_ALL)`. What do you see? There must be some kind of error if it only shows a blank page. – S.Pols Nov 24 '14 at 14:59

0 Answers0