Jump to content

View as html


killerbud99

Recommended Posts

Hello, I am asking a question refering to this on the main page [url=http://www.phpfreaks.com/tutorials/142/0.php]http://www.phpfreaks.com/tutorials/142/0.php[/url]

I want to view the output of a sql as html or php as so it can be viewed as such not as a list
[code]      // echo out the results to the screen
  while ($list = mysql_fetch_array($result)) {
      echo "{$list['image_url']} <br>";
  } // end while[/code]

Also I would like to pull more info not just the ['image_url'] can this be done?

Thanks in advance  :)
Link to comment
Share on other sites

[quote author=killerbud99 link=topic=111551.msg452101#msg452101 date=1160918214]
Hello, I am asking a question refering to this on the main page [url=http://www.phpfreaks.com/tutorials/142/0.php]http://www.phpfreaks.com/tutorials/142/0.php[/url]

I want to view the output of a sql as html or php as so it can be viewed as such not as a list
[code]      // echo out the results to the screen
  while ($list = mysql_fetch_array($result)) {
      echo "{$list['image_url']} <br>";
  } // end while[/code]

Also I would like to pull more info not just the ['image_url'] can this be done?

Thanks in advance  :)
[/quote]
Currently the query you use only returns one field. If you wnat all fields returned then use this as the query:
[code]$sql = "select * from testTable"; [/code]
The astricks (*) means all so now your query selects everything in the table called testTable.

Now in the while loop. The variable $list holds an array of each field for each row returned from the query you just ran. If you do not understand arrays then Id recommend you to learn up on arrays over at http://www.php.net/array also read up on the [url=http://php.net/mysql-fetch-array]mysql_fetch_array[/url] to help understand whats going on.
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.