Results 1 to 3 of 3

Thread: PHP Error

  1. #1
    Join Date
    Oct 2011

    Default PHP Error


    Recently developed a form called doctors. Then develop an application in php called busquedadoctores, a report to display data in tabular form. The application is based on two combo box, 1) to find the specialty and the other to find the city and give me a result which appears in the doctor's name, address, specialty, state, ect in tabular form. When I insert the data into the form I get the following error:

    Warning: mysql_query () Expects parameter 1 to be string, Given resource in / home / zonamedi / public_html / busquedadoctores.php on line 55
    Error getting data

    The line 55 is $result = mysql_query ($dbcon, $query) or die ('error getting data');

    The web address is:

    The code to use is:

    <title>Búsqueda de doctores</title>
    <style type="text/css">

    table {
    background-color: #fcf;

    th {
    width: 150px;
    text-align: left;

    <h1>Búsqueda de doctores</h1>

    <form method="post" action="busquedadoctores.php">
    <input type="hidden" name="submitted" value="true" />

    <label>Busqueda por especialidad:
    <select name="especialidad">
    <option value="Alergista e Inmunología">Alergista e Inmunología</option>
    <option value="Anestesiólogo">Anestesiólogo</option>
    <option value="Cardiólogo">Cardiólogo</option>
    <option value="Cirujano">Cirujano</option>
    <option value="Cirujano cardiovascular">Cirujano cardiovascular</option>
    <option value="Cirujano maxilofacial">Cirujano maxilofacial</option>
    <option value="Cirujano plástico">Cirujano plástico</option>

    <label>Busqueda por pueblo:
    <select name="pueblo">
    <option value="Adjuntas">Adjuntas</option>
    <option value="Aguada">Aguada</option>
    <option value="Aguadilla">Aguadilla</option>

    <input type="submit" />



    if (isset($_POST['submitted'])) {

    //connect database

    $especialidad = $_POST['especialidad'];
    $pueblo = $_POST['pueblo'];
    $query = ("SELECT * FROM doctores WHERE $especialidad LIKE '%". $pueblo."%'");
    $result = mysql_query($dbcon, $query) or die('error getting data');
    $num_rows = mysql_num_rows($result);

    echo "$num_rows result found";
    echo "<table>";
    echo "<tr> <th>Nombre</th> <th>Epecialidad</th> <th>Direccion</tr>";

    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

    echo "<tr><td>";
    echo $row['NOMBRE'];
    echo "</td><td>";
    echo $row['ESPECIALIDAD'];
    echo "</td><td>";
    echo $row['DIRECCION'];
    echo "</td></tr>";

    echo "</table>";




    thanks for any help

  2. #2
    Join Date
    Oct 2011

    Default Re: PHP Error

    Someone could help me with this problem?

  3. #3
    Join Date
    Mar 2006

    Default Re: PHP Error

    Why don't you try an online forum that specializes in code and coding issues?

    Being impatient for assistance with an issue that is not directly VodaHost or BlueVoda related is not only improper, it is something that if continued may result in your permissions being modified: just because you have a hosting account does not mean that you have the right to demand assistance with 3rd part products or personal coding, per Forum Rules.
    . VodaWebs....Luxury Group
    * Success Is Potential Realized *

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts