Solved

position x  position y   (positioning myself for echo)

Posted on 2002-05-04
4
195 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
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…

713 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