Redefine Row Name

Is it possible to redefine a rows name when I use SELECT in MySQL?

"SELECT AS the_post_id FROM posts"

So I can call it from PHP as:

$query = mysql_query("SELECT AS the_post_id FROM posts");

while($row = mysql_fetch_array($query)){
    // I call the ID with `the_post_id` and not `id`
    echo $row["the_post_id"]; 


Yes, you have already done it correctly. Are you having issues with that?


$query = mysql_query("SELECT AS the_post_id FROM posts") or die(mysql_error());

Try it like that and it would tell you if there is any issue with the query itself. Also i would suggest you look at the newer mysqli_* functions, mysql_* functions are history.

Need Your Help

Mocking with rspec and mocha together

ruby-on-rails rspec integration-testing mocha

For a test suite that's already using mocha for mocking, can new tests be written with rspec mocking? maybe turn that on before(:all) and turn it back to mocha after(:all)

MPMoviePlayerController play video second time

iphone objective-c video mpmovieplayer

I need to have the possibility to play more than one video in an app.

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.