cadena de consulta php mysql
Frecuentes
Visto 1,896 veces
-1
I need help to query string from database please help.
<?php
$phone="8165526693@vtext.com";
$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
mysql_close($link);
?>
I have issues with echo or is the query wrong?
1 Respuestas
0
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 php mysql string search or haz tu propia pregunta.
echo mysql_result($result(1); should be echo mysql_result($result(1)); (missing closing ')' ) - Maximus2012
is there any other error message that you are getting ? - Maximus2012
what help do you need? Is there an error, something not working as you'd expect or it does nothing/white page? - James
You have unbalanced parentheses, you should be getting a Parse Error. Or is that just a typo in the question, not the original code? - Barmar