Current location: Hot Scripts Forums » Programming Languages » PHP » PHP results in HTML


PHP results in HTML

Reply
  #1 (permalink)  
Old 06-25-04, 04:19 PM
bayside bayside is offline
Newbie Coder
 
Join Date: Jun 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
PHP results in HTML

Iam new to PHP and SQL so forgive my ignorance - have to start somewhere!

Iam experimenting with a script that can be used on an art gallery site. I can pull specific thumbnails based on artist from the database, but can not configure HTML to show results using colspan.

Effectively I need to output 3 columns, 5 deep - here is what I have that spits out one vertical column!

Any reference to a good source for HTML presentation of PHP would really help!

Dave
--------------------------------------------------------------------

<?PHP
if(mysql_connect('localhost', 'root', 'password' )){
print("Welcome To Syd Entel Galleries");
}else{
print("connection failed");
}



if (! @mysql_select_db( 'SydEntelArtwork' ) ) {
die( '<p>Unable to locate the Artwork ' .
'Database at this time.</p>' );
}

?>

<p> Here are works by Anton Arkhipov</p>

<?php

$result = @mysql_query(
'SELECT ArtThumb
FROM Artwork
WHERE AID=1' );

if (!$result) {
die( '<p>Error performing query: ' . mysql_error() .
'</p>' );
}
while ( $row = mysql_fetch_array($result) ) {
echo( '<p>' . $row[ 'ArtThumb' ] . '</p>' );
}

?>
Reply With Quote
  #2 (permalink)  
Old 06-25-04, 11:26 PM
Lost Lost is offline
Wannabe Coder
 
Join Date: Mar 2004
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Are you trying to output the art gallery in an HTML table?
Reply With Quote
  #3 (permalink)  
Old 06-26-04, 06:32 AM
bayside bayside is offline
Newbie Coder
 
Join Date: Jun 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Lost
Are you trying to output the art gallery in an HTML table?
Yes, and place the results in the following configuration:

<table>
<tr>
<td colspan=4 align=center valign=bottom>
[rresult 1]</td>
<td>[result 2]</td>
<td>[result 3]</td>
<td>[result 4]</td></tr>
<tr>

<---This should repeat the above until all pix are shown--->

The other way I could display would be in 4 columns if that would be easier to configure.

Thanks for any help you can provide!
Reply With Quote
  #4 (permalink)  
Old 06-26-04, 11:13 AM
Lost Lost is offline
Wannabe Coder
 
Join Date: Mar 2004
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Try this...


<?php

$dbhost = "localhost";
$dbuser = "dbuser";
$dbpass = "dbpass";
$dbname = "dbname";

mysql_connect($dbhost,$dbuser,$dbpass) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());

echo "Welcome To Syd Entel Galleries<br><p>Here are works by Anton Arkhipov</p>";

$artthumbs = mysql_query("select ArtThumb from Artwork where aid='1'") or die(mysql_error());

$i = 0;
echo "<table><tr>";
while($thumb=mysql_fetch_array($artthumbs))
{
$i++;
echo "<td>$thumb[ArtThumb]</td>";
if($i%4 == 0)
{
echo "</tr><tr>";
}
}
echo "</tr></table>";

?>
Reply With Quote
  #5 (permalink)  
Old 06-26-04, 01:08 PM
bayside bayside is offline
Newbie Coder
 
Join Date: Jun 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
[QUOTE=Lost]Try this...

That worked great!
All I need to do is mess around with the table widths and spacing within this, but otherwise it worked!

Many thanks! Do you know of anywhere I can find html contend structure like this for PHP??

Dave
Reply With Quote
  #6 (permalink)  
Old 06-26-04, 01:29 PM
bayside bayside is offline
Newbie Coder
 
Join Date: Jun 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
[QUOTE=Lost]Try this...


Here's what I have managed to produce thus far:

http://sydentelgalleries.com/test.php

Now the big question!! How do I add a name for each image and create a link for it as well?????

In HTML, here is what it shoud be.

http://sydentelgalleries.com/arkhipov.html
Reply With Quote
  #7 (permalink)  
Old 06-27-04, 10:31 PM
Lost Lost is offline
Wannabe Coder
 
Join Date: Mar 2004
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Hmmm...do you have a table in your database to store the artists? Or are you just remembering which 'aid' number goes to which artist?
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP in HTML Pages? ZeoFateX PHP 19 01-04-06 06:42 PM
Can anyone help me ? (problem using php variables in html db insert code) chronic_ PHP 2 06-13-04 11:19 AM
general question about php and html timfoster PHP 3 05-17-04 12:29 PM
HTML, ASP.NET, PHP Classes icu HTML/XHTML/XML 1 02-22-04 03:27 PM
help plz: format retrieved Mysql data in HTML with PHP paulj000 PHP 2 10-19-03 08:03 PM


All times are GMT -5. The time now is 05:06 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.