PDA

View Full Version : Why does only one of my records get displayed?


woofy
07-01-2008, 07:26 PM
I am trying to display images that have been sucessfully uploaded to my database. I am getting the image however when I attempt to display them in a table only the first one shows up. I can't figure any reason for this, this is the code that I have for the table.

<td height="257"><img src="/comimages/uploaded/<?php echo $row_Recordset2['page_1']; ?> "width="200" height="250" /></td>
<td height="257"><img src="/comimages/uploaded/<?php echo $row_Recordset3['page_2']; ?> "width="200" height="250" /></td> <td height="257"><img src="/comimages/uploaded/<?php echo $row_Recordset2['page_3']; ?> "width="200" height="250" /></td>

also the code for retrieving the files is...

mysql_select_db($database_con2com, $con2com);
$query_Recordset2 = sprintf("SELECT * FROM uploads WHERE username = %s", GetSQLValueString($colname_Recordset2, "text"));
$Recordset2 = mysql_query($query_Recordset2, $con2com) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
$colname_Recordset3 = "-1";
if (isset($_SESSION['username'])) {
$colname_Recordset3 = (get_magic_quotes_gpc()) ? $_SESSION['username'] : addslashes($_SESSION['username']);
}
mysql_select_db($database_con2com, $con2com);
$query_Recordset3 = sprintf("SELECT * FROM uploads WHERE username = %s", GetSQLValueString($colname_Recordset3, "text"));
$Recordset3 = mysql_query($query_Recordset3, $con2com) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);

I am filtering these with a session variable using "username" so it displays what the user has uploaded.

lux
07-01-2008, 07:37 PM
hey! you'll need to use a loop to display each of the images in the query results array. say for instance a while loop.

otherwise if your only using dreamweavers wizards to generate your web page code then please consult the tutorial you are working from

give me a shout if you need more info!

edbr
07-02-2008, 01:16 AM
as you are using the dreamweaver wizard you need to add a repeting regionI think it is called

woofy
07-02-2008, 04:28 AM
The repeating regions worked, I pulled it up on the CS3 help section, here is the info...

-The Repeating Region server behavior lets you display multiple records from a recordset within a page. Any dynamic data selection can be turned into a repeating region. However, the most common regions are a table, a table row, or a series of table rows.

-In Design view, select a region that contains dynamic content. The selection can be anything, including a table, a table row, or even a paragraph of text.
To select a region on the page precisely, you can use the tag selector on the left corner of the document window. For example, if the region is a table row, click inside the row on the page, then click the rightmost <tr> tag in the tag selector to select the table row.

-Select Window > Server Behaviors to display the Server Behaviors panel.

-Click the Plus (+) button, and select Repeating Region.

-Select the name of the recordset to use from the pop‑up menu.

-Select the number of records to display per page, and click OK. In the Document window, a thin, tabbed, gray outline appears around the repeating region. In the Live Data window (View > Live Data), the gray outline disappears and the selection expands to display the number of records you specified.

THANKS!

davidj
07-02-2008, 05:41 AM
i can help you learn the language if you would like

i also provide one to one tuition