Forum Moderators: coopster
Maybe you can help me:
1. Put the pictures in the database;
2. Display the pictures from the database;
Also, where would I put the pictures? Should the images be in the same directory as the php file or I have to specify in the database where it is coming from? Or does it work like Access wherein you can store the image together with the table?
The tutorial has something like:
// Display them to the screen...
echo "<a href=\"" . $row["link"] . "\">
<img src=\"" . $row["image"] . "\" border=0 alt=\"" . $row["text"] . "\">
</a>" ;
Where can I get an explanation for this? Can you please point me? It would be a big help. Thanks.
>>The tutorial has something like:
It is amazing how quite a few tutorials use rather bad codeing style. Who is supposed to understand this example. I havenīt got a clue and cannot be bothered to figure out which double quotes are actual string delitimers and which ones arenīt. Why do they use the concatenation operator when echo [php.net] will happily accept a list of strings?
echo "<a href=\"" . $row["link"] . "\">
<img src=\"" . $row["image"] . "\" border=0 alt=\"" . $row["text"] . "\">
</a>" ;
should be written as
echo <<<END_OF_IMAGE
<a href="{$row["link"]}">
<img src="{$row["image"]}" border=0 alt="{$row["text"]}">
</a>
END_OF_IMAGE;
Now that is easy to read and understand. Even
echo <<<END_OF_IMAGE
<a href="$row[link]}">
<img src="$row[image]" border=0 alt="$row[text]">
</a>
END_OF_IMAGE;
would have been ok although it is not as good as the former example.
>>Also, where would I put the pictures?
You can put the whole picture into a BLOB [mysql.com] or just store the image path in the db and move the pictures to some directory as the example script in the Bag-O-Tricks for PHP II - some code snippets that should be helpful for all in creating dynamic sites [webmasterworld.com] does.
Andreas