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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.