Click to See Complete Forum and Search --> : My Art Display


mabans
01-06-2004, 08:02 PM
Now this works but for some reason it gives me a weird display near the bottom of the page. you can see by following this link.

http://69.13.156.225/test/includes/main_stage_items/results/poster_thumbs.php?show_cat=1

I do plan on have the overall display to be in 2 columns as well as breaking it up into different pages. I do want to see if my overall technique is well done as well as some input on why I'm getting an odd display at the bottome. thanks in avance.




<?php

//The Required Files to access the data base
require("../../../includes/configs/config.cfg");
require("../../../includes/configs/select_db.cfg");
//The Required Files to access the data base

$show=$_GET['show_cat'];

$sql = "SELECT * FROM `poster` WHERE category=$show ORDER BY 'code' ASC";

$results = mysql_query($sql) or die ("Could not do, what you ask of me, sorry man. Check your Code!");

while ($results_row = mysql_fetch_array($results))
{
extract($results_row);

// This display the image artwork//
echo "<table cellspacing=5 cellpadding=0 border=0 width=100%>"
."<tr>"
."<td align=left valign=top width=35>"
."<a href=full_view.php?show_cat="
.$results_row['ID']
.">"
."<br><img src=../../../images/"
.$results_row['imagethumb']
.">"
."</a></td>"
// This display the image artwork//

."<td align=left valign=top height=167>"

// This is the information table with all the proper artwork info//
."<table cellpadding=2 cellspacing=0 border=0 height=136 width=100%>"
."<tr>"
."<td>"

// This is the art Item Code //
."<div class=unnamed1>"
."<a href=full_view.php?show_cat="
.$results_row['ID']
.">"
.$results_row['code']
."</a>"
."</td>"
."</tr>"
// This is the art Item Code //

// This is the Artwork Name //

."<tr>"
."<td bgcolor=#eaeaea>"
."<div class=unnamed1><font color=#000000>"
.$results_row['postername']
."</font></div>"
."</td>"
."</tr>";

// This is the Artwork Name //





// This is the Artist Name //

$artist_id=$results_row['artist'];

$artist_sql = "SELECT * FROM `artist` WHERE ID=$artist";

$artist_results = mysql_query($artist_sql) or die ("Could not do, what you ask of me, sorry man. Check your Code!");
while ($artist_row = mysql_fetch_array($artist_results))
{
extract($artist_row);

echo "<tr>"
."<td>"
."<div class=unnamed1>"
.$artist_row['artistname']
.$artist_row['artistlastname']
."</font></div>"
."</td>"
."</tr>"

// This is the Artist Name //

// Poster Size Text //

."<tr>"
."<td>"
."<div class=unnamed1>Paper Size:</div>"
."</td>"
."</tr>"

// Poster Size Text //

// Paper Size Info//

."<tr>"
."<td>"
."<div class=unnamed1>"
.$results_row['papersizeincheswt']
." x "
.$results_row['papersizeinchesht']
." In | "
.$results_row['papersizecmwt']
." x "
.$results_row['papersizecmht']
." Cm"
."</div>"
."</td>"
."</tr>"

// Paper Size Info//

// Image Size Text //

."<tr>"
."<td>"
."<div class=unnamed1>Image Size:</div>"
."</td>"
."</tr>"

// Image Size Text //

// Image Size Info//

."<tr>"
."<td>"
."<div class=unnamed1>"
.$results_row['imagesizeincheswt']
." x "
.$results_row['imagesizeinchesht']
." In | "
.$results_row['imagesizecmwt']
." x "
.$results_row['imagesizecmht']
." Cm"
."</div>"
."</td>"
."</tr>"

// Image Size Info//

// Pricing Info //

."<tr>"
."<td>"
."<div class=unnamed1>"
."$"
.$results_row['price']
."</div>"
."</td>"
."</tr>"
// Pricing Info //
."</td>"
."</tr>"
."</table>"
."</td>"
."</tr>"
."</table>";


// This is the information table with all the proper artwork info//

}
}
?>

LordShryku
01-06-2004, 08:12 PM
Debugging becomes pretty much impossible when you have that much page, and all of the html is on one line. View the source of your rendered page. It's not pretty....

mabans
01-06-2004, 08:54 PM
In that case I have limited the results to 30.

review here: http://69.13.156.225/test/includes/main_stage_items/results/poster_thumbs.php?show_cat=1


$sql_=_"SELECT_*_FROM_`poster`_WHERE_category=$show_ORDER_BY_'code'_ASC LIMIT 30";


This seems to be the place where things go all crazy. I am looking into the HTML as we speak. But I am still willing to listen to Critiques on my coding style.

mabans
01-06-2004, 08:55 PM
Yikes! I see your point.. :eek: :eek: :eek:

I have somewhat corrected the issue but I do see some problems with my table postioning

LordShryku
01-06-2004, 09:54 PM
I'm writing a version of the code you posted somewhat like I would do it, but a couple things I'll comment on:

You call extract after your mysql_fetch_array's, but I don't see you using it. If your not going to use it, no real reason to have it.

Your html attributes should be quoted. It'll save you a headache later on when you go to put a space in there and can't figure out why it only shows the first word.

Once I get done, I'll post the code....

LordShryku
01-06-2004, 10:06 PM
Ok, here it is: posted and attached (in case the post looks like crap). You see I break out of php to do the html. Even within a loop, this will still work, and it will produce nice, easy to read rendered source code. We had a thread about this a while ago that dalecosp started, and at the time, I never did this sort of thing. Since then, I've become a real stickler with how my rendered code looks, mainly for this reason of debugging. Plus, I'm just an anal bastard. Hope this helps give you some ideas. Also, I removed you're comments so mine would stick out to you.
<?php
require_once("../../../includes/configs/config.cfg");
require_once("../../../includes/configs/select_db.cfg");
## require_once allows it to be called later without error
$show=$_GET['show_cat'];
$sql = "SELECT *
FROM `poster`
WHERE category=".$show."
ORDER BY 'code' ASC";
## I prefer to break out of strings with "." when calling a variable
$results = mysql_query($sql) or die(mysql_error());
## mysql_error will give a more detailed error of the problem

while($results_row = mysql_fetch_array($results)) {
extract($results_row);
?>
<table cellspacing="5" cellpadding="0" border="0" width="100%">
<tr>
<td align="left" valign="top" width="35"><a href="full_view.php?show_cat=<?php echo $results_row['ID']; ?>">
<br /><img src=../../../images/<?php echo $results_row['imagethumb']; ?>"></a>
</td>
<td align="left" valign="top" height="167">
<table cellpadding="2" cellspacing="0" border="0" height="136" width="100%">
<tr>
<td><div class=unnamed1><a href="full_view.php?show_cat=<?php echo $results_row['ID']; ?>"><?php echo $results_row['code']; ?></a></td>
</tr>
<tr>
<td bgcolor="#eaeaea"><div class="unnamed1"><font color="#000000"><?php echo $results_row['postername']; ?></font></div></td>
</tr>
<?php
$artist_id=$results_row['artist'];
$artist_sql = "SELECT *
FROM `artist`
WHERE ID=".$artist;

$artist_results = mysql_query($artist_sql) or die(mysql_error());
while($artist_row = mysql_fetch_array($artist_results)) {
extract($artist_row);
?>
<tr>
<td><div class="unnamed1"><?php echo $artist_row['artistname']." ".$artist_row['artistlastname']; ?></div></td>
</tr>
<tr>
<td><div class="unnamed1">Paper Size:</div></td>
</tr>
<tr>
<td><div class="unnamed1"><?php echo $results_row['papersizeincheswt']." x "
.$results_row['papersizeinchesht']." In | "
.$results_row['papersizecmwt']." x "
.$results_row['papersizecmht']." Cm"; ?>
</div>
</td>
</tr>
<tr>
<td><div class="unnamed1">Image Size:</div></td>
</tr>
<tr>
<td><div class="unnamed1"><?php echo $results_row['imagesizeincheswt']." x "
.$results_row['imagesizeinchesht']." In | "
.$results_row['imagesizecmwt']." x "
.$results_row['imagesizecmht']." Cm"; ?>
</div>
</td>
</tr>
<tr>
<td><div class="unnamed1">$<?php echo $results_row['price']; ?></div></td>
</tr>
</table>
</td>
</tr>
</table>"
<?php
}
}
?>

mabans
01-07-2004, 01:36 AM
Seems a lot neater and leaner. Means faster load times. Gotta love that. I tried it and I got a PArse error 6. Debugging now to see if it'll work.

mabans
01-07-2004, 02:04 AM
I also tried to see what you were talking about with the extracting the Fetch Array but the script doesn't seem to work if I don't include it in t he code. Is there another leaner way I can approach it?

Also thanks for all your input it's really cool your helping me out..

mabans
01-07-2004, 02:12 AM
It seemed to be some odd Charact Insertsion that I got when I just copied and pasted it. it worked fine sorry.

mabans
01-07-2004, 04:33 PM
To expand on what you were doing. I'm working on a method so I can get these results but in a 2 column view. So far I see my method being the best way to go.

This is how it's shaping up. I also took your advice about the whole extracting rows issue. so that is now gone.

here's the link: http://69.13.156.225/test/includes/main_stage_items/results/thumbs.php?show_cat=1


<?PHP
//The Required Files to access the data base
require("../../../includes/configs/config.cfg");
require("../../../includes/configs/select_db.cfg");
//The Required Files to access the data base

$columns = 2;

$show=$_GET['show_cat'];

$query = "SELECT * FROM `poster` WHERE category=".$show ." ORDER BY 'code' ASC LIMIT 60";

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

$num_rows = mysql_num_rows($result);

echo "<TABLE BORDER=\"0\" WIDTH=q\"500\">\n";

for($i = 0; $i < $num_rows; $i++) {

$poster = mysql_fetch_array($result);

if($i % $columns == 0) {

echo "<TR>\n";

}

echo "<TD>"

.$poster['code']

// This display the image artwork//
."<!---- This display the image artwork--->\n"
."<table cellspacing=5 cellpadding=0 border=0 width=100%>\n"
."<tr>\n"
."<td align=left valign=top width=35>\n"
."<a href=full_view.php?show_cat="
.$poster['ID']
.">\n"
."<br>\n<img src=../../../images/"
.$poster['imagethumb']
.">\n"
."</a>\n</td>\n"
."</tr></table>"
."<!---- This display the image artwork--->\n"
// This display the image artwork //

."</TD>\n";

if(($i % $columns) == ($columns - 1) || ($i + 1) == $num_rows) {

echo "</TR>\n";

}
}
echo "</TABLE>\n";
?>