echo $rows help


Posted on 16th Feb 2014 07:03 pm by admin

Hi all,

Hopefully something simple that I don't know!

I have this:

Code: [Select]<div id="marquee">


<?php
$query = mysql_query("SELECT stock_id, stock_code, t_val, y_val FROM stocks");
while($rows=mysql_fetch_array($query))
{
$stock_code = $rows['stock_code'];
$t_val = $rows['t_val'];
$y_val = $rows['y_val'];
$stock_id = $rows['stock_id'];

echo "<marquee>";
echo "<span style='color:#09F'>$stock_code</span>";
echo "&nbsp;";
echo "<span style='color:#0F0'>Todays Price = $t_val</span>";
echo "&nbsp;";
echo "<span style='color:#F00'>Yesterdays Price = $y_val</span>";
echo "</marquee>";
}

?>Which simply displays the output of a database in a scrolling marquee, which almost works! However the problem I have is that it displays like this:

ROW1
ROW2

How can I make it display like this:

ROW1 ROW2

Many thanks

No comments posted yet

Your Answer:

Login to answer
129 Like 28 Dislike
Previous forums Next forums
Other forums

If a form submits back to same page do you need to use $get
IM trying to pass page number and year that was selected back to the same page.

i have this c

Mysterious Timeouts
I've deployed a few simple AJAX-enabled web page to a local server that is accessed through the Inte

PHP header help!
Hi all I am trying to get this php page to refresh every 5 seconds on my phone which is an aastra 48

losing session vars when arriving from an email link
Hi,

I've got a confirmation script made that sends an email with a link for a user to confirm

Mysql query, two times?
Hello to all,

I'm new to php coding and i like it alot. I need help with some noob stuff.

duplicate record notification
In my database, after insertion of records, I want to know if the record inserted is duplicate or no

Procedure with variable number of columns
Hi, I have a procedure that looks like this:

PROCEDURE PROC(p_cursor OUT sys_refcurso

JSON SORT WITH PHP
I have two products that I want to sort by say "Id:17, value: xxx" using php
The page w

Multi Dimensional Array Append
Hi Guys

I have a function that returns a multidimentional array eg

$result = functio

. and .. appearing instead of pictures
First of all, thanks very much for providing this forum. It is very much appreciated!

My son

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash