开发者

SQL not returning any records

I have an weird issue, I am running the following SQL statement:

SELECT * FROM tbl_statement_items;

or

SELECT * FROM `tbl_statement_items`;

The table 'tbl_statement_items' contains 28 records, however when I run the command above its showing 0 results found.

However when I run it through phpmyadmin it displays all the records: (it appends a limit).

SELECT * FROM  `tbl_statement_items` WHERE 1 LIMIT 0 , 30

Am I missin开发者_Go百科g something simple here or has anyone else experienced this?

Thanks in advance.


Since the issue is likely the method in which you are querying your data, make sure of the following (these examples apply to PHP):

// Your connection to the database is properly set up
$con = mysql_connect($hostname, $username, $password) or exit;
mysql_select_db( $dbName, $con );

// You are storing your query in a variable to be processed
$result = mysql_query('SELECT * FROM tbl_statement_items');

// And you are using the appropriate functions to extract your content
while ($resultArray = mysql_fetch_assoc($result)) {
    foreach ($resultArray as $record) {
        // Yada yada yada...
    }
}

This of course is not all encompassing and your issue could be a number of other things, but why not start by double checking the fundamentals, right?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜