Warning: mysql_fetch_array(): supplied argument

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • myaashik@gmail.com

    Warning: mysql_fetch_array(): supplied argument

    Hello! All I have a Error message saying that:

    Warning: mysql_fetch_arr ay(): supplied argument is not a valid MySQL
    result resource in /home/rocks/public_html/colorado3.php on line 32

    I have error on this code below:

    <html>
    <head>
    <titleColorad o</title>
    </head>
    <body>
    <h1>Social Security Offices</h1>
    </html>
    <?php
    $con = mysql_connect(" localhost","adm in","*******" );
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }

    mysql_select_db ("office", $con);

    $id = $_GET['id'];

    $result = mysql_query("SE LECT * FROM sso WHERE state = $id");

    echo "<table border='2'>
    <tr>
    <th>Address1</th>
    <th>Address2</th>
    <th>City</th>
    <th>State</th>
    <th>Zip</th>
    <th>Telephone </th>
    </tr>";


    while($row = mysql_fetch_arr ay($result)) {


    $neprocks_offic e = $row->neprocks_offic e; $addr_st1 = $row->addr_st1;
    $addr_st2 = $row->addr_st2; $city = $row->city;
    $state = $row->state; $zip = $row->zip; $telephone = $row->telephone;

    echo "<tr>";
    echo "<td>" . $row['addr_st1'] . "</td>";
    echo "<td>" . $row['addr_st2'] . "</td>";
    echo "<td>" . $row['city'] . "</td>";
    echo "<td>" . $row['state'] . "</td>";
    echo "<td>" . $row['zip'] . "</td>";
    echo "<td>" . $row['telephone'] . "</td>";
    echo "</tr>";
    }
    echo "</table>";mysql_c lose($con);
    ?>

  • adlerweb

    #2
    Re: Warning: mysql_fetch_arr ay(): supplied argument

    mysql_select_db ("office", $con) or die(mysql_error ());

    $result = mysql_query("SE LECT * FROM sso WHERE state = $id") or
    die(mysql_error ());

    but please also read docs about security - never put $_GET or $_POST
    directly into a mysql-query...

    myaashik@gmail. com schrieb:
    Hello! All I have a Error message saying that:
    >
    Warning: mysql_fetch_arr ay(): supplied argument is not a valid MySQL
    result resource in /home/rocks/public_html/colorado3.php on line 32
    >
    I have error on this code below:
    >
    <html>
    <head>
    <titleColorad o</title>
    </head>
    <body>
    <h1>Social Security Offices</h1>
    </html>
    <?php
    $con = mysql_connect(" localhost","adm in","*******" );
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
    >
    mysql_select_db ("office", $con);
    >
    $id = $_GET['id'];
    >
    $result = mysql_query("SE LECT * FROM sso WHERE state = $id");
    >
    echo "<table border='2'>
    <tr>
    <th>Address1</th>
    <th>Address2</th>
    <th>City</th>
    <th>State</th>
    <th>Zip</th>
    <th>Telephone </th>
    </tr>";
    >
    >
    while($row = mysql_fetch_arr ay($result)) {
    >
    >
    $neprocks_offic e = $row->neprocks_offic e; $addr_st1 = $row->addr_st1;
    $addr_st2 = $row->addr_st2; $city = $row->city;
    $state = $row->state; $zip = $row->zip; $telephone = $row->telephone;
    >
    echo "<tr>";
    echo "<td>" . $row['addr_st1'] . "</td>";
    echo "<td>" . $row['addr_st2'] . "</td>";
    echo "<td>" . $row['city'] . "</td>";
    echo "<td>" . $row['state'] . "</td>";
    echo "<td>" . $row['zip'] . "</td>";
    echo "<td>" . $row['telephone'] . "</td>";
    echo "</tr>";
    }
    echo "</table>";mysql_c lose($con);
    ?>
    >

    Comment

    Working...