| Author |
Resource error # 4
|
|
| Robert 2007-05-30, 9:59 pm |
| Hi y'all,
The below gives resource error # 4. I've cut a lot of code out in an
attempt to just display adv_id twice. The first time works as expected.
The second time I get the error.
When echoing result, I should be looking for an array to be displayed?
If so, how?
Thanks.
Robert
*******************
<?php
include ("connect.php");
?>
<form action="<?php echo "display_details.php" ?>" method="post">
<p>Which record would you like to see?</p>
<P>Enter Record #<br>
<input type=text name="adv_id" size=5>
<input type=submit name="submit" value="View Record">
</form>
<?php
if (!empty($_POST))
{
$adv_id = $_POST['adv_id'];
echo "$adv_id";
$result=mysql_query("SELECT * FROM advertiser_tbl WHERE adv_id =
'adv_id'") or die
(mysql_error());
echo "$result";
}
?>
| |
| ZeldorBlat 2007-05-31, 9:59 pm |
| On May 30, 9:47 pm, Robert <lektrikpuke@_yahoo.com> wrote:
> Hi y'all,
>
> The below gives resource error # 4. I've cut a lot of code out in an
> attempt to just display adv_id twice. The first time works as expected.
> The second time I get the error.
>
> When echoing result, I should be looking for an array to be displayed?
> If so, how?
>
> Thanks.
>
> Robert
>
> *******************
>
> <?php
> include ("connect.php");
> ?>
>
> <form action="<?php echo "display_details.php" ?>" method="post">
> <p>Which record would you like to see?</p>
> <P>Enter Record #<br>
> <input type=text name="adv_id" size=5>
> <input type=submit name="submit" value="View Record">
> </form>
>
> <?php
> if (!empty($_POST))
> {
> $adv_id = $_POST['adv_id'];
> echo "$adv_id";
> $result=mysql_query("SELECT * FROM advertiser_tbl WHERE adv_id =
> 'adv_id'") or die
>
> (mysql_error());
> echo "$result";
> }
>
> ?>
mysql_query() returns a /resource/ which you are assigning to
$result. You need to then use one of the mysql_fetch_* function to
get the actual rows out. See the manual for more info:
<http://www.php.net/mysql>
| |
| Robert 2007-06-01, 9:59 pm |
| ZeldorBlat wrote:
> On May 30, 9:47 pm, Robert <lektrikpuke@_yahoo.com> wrote:
>
> mysql_query() returns a /resource/ which you are assigning to
> $result. You need to then use one of the mysql_fetch_* function to
> get the actual rows out. See the manual for more info:
>
> <http://www.php.net/mysql>
>
That helped. Thanks.
| |
|
|
|
|
|
|
|
|