Reply to Re: Warning: mysql_fetch_array(): supplied argument

Your name:

Reply:


Posted by adlerweb on 03/14/07 21:15

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

$result = mysql_query("SELECT * 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_array(): 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>
> <title> Colorado</title>
> </head>
> <body>
> <h1>Social Security Offices</h1>
> </html>
> <?php
> $con = mysql_connect("localhost","admin","*******");
> if (!$con)
> {
> die('Could not connect: ' . mysql_error());
> }
>
> mysql_select_db("office", $con);
>
> $id = $_GET['id'];
>
> $result = mysql_query("SELECT * 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_array($result)) {
>
>
> $neprocks_office = $row->neprocks_office; $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_close($con);
> ?>
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация