For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > June 2007 > Resource error # 4









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

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.
Ererbunlolem85

2007-06-10, 4:41 pm

HACKED P0RN SITE!
Direct access to member zone
http://uniqueadult.com/members/video.php?file=1
username: 218571
password: wanttocome
change the number in the link to get other videos!
Rocki

2007-06-15, 5:52 pm

Angelina Jolie and Paris Hilton Vibrating In Slits!
Notorious

2007-06-21, 11:21 am

Alyssa Milano , Hot anal action!

http://www.videomoviesonline.com/player?vid=1673286
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com