View Full Version : convert Array to strings automatically?

03-27-2008, 08:12 PM
hey david i need some help with this...plz you've help me so far...plz help me 2 finish it off.....

i have in php

profile[] = $row['username']."-".$row[..................

is there any way to convert that array into many strings which are assigned to a variable.....but obviously you can do it manually but i need it to be automatic.....because i want it to keep on doing it for as many records there are....

after all this i am going to make a tut on flash n php....trust me there is not a simple tut on how to do it over the web.....anyways any help would be appreciated....and stop having your easter eggs.....

03-27-2008, 10:09 PM
ok i've figured that out but at the moment i've got i big array....cant produce a code which makes and array from the records with say data from 5 records/rows.....but than keeps on making more arrays.....and assigns them a variable......so we got an arry with 5 record cal it $rec1 and get php to produce another called rec2...and it just carries on until their isnt any more records......

you what david.....it isnot suppose to be my speciality...wel im good at it...but i dont see a career in IT im more of a science person....but now im starting to think.....

03-28-2008, 01:23 PM

you are a natural

you always push yourself forward and are keen to get the best out of the language. I would say if you enjoy programming then i would give it some thought

03-28-2008, 01:29 PM
implode() will take an array and turn it into a string

$string = implode(",",$array); // the first argument is a comma or glue to seperate the string elements

03-28-2008, 02:37 PM
hey i figured that out yesterday and evrything is falling into place all i have to do now is make up a paging system in php and then everything should be fine.....abnd thnx 4 the comment....i've got the following code in php bt i dont know whats wrong with it

//initialize the start to 0
if(!$rowstart) $rowstart=0;

$query = sprintf("SELECT * FROM clients limit $rowstart,10");
$result = @mysql_query($query);
$result2 = mysql_query("SELECT * FROM clients");
$row = @mysql_fetch_array($result);
//find the number of total rows in the shoutbox total
$numrows = @mysql_num_rows($result2);
//put all the code here for running the script itself using $result in the while loop
//put where you want the next prev to appear
if ($rowstart > $numrows)
echo "<A HREF=\"<?php $php_self ?>?rowstart=<?php echo $rowstart-10;?>\">< Previous Page </A>";
echo "<A HREF=\"<?php print$php_self ?>?rowstart=<?php echo $rowstart+10;?>\">< Next Page </A>";

also you member a while back we produced a login script...and say if im logged in and then navigate to another page how do i keep the session going?