Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 27th, 2004, 07:27 AM
Authorized User
 
Join Date: Jan 2004
Location: Manchester, , United Kingdom.
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
Reply With Quote
  #2 (permalink)  
Old April 27th, 2004, 07:37 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
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
::::::::::::::::::::::::::::::::::::::::::
Reply With Quote
  #3 (permalink)  
Old April 27th, 2004, 08:09 AM
Authorized User
 
Join Date: Jan 2004
Location: Manchester, , United Kingdom.
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

Reply With Quote
  #4 (permalink)  
Old April 27th, 2004, 06:05 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
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/
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:50 AM.


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