Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 27th, 2004, 07:27 AM
Authorized User
 
Join Date: Jan 2004
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Ashleek007
Default displaying items from a database??

while($row = mysql_fetch_array($result,MYSQL_ASSOC))
 {
 $image= $row[image];
 ?>
 <tr>
 <td height="24"> <div align="center"> <img src="<?php echo $image; ?>" > </div></td>
 <td><div align="center"><? $row[title]; ?></div></td>
 <td><div align="center"><? $row[startPrice]; ?></div></td>
 </tr>
 <?
 }
 ?>

Ive got a database linked to this table, it displays the first field(image) fine, but doesnt show the next two entries (title and startPrice), any ideas why?

it displays the php code in the correct place in dreamweaver but when i upload to my site and try to view it, only the picture shows up?!

any ideas whats my problem will be appreciated!

NIC OR RICH I NEED YOU!!!hehe!

CHEERS
ASH

__________________
My new web design domain
www.askmultimedia.co.uk
 
Old April 27th, 2004, 07:37 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

lol, you've neglected to echo the value..

Try
<?php echo $row['title']; ?>
<?php echo $row['startPrice']; ?>
;)

Regards,
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::
 
Old April 27th, 2004, 08:09 AM
Authorized User
 
Join Date: Jan 2004
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Ashleek007
Default

oh my word, i feel utterly stupid!!haha

i think it must be the hours of programming ive done today has pickled my brain!!

cheers rich,
ASH:D

 
Old April 27th, 2004, 06:05 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It's not a huge error. PHP uses a "shortcut" notation to echoing values. If you would've used an = sign, it would've worked.

Personally, I HATE this shortcut notation. But here it is anyway:

<?=$var;?>

More examples:
<?= $row['title']; ?>
<?= $row['startPrice']; ?>


Look at the echo docs for more info:
  http://www.php.net/echo


Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying items in Colums in roes azambee Access 4 January 5th, 2007 04:57 AM
Help, trying to fill grid w/database items itsajourney ADO.NET 1 May 24th, 2005 10:57 PM
Combo box items not displaying djam C# 3 March 22nd, 2005 04:13 AM
Listing and limiting items from a database RPG SEARCH ASP.NET 1.0 and 1.1 Basics 11 August 3rd, 2004 04:37 PM
displaying 6 items only having 20 items Lakshmi KS VB Components 1 February 17th, 2004 10:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.