[PHP] String

Soldato
Joined
12 Jun 2005
Posts
5,361
Hi there,

I have an example string that goes like this for instance:

Code:
$str = '34' . $text1 . '34' . $text2 .'23';

The variables $text1 and $text2 haven't been set yet and will be set later from a mysql query like this:

Code:
$str = '34' . $text1 . '34' . $text2 .'23';
$text1=mysql_result($sql,$i,"text1");
$text2=mysql_result($sql,$i,"text2");
echo $str;

How can I make it so that when it's echoing the string that it puts the variables in, as I want to be able to use the string in lots of different statements and queries.

I hope i explained this properly.

Thanks.
 
Well, It's just I am using 5 (possibly more all with different results) of the exact same string, so I thought it would be more "efficient"?
 
Didn't want to start a new thread for something small.

But with PHP + MYSQL, can you make it only select the data in the for instance the bottom five records so it doesn't have to have all the data in memory for sorting later, would that be more efficient?

Currently i am using something similar to this to get the last 5 records after:

Code:
//* sort it decending in query *//


$i=0;
while ($i < 5) {
//* SQL Stuff *//
$i++;
}
 
Last edited:
Back
Top Bottom