Jump to content

Is there a way to print to the browser from a mysql query?


shedokan

Recommended Posts

Is there a way to print to the browser from a mysql query?

 

I heard that on the mysql command line you can do:

mysql> print "something"

 

so is there a way to do it from mysql, so i don't have to get a mysql array and echo it?

 

thanks.

 

The MySQL command line won't do that for you.  Think of it as similar to the Windows command prompt or the Linux terminal.  MySQL is just like any other language, verbal (English, French) or computer (PHP, C++).  You have to learn the language to use its functionality, there's no shortcut.

I'm not asking for a shortcut, I am asking for a different way of doing something.

To my knowledge, there's no "easier" way to do this.

Basically, you have to:

1) Get and choose the data from the database (which you did using a MySQL query)

2) Format your data so that PHP can handle it (which you did by saving only the first row into a variable)

2) Output the data into a presentable format (which you did by echo'ing)

 

If you're looking for alternatives though, you may want to look at mysql_fetch_assoc() or mysql_fetch_row().

Please further clarify your question if it wasn't answered.

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.