Can some look at my php code and SQL query. It works in mysql just not php

$username = “saori”;
$password = “”;
$hostname = “Jamal-pc”;
$mysqli= mysql_connect($hostname,$username,$password)
or die(“Unable to connect to MySQL”);
echo ‘it worked’;

if (!$mysqli)


$output = ‘Unable to connect to the database server.’;

include ‘output.html’;


$query1 = "Select EnglishWord From Japanesedefinition Where Japaneseword=iku;
if (!$query1){
die('Invalid query: ’ . mysql_error());
$result =mysql_query($query1,$mysqli);

It a language database and the query works perfectly in mysql just doesn’t work in php. Here is the error I get:
! ) Parse error: syntax error, unexpected $end in C:\wamp\www\index.php on line 30

I dont have any thing in line 30.

Missing end quote.

$query1 = "Select EnglishWord From Japanesedefinition Where Japaneseword=iku"; 

You should move away from mysql especially if you are just learning. You might try PDO

$username = "saori";
$password = "";	
// localhost is common hostname.
$hostname = "Jamal-pc";
$dbname = "japanesewords";

//Establish a connection
$db = new PDO("mysql:host=localhost;dbname=$dbname", "$username", "$password");

	$word = "iku";
	$query = $db->prepare("SELECT EnglishWord FROM Japanesedefinition WHERE Japaneseword = :iku");
	$query->bindParam(":iku", $word);
	while($row = $query->fetch(PDO::FETCH_ASSOC)){
		echo "{$row['EnglishWord']}";

I can’t believe your query works. Besides adding the trailing double quote to the statement, you need to quote the argument in your where clause for it to be even recognized. Also - you are testing the validity of your var containing the statement. What is that doing? It will always be true - it’s just a string variable.

Lastly - since the query you are showing us can’t possibly run, I don’t know that anything is working for you here. Also you are printing the result of one row of your query results and that’s it. You are not doing an exit() so that is probably the reason for your error message.

I tried the code, but it yielded me nothing. going to have to try it again tomorrow.