Jump to content

Problem retrieving data


Lassie

Recommended Posts

I have a simple query and need to print the result.

My code does not print a resulr but the query is valid and returns a result.

Any help appreciated.

$query = ("SELECT * FROM wp_book WHERE Author_ID = '$Author_ID'");

            $result = mysql_query($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error());
            echo mysql_error();
            if (!$result) {
                echo "<br />";
                echo"No Result";
            }
            echo"Result";
            

            while($row = mysql_fetch_assoc($result)){
            
            echo $row['WorkingTitle'];

            }

Link to comment
https://forums.phpfreaks.com/topic/253559-problem-retrieving-data/
Share on other sites

That will determine if the query fails with an error. An empty result set is not a query failure, it's simply an empty results set. To determine if the query returns any results, you'd need to use mysql_num_rows.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.