cadena de consulta php mysql

I need help to query string from database please help.


$link = mysql_connect('localhost', 'root', 'toor');
if (!$link) {
    die('Could not connect: ' . mysql_error());
if (!mysql_select_db('wizarddb')) {
    die('Could not select database: ' . mysql_error());
$result = mysql_query("SELECT * FROM Phone WHERE phone LIKE '%$phone%'"); 

if (!$result) {
    die('Could not query:' . mysql_error());
echo mysql_result($result(1); // outputs phone


I have issues with echo or is the query wrong?

preguntado el 09 de septiembre de 13 a las 22:09

echo mysql_result($result(1); should be echo mysql_result($result(1)); (missing closing ')' ) -

is there any other error message that you are getting ? -

what help do you need? Is there an error, something not working as you'd expect or it does nothing/white page? -

You have unbalanced parentheses, you should be getting a Parse Error. Or is that just a typo in the question, not the original code? -

1 Respuestas

Your error is on the echo.

echo mysql_result($result(1); // outputs phone

That SHOULD be

echo mysql_result($result[1]); // outputs phone

Respondido el 09 de Septiembre de 13 a las 22:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.