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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.