473,830 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with gallery script I am writing

A
Hi everyone

I was working on a php script to display images and I am running into
problems. My problems are when I execute the query to thumb path it won't
display the image/s.

Anyhelp is alway's appreciated

I have a mysql table with the following structure

image_id Integer Auto_increment
title varchar
descript text
thumb_path varchar
imaage_path varchar
category_id Integer

and my script

<html>
<body>
<?php

$link = @mysql_connect( "localhost" , "myuser", "mypass");

if (!$link) {
print "Could not connect to server";
exit;
}

if (!@mysql_select _db("photos_db" )) {
print "Could not select database";
exit;
}

$query1 = "SELECT * FROM categories";
$query2 = "SELECT * FROM images ORDER BY image_id DESC";

$result1 = mysql_query($qu ery1);
$result2 = mysql_query($qu ery2);

?>

<table width="700" bgcolor="#CCCCC C">
<tr>
<td width="700" align="center" valign="middle" height="50">
<?php

if ($result1 && @mysql_num_rows ($result1) > 0) {
$data1 = "";
while ($row1 = mysql_fetch_arr ay($result1)) {

$data1 .= '<font color="black" size="14">';
$data1 .= $row1['category_descr iption'];

}
echo $data1;
}

?>
</td>
</tr>
<?php
//here is where I am running into problems
//it does not want to display the image even though I specify the path
if ($result2 && @mysql_num_rows ($result2) > 0) {
$data2 = "";
while ($row2 = mysql_fetch_arr ay($result2)) {
$data2 .= $row2['thumb_path'];
?>
<td><img src="<?php echo "$data2";?> "></td>

<?php
}
}
?>
</tr>

</table>

</body>
</html>
Jul 17 '05 #1
1 1470
A wrote:

I was working on a php script to display images and I am running into
problems. My problems are when I execute the query to thumb path it won't
display the image/s.

Anyhelp is alway's appreciated

I have a mysql table with the following structure

image_id Integer Auto_increment
title varchar
descript text
thumb_path varchar
imaage_path varchar
category_id Integer

and my script

<html>
<body>

<?php

$link = @mysql_connect( "localhost" , "myuser", "mypass");

if (!$link) {
print "Could not connect to server";
exit;
}

if (!@mysql_select _db("photos_db" )) {
print "Could not select database";
exit;
}

$query1 = "SELECT * FROM categories";
$query2 = "SELECT * FROM images ORDER BY image_id DESC";

$result1 = mysql_query($qu ery1);
$result2 = mysql_query($qu ery2);

?>

<table width="700" bgcolor="#CCCCC C">
<tr>
<td width="700" align="center" valign="middle" height="50">
<?php

if ($result1 && @mysql_num_rows ($result1) > 0) {
$data1 = "";
while ($row1 = mysql_fetch_arr ay($result1)) {

$data1 .= '<font color="black" size="14">';
$data1 .= $row1['category_descr iption'];

}
echo $data1;
}

?>
</td>
</tr>

<?php
//here is where I am running into problems
//it does not want to display the image even though I specify the path
if ($result2 && @mysql_num_rows ($result2) > 0) {
$data2 = "";
while ($row2 = mysql_fetch_arr ay($result2)) {
$data2 .= $row2['thumb_path'];

?>

<td><img src="<?php echo "$data2";?> "></td>

<?php
}
}
?>
</tr>

</table>

</body>
</html>


I could be wrong (I just looked at it quickly) but it looks like you're shoving
a bunch of thumb_paths for multiple images into a singe <IMG> tag without even
specifying an image name. Check the resulting html code. I'm guessing you get
something like:

<img src="images/thumbs/images/thumbs/images/thumbs">

If this is the case, include the image name in $data2 and don't use a while loop
to build data2. Use a while loop to write all your <IMG> tags.

Shawn
--
Shawn Wilson
sh***@glassgian t.com
http://www.glassgiant.com
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1802
by: Chris Shipley | last post by:
I am trying to present a list of links on a page (Form) where each link opens a different picture gallery. I have the Form page which contains the links, a Gallery page, and several include files. Each include file displays a different gallery. Clicking on a link submits a value identifying the chosen gallery to the Gallery page. The Gallery page accepts the value from the Form page and uses it to call the appropriate include file. The...
2
2335
by: Martin Brunner | last post by:
Hello! I tested several picture galleries now but I didn't find anyone I like. It should be very simple (just login and upload) but it should be able to rezise pictures. You specify a value for the max height and max width and depending if the hight or width is more the picture will be rezised so that it fits into the gallery thumnails even if it was taken 90° rotated.
5
3513
by: murrayatuptowngallery | last post by:
I'm caught in a classic finger-pointing situation. My hosting company's server appears to be automatically inserting JS tags into a JS-free html page that has an image inked to a 2nd page with JS. The problem may well be that I am calling JS incorrectly. My host co. insists my ''web publishing software' is doing this. I can prove it isn't by deleting the offending code with an impotent text editor like Notepad, upload it with a WS_FTP...
11
2162
by: shror | last post by:
hi every body I need help please i have designed an image gallery of about 20 pictures and they are shown in thumb nail views and for viewing the largeer version of the images i have added a radio button and a push button, so that the user choose the picture using the radio button and click on the push button to open the larger version picture in another window, but my problem is that i know how to pass the selection to the second page...
2
1508
by: adam87 | last post by:
Below is my code, what I have done is create a form which sends via asp, it works fine within IE but when testing it in Firefox the entire form is outside the page. Hope you can help! Adam Huxtable HTML FILE <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html;...
7
1835
by: MZ | last post by:
Hello, I have a webcam connected to the Internet. I can access the current static picture of the camera using an url link. It shows the picture with high resolution 1600x1200. I would like to have a batch program which will do what follows every some amount of time: 1. save the picture automatically on my local computer (which will be always running) 2. lower the resolution of the saved picture
13
1349
by: Effix | last post by:
Hi everybody I have yet another problem, actually two but lets start with this one :-) Im making a very simple gallery or at least I think its simple. I have already made a upload script that uploads and resizes the image and also creates a thumbnail. So now I have my folder "images/galleri/" and "images/galleri/thumbs". Now its time to dynamically display the images on a page. I have set the $filename variable to display the thumbnails...
2
2478
by: kirstenkirsche | last post by:
Hi guys.... i know this question has been asked already and I found a few answers but it would be soo great if anyone could help me with this script, which just browses images on a webpage in an image folder on a server. the script so far is working (a friend gave it to me): http://dev.perfectday.gb.com/tom/chiaraweb/photo.php the number on the images are the filenames. I want to order the images by filenames. the only thing is the...
2
2315
anfetienne
by: anfetienne | last post by:
hi, i've got a flash gallery which i've paid for. Im using swf object to import vars to the gallery....the var being imported is a html address to specify the location of files and folders. The problem is that the gallery detects the thumbnails and loads the 1st image but once i click on another image it wont load, i don't know why it it doing this and as it loads the thumbnails which are in the same location it shouldn't have a problem...
0
9793
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10774
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10491
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10206
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7746
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5617
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3076
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.