ID:               13560
 Comment by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Bogus
 Bug Type:         MySQL related
 Operating System: win2000
 PHP Version:      4.0.6
 New Comment:

i think i'm having the same problem.  here's some code :)
---------------------------------------------------------
// generate and execute query
$query = "SELECT slug, content, contact, timestamp FROM news WHERE id =
'$id'";
$result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());

// get resultset as object
$row = mysql_fetch_object($result);

// print details
if ($row)
{
?>
        <p>
        <b><? echo $row->slug; ?></b>
        <p>
        <font size="-1"><? echo nl2br($row->content); ?></font>
        <p>
        <font size="-2">This press release was published on <? echo
formatDate($row->timestamp); ?>. For more information, please contact
<? echo $row->contact; ?></font>
<?
}
else
{
?>
        <p>
        <font size="-1">That press release could not be located in our
database.</font>
<?
}
--------------------------------------------------------
the else block is always executed.  i have used mysql> and verified
that there is stuff in the table.  i inserted <? echo $result; ?> into
the else block.  curiously, it always printed "Resource id #2", even
when this url was used:
--------------------------------------------------------
http://127.0.0.1/test/user/story.php?id=1
--------------------------------------------------------

it doesn't seem likely that this is a bug, but hoped someone could
easily make some suggestions for troubleshooting this.  i'm very new at
this and didn't know where else to go :)

i'm using php4 and mysql 4.0.1 distributed for windows in foxserv.


Previous Comments:
------------------------------------------------------------------------

[2001-10-05 23:38:14] [EMAIL PROTECTED]

it dosen't return any record when i use mysql_fetch_object to fetch
result! 

$UserName1=$HTTP_POST_VARS["UserName"];
$PassWd1=$HTTP_POST_VARS["Passwd"];

$rst_CommandText="select Passwd,OSKEY from admin where UserName='" .
$UserName1 . "'";
$result =
mysql_db_query("myforum",$rst_CommandText,$rst_ActiveConnection);
echo mysql_result($result,0,"Passwd");  //work correctly!
$rows = mysql_fetch_object($result);
echo $rows->Passwd;                     //but it dosen't work!!! 

------------------------------------------------------------------------

[2001-10-05 06:38:20] [EMAIL PROTECTED]

not enough info. read bugs-dos-and-donts.php

------------------------------------------------------------------------

[2001-10-05 06:33:07] [EMAIL PROTECTED]

it dosen't return any record when i use mysql_fetch_object to fetch
result! 

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=13560&edit=1

Reply via email to