Jump to content

[SOLVED] Array()


xyn

Recommended Posts

Hey Guys, I've never been so involved in Arrays before

however i've hit a learning curve. because I need to achive

the following:

 

[0] => 'SQL_ID', 'SQL_NAME', 'SQL_FILE_NAME',
[1] => 'SQL_ID', 'SQL_NAME', 'SQL_FILE_NAME',
[2] => 'SQL_ID', 'SQL_NAME', 'SQL_FILE_NAME'
And so one...

 

Basically I am taking images from my database

and displaying them in rows of 5. but using while

to loop the sql results. and trying to make colums

i found the only way is using and array

 

My coding is this...

 

Show:

$arr = array();
					$arr_count = 0;
					while($photo_album = mysql_fetch_array($sql_display_albums))
					{
						$arr = array();
					}

					echo("<table width=\"607\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
					include($_SERVER['DOCUMENT_ROOT'] . "/includes_files/album.inc.php");
					echo("</table>");

 

album.inc.php:

<?php
$total_albums = count($main_array);
for($i=0; $i<$total_albums; $i++)
{
if($ii == 0)
{
	echo("<tr>");
}

if($ii <= 7)
{
	echo("<td width=\"110\" height=\"100\" align=\"center\" class=\"text\">".$photo_album['']."<br>".$photo_album['']."</td>
    <td width=\"14\" height=\"100\" align=\"center\" class=\"text\"> </td>");
}

if($ii == 7)
{
	echo("</tr>
	<tr>
	  <td height=\"5\" width=\"607\" colspan=\"9\"></td>
	</tr>");
	$ii = 0;
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/68110-solved-array/
Share on other sites

I kinda thought about this hard; and thought of building an array

in my while like

while($data = mysql_fetch_array($sql))
{
$arr[] = array('".$data['id']."', '$data['name']', '$data['file']');
}

then implode(); the $arr into another array 
sorry for time wasting

Link to comment
https://forums.phpfreaks.com/topic/68110-solved-array/#findComment-342357
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.