Solved

position x  position y   (positioning myself for echo)

Posted on 2002-05-04
4
187 Views
Last Modified: 2012-05-04
Hi,

I want to echo the reslut of an sql query to a certain
area of my page.  Anybody knows how;

I have a webpage with a few buttons to press on left
hand side.
So what I want is to post the result of my sql query
besides the buttons.
Am just lurning the language so need all the help I can get
and what better place than here;


thanks
0
Comment
Question by:jerbell
4 Comments
 
LVL 2

Expert Comment

by:jpoesen
ID: 6990131
<?$query = "SELECT * FROM TblWhatever"

while ($RecSet = mysql_fetch_object($query)){
?>
 <b>fieldname1</b> : <?=$RecSet->Fieldname1?>
 <b>fieldname2</b> : <?=$RecSet->Fieldname2?>
 <b>fieldname3</b> : <?=$RecSet->Fieldname3?>
<?}?>

is this what you were looking for?

0
 
LVL 4

Expert Comment

by:lokeshv
ID: 6990177
ur complete  page..

<?

$qid=mysql_query("select * from urtable");
?>

<html>
<body>
<table width=100% align=center>
<?while($row=mysql_fetch_array($qid)){?>
<tr><td><?=$row[field1]?></td>
<td><?=$row[field2]?></td>   //and so on
</tr>
<?}?>
</table
</body>
</html>
0
 

Author Comment

by:jerbell
ID: 6991191
Sorry was late,
No it's not what I meant.
The code above will print out the result of an sql
under my button(gif)
I want the table to appear at the right of my button and not bellow.  Not even sure if it's possible
I want to be able to output the result at a certain x,y position on my web page.
Or at least to put the result on the right hand side of 3 picture buttons.

example of what I want

[]   result of sql
[]   result of sql  
[]   result of sql

This is what is happening that I don't want

[]
[]
[]
    result of sql
    result of sql
    result of sql
0
 
LVL 1

Accepted Solution

by:
Rajko earned 100 total points
ID: 6995658
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<?php
include "database.inc.php";
$sql = "select * from test";
$result = mysql_query($sql,$db);
while($row = mysql_fetch_array($result)){
  $innerHTML .= $row['id']."<br />";
}
?>
<form action="<?php $PHP_SELF?>" name="button">
 <table>
  <tr>
   <td valign="top"><input type="submit" name="button1"></td><td><div id="button1_layer" class="b1"><?php if(isset($button1)): echo $innerHTML; endif;?></div></td>
  </tr>
 </table>
</form>
</BODY>
</HTML>

have fun.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now