Jump to content


Design by codeing - need help!


3 replies to this topic

#1 Nehle_wolf

    Young Padawan

  • Members
  • Pip
  • 13 posts

Posted 15 July 2006 - 08:06 PM

uhhh, ive been stressing over this for months and I need help.

Its, my gallery for my new website. What happens is, the php file connects to a mysql database, and selects all the querys that have the authors name from a row, and displays information, which then displays the photo.

Now my asking of help isnt about the php, but mearly the HTML.

When the tables are printed by the php code, they look all ugly like this: (this is honestly the best I could do with them):
http://www.washingto...s/other/123.jpg

but I want the query to be displayed like this:
http://www.washingto...s/other/223.jpg

I honestly dont know what to do about this. Ive tried everything - divs, floats, tables but I cant get it to work!

Here is the code for when the query is activated:
if($gallery){

$query = "SELECT *
FROM `pictures`
WHERE `author` LIKE '%{$gallery}%'
COLLATE latin1_swedish_ci
LIMIT 0 , 8";

$result = mysql_query($query) or die(mysql_error());

echo('<table cellspacing="1">');
while($r = mysql_fetch_array($result)){


$titlea = $r["title"];
$authora = $r["author"];
$datesqla = $r["uploaddate"];
$keywordsa = $r["keywords"];
$discriptiona = $r["discription"];
$equipmenta = $r["equipment"];
$pathimga = $r["path"];
$paththumba = $r["thumb"];
$thumbimga = $r["thumb"];
$downloadsa = $r["downloads"];
$ida= $r["mid"];

echo ('<tr>
<td class="general" height="225" width="464"><center>
<a href="download.php?id='.$ida.'" target="_blank">
<img src="'.$thumbimga.'" title="'.$titlea.', By '.$authora.'" border="0"><br>
<a href="download.php?id='.$ida.'" target="_blank"><b>#'.$ida.'</b>
</a> 
<a href="download.php?id='.$ida.'" target="_blank">Download</a>
</td>
<td class="general"width="300" >

<b>'.$titlea.'</b><br>
<font class="gsecond">'.$discriptiona.'</font><br>

Uploaded by <a href="http://www.washingtonphoto.org/member/memberlist.php?id=view&user='.$authora.'">'.$authora.'</a><br>
on '.$datesqla.'<p>

Using: '.$equipmenta.'<br>

<b>'.$titleb.'</b> has been downloaded '.$downloadsa.' times.
</td>
</tr>
'); 

}
echo('</table>');
}

-yes I coded that myself, sorry about the crappyness

Please help me!

~Nehle!~

#2 Matthew.

    Official Spammer .Matt

  • Members
  • PipPipPipPip
  • 2,749 posts
  • Gender:Male
  • Location:England

Posted 15 July 2006 - 08:25 PM

Ok, its too late for me to be arsed able to change your code, but i can give you an example of what you may wish to try.

#  ..... code....

echo '<table border="0">';

$i = 1;

while( $r = mysql_fetch_array($result) )
{
	echo ($i == 1) ? '<tr>' : '';
	echo '<td>Your image/text here</td>';
	echo ($i == 4) ? '</tr>' : '';
	
	$i ($i == 4) ? '1' : $i++;
}

echo '</table>';

This will parse the data through a table with 4 cells in each row and a new row after the 4 cells (if that makes sense lol!)

EDIT: I have put up an example for you: http://mediascratch.uni.cc/p2ltest.php

Hopefully you know enough basic html/css to style the tables to how you want them :love: It could be done with divs and normally i would but its impractical....and its 2:30am :o

Edited by .Matt, 15 July 2006 - 08:30 PM.


#3 Nehle_wolf

    Young Padawan

  • Members
  • Pip
  • 13 posts

Posted 15 July 2006 - 11:31 PM

wow m8,
thank you sooo much!

#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 16 July 2006 - 02:13 AM

Well, i'm glad to see this was solved so fast, honestly, i like Matt's example better then the one i'm about to post, but i'll post it anyway.

Simply put, this question has been asked before, i almost couldn't remmeber what to search for to find it, but as this topic has been solved anyway, i'll take the liberty of closing it on those ground rather then the usual "FAQ" reason.
http://www.pixel2life.com/forums/index.php...327&hl=rows

Edit: Re-opened

Edited by rc69, 17 July 2006 - 01:22 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users