$getm="SELECT player FROM manutd WHERE player='$x'";
$get=$mysqli->query($getm,MYSQLI_USE_RESULT);
while($row=$get->fetch_object())
{
$name=$row->player;
}

is there anything wrong with this code.........................plz help

Recommended Answers

All 6 Replies

do you have the class which creates the $mysqli instance. is there a function named query in the class.

no classes and neither a function named query

can there be error in connection with the database ..............

the syntax you are using implies you are trying to use a class instance with the var $mysqli. when you are trying to run the "query()" function its trying to find that function in that class.

if you are not trying to use a class, use

mysql_query($queryhere);

or something like that

after a second look i realized that your entire code is wrong (if you are not using a class)

try using:

<?php

$con = mysql_connect('localhost','user','pass');
mysql_select_db('db');

$sql = "SELECT `player` FROM `manutd` WHERE `player` = '{$x}'";
$query = mysql_query($sql,$con);
while ($row = mysql_fetch_assoc($query)) {
    $name = $row['player'];
}


?>

?????but my code is working on localhost but wen i try it on www it gives this error.........
i will try your method..............i hope this shud work.......

i cant get it right......................
this is killin me.........
Warning: mysqli_connect() [function.mysqli-connect]: XXXX: Access denied for user (using password: YES)
........plz help.......even the include file is gettin over me ........
can u help where might i b wrong......i not even able to connect to the data base.....the warning is hittin me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.