What’s wrong with this code?

The purpose is to output an image (banner) from a row in mysql. I am 100% sure banners exist in the $row['banner'] column.

PHP Code:


<?php

// Connect to database

$connection mysql_connect("localhost""duckster_admin""") or die("Could not connect to database");

// Select database

$db mysql_select_db("duckster_amp"$connection) or die ("Could not select database");

// mySQL connection
$query "SELECT * FROM amp_ads";

// Show all Records

$result mysql_query($query) or die("Query Failed: " mysql_error());

// Table code here //

while($row mysql_fetch_array($result));

{

//echo "<img src=\"$row[banner]\">";

echo "<img src=\"$row['banner']\">"// This code don't work, what will work?

}

mysql_close($connection);

?>


As the echo statement says, what will work?

Error message:

Code:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /server path/

EDIT:: THE banners in the db are structured like this: http://mydomain.com/banner.png

View full post on Tycoon Talk

, , ,

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wpburn.com wordpress themes


RSS Site FeedRSS Site Feed

© 1992-2011 DC2NET™, Inc. All Rights Reserved