this is just a test case I wrote but my main question is my whole application works locally connect to MySQL and return a couple thousand records I turn error reporting on EALL forthe page and I don't get any error all I actual get for output of this test case is Number Number Number Number Number five times which doesn't make any sense as I am grabbing one row by primary key in this example. Any way I am new at php so any reference for going from xammp to lamp would be appreciated. url is http://ift.tt/1EqF4XR Thank you in advance
<?php
$servername = "localhost";
$username = "root";
$password = "Mypass";
$dbname = "test";
$conn = mysqli_connect($servername, $username, $password, $dbname);
$sqltest = sprintf("SELECT num, num2 FROM mytest WHERE num = 2");
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$resulttest = mysqli_query($conn, $sqltest);
foreach($resulttest as $row)
{
echo("Number".$row['num'].$row['num2']);
}
mysqli_close($conn);;
?>
Aucun commentaire:
Enregistrer un commentaire