Getting first element from PDOStatement

I am performing an sql query using PDO. In the resulting PDOStatement, there is only one column. If i use PDOStatement->fetch(); would it serve my purpose?


Yes, although fetchColumn() would probably be more convenient as the return value will be scalar.

echo $stmt->fetchColumn();

otherwise you could do the following, or many variations of

$row = $stmt->fetch(PDO::FETCH_NUM);
echo $row[0];

Need Your Help

How to remove the value from this NSDictionary?

ios nsdictionary

Hello everyone i have a dictionary value when i nslog returns the following below :

post variable in mysql query

php mysql

I'd like to use the post variable value in my sql query to sort data in order chosen by a user. The table gets displayed correctly with appropriate fields but the values are not sorted.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.