Ok, let see if I can explain.
I have a query from my db which inserts id of the inputted objects. The result is in a string which I use to show the content. In one of the sql tables, there are path names to images. One id can have up to 3 images assigned which gives 3 path names. But here is the catch, I only want to display the first path name. My query looks like this:
My code for the output looks like this:
bildpath is the path name for the image.
I'm not a programmer by all means and I have been struggling to learn. Hopefully someone can help me with this?
Best regards,
Morgan
I have a query from my db which inserts id of the inputted objects. The result is in a string which I use to show the content. In one of the sql tables, there are path names to images. One id can have up to 3 images assigned which gives 3 path names. But here is the catch, I only want to display the first path name. My query looks like this:
Code:
$data = "
SELECT
a.annonsid,
a.datum,
a.datumtid,
a.lan,
a.radio1,
a.rubrik,
a.stad,
a.pris,
a.typ,
a.kategori,
b.annonsid,
b.bildpath
FROM
annonser AS a
LEFT JOIN
annonser_bilder AS b
ON
a.annonsid=b.annonsid
WHERE
a.kontrollerad = 'ja'
$sokord
LIMIT
$offset, $antal_bilder";
$query = mysql_query($data);
$no=1;
while ($templista = mysql_fetch_array($query))
{
Code:
if($templista[bildpath])
{
echo "</td>";
echo "<td width=\"60\" height=\"30\">";
echo "<a href=\"?annonsID=".$templista[annonsid]."\">";
$size = getimagesize($templista[bildpath]);
I'm not a programmer by all means and I have been struggling to learn. Hopefully someone can help me with this?
Best regards,
Morgan
Comment