Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Mr Viper
Jun 21, 2005

Derezzed...

argz posted:

what?


<?=$my_var?>

is so much cleaner than

<?php echo $my_var?>


Do you like writing '<?php echo' 40 times in a file?

When I'm scanning a 5000 line file, it's easy to just search for the word 'echo'. It catches the eye better than an equals sign.

Adbot
ADBOT LOVES YOU

gibbed
Apr 10, 2006

argz posted:

what?


<?=$my_var?>

is so much cleaner than

<?php echo $my_var?>


Do you like writing '<?php echo' 40 times in a file?
Short tag is <?, not <?=, and <?= is magic for <? echo.

gibbed fucked around with this message at 04:07 on Aug 29, 2009

DarkLotus
Sep 30, 2001

Lithium Hosting
Personal, Reseller & VPS Hosting
30-day no risk Free Trial &
90-days Money Back Guarantee!

scrabbleship posted:

It might but it is probably a bit overkill for what my client wants. This would probably overwhelm him. He just wants something he can see the entries in the table with and modify/delete faulty ones with; nothing to fancy. Thanks for the suggestion nonetheless.
You could use this datagrid class and modify it to fit your needs.
http://stefangabos.blogspot.com/search/label/Data%20Grid%20PHP%20Class%20Description/

Thibaw
Jul 21, 2009
Does anyone know, if it is required to compile php with --debug-enabled in order to be able to use the full functionality of xdebug?

The reason why I am asking:

We have strange issues, that occur only on our live system and not on our development/test system. Our live system has php debug disabled for performance reasons. And I would like to know this, before I start messing with/installing xdebug on it.

argz
May 20, 2005

The hand says it all.

gibbed posted:

Short tag is <?, not <?=, and <?= is magic for <? echo.

Is <?= not included in this argument?

quote:

Note: This directive also affects the shorthand <?= , which is identical to <? echo . Use of this shortcut requires short_open_tag to be on.
http://us2.php.net/manual/en/ini.core.php

Rat Supremacy
Jul 15, 2007

The custom title is an image and/or line of text that appears below your name in the forums

argz posted:

Is <?= not included in this argument?

http://us2.php.net/manual/en/ini.core.php

Exactly. Nobody really cares about <?, but <?= is a really neat shortcut that would make templates look just that little bit nicer.

argz
May 20, 2005

The hand says it all.

haywire posted:

Exactly. Nobody really cares about <?, but <?= is a really neat shortcut that would make templates look just that little bit nicer.

Simple matter of benefits outweighing the cost. Would I rather type an XML file fix once for the times where I use XML or every time I'm adding a variable?

The obvious thing here is the latter uses far more characters and gets messier quicker. I think this is a poor excuse to remove the short tags.

McGlockenshire
Dec 16, 2005

GOLLOCKS!

Thibaw posted:

Does anyone know, if it is required to compile php with --debug-enabled in order to be able to use the full functionality of xdebug?
xdebug does not require a recompile of PHP with the debug flag.

Rat Supremacy
Jul 15, 2007

The custom title is an image and/or line of text that appears below your name in the forums

argz posted:

Simple matter of benefits outweighing the cost. Would I rather type an XML file fix once for the times where I use XML or every time I'm adding a variable?

The obvious thing here is the latter uses far more characters and gets messier quicker. I think this is a poor excuse to remove the short tags.

Either way, they should make the disabling of <? and <?= seperate, and <?= should be enabled by default. What possibly argument is there against that?

eHacked
Sep 30, 2003

CONGRATULATIONS!!! YOU ARE THE 6,127,436,218TH PERSON TO VIEW THIS USELESS POST. CLICK TO CLAIM YOUR PRIZE!!!
I'm needing some help with pre_replace

I'm extracting <a> tags from source codes, and basically want to strip out all non-href parts.

I've already got the script to return to me only <a> tags... but if the tag has a "class" or any other thing inside, it'll mess it up, so what I want to do is:

if $value has text that != 'href="$s"' or 'href=$s', remove that unnecessary text.

I've already taken into account "target=" by simply running a str_replace

Any help on this would be returned with eternal love!

edit: got it:

http://semlabs.co.uk/journal/php-strip-attributes-class-for-xml-and-html

Best class ever!

eHacked fucked around with this message at 17:45 on Aug 31, 2009

pipebomb
May 12, 2001

Dear God, what is it like in your funny little brains?
It must be so boring.
Help?

I have an issue wherein I want to include a file if a variable from the page is not blank but to not show it if the variable is blank.

Here's how (in my stupid head) it should be - I'm not quite php enough to figure out how to do this though. Anyone want to school me on the proper way to write this?

code:
if $data = '' then include ('share.php') else '<br />'

argz
May 20, 2005

The hand says it all.

pipebomb posted:

Help?

I have an issue wherein I want to include a file if a variable from the page is not blank but to not show it if the variable is blank.

Here's how (in my stupid head) it should be - I'm not quite php enough to figure out how to do this though. Anyone want to school me on the proper way to write this?

code:
if $data = '' then include ('share.php') else '<br />'

Hmm, you said if not blank in the top, but then wrote the pseudo code like if it is blank, just switch out the comparison operator if you want otherwise >> == vs. !=

code:
if ($data!='') { include('share.php'); }
technically you can do (!$data), which is shorthand for $data=false but you have to ensure you're returning $data properly for that.

pipebomb
May 12, 2001

Dear God, what is it like in your funny little brains?
It must be so boring.
You are a beautiful soul and I love you. Sorry about the error, glad you caught it...this works perfectly, thank you!


argz posted:

Hmm, you said if not blank in the top, but then wrote the pseudo code like if it is blank, just switch out the comparison operator if you want otherwise >> == vs. !=

code:
if ($data!='') { include('share.php'); }
technically you can do (!$data), which is shorthand for $data=false but you have to ensure you're returning $data properly for that.

Mr Viper
Jun 21, 2005

Derezzed...
My 2 cents on the issue...

pipebomb posted:

Help?

I have an issue wherein I want to include a file if a variable from the page is not blank but to not show it if the variable is blank.

Here's how (in my stupid head) it should be - I'm not quite php enough to figure out how to do this though. Anyone want to school me on the proper way to write this?

code:
if $data = '' then include ('share.php') else '<br />'

1. Use brackets, you'll save yourself a giant headache
2. Use single quotes for single characters, use double quotes for multiple characters
3. Don't use "if-then", brackets take care of that (see rule 1)
4. Comparison has to be "==", not the single "=". Single equals sign isn't a comparison, you're setting $data to be a blank string. But since you want it to include the file if it's NOT blank, it has to be "!="

php:
<?
if($data != '') {include("share.php");}
else {echo("<br />");}
?>

KuruMonkey
Jul 23, 2004

Mr Viper posted:

My 2 cents on the issue...

1. Use brackets, you'll save yourself a giant headache
2. Use single quotes for single characters, use double quotes for multiple characters
3. Don't use "if-then", brackets take care of that (see rule 1)
4. Comparison has to be "==", not the single "=". Single equals sign isn't a comparison, you're setting $data to be a blank string. But since you want it to include the file if it's NOT blank, it has to be "!="

All good points, with the minor addendum that single quotes are for when you don't want the string processed for variables and special characters (like \n for newlines). Double quotes are for when you do want that processing.

They are not interchangeable on a whim.

php:
<?
$world = 'KuruMonkey'; // used single quotes; no variables etc in this string
echo 'hello, $world<br>';
echo "hello, $world<br>";
echo 'you see?';
?>
try that code; the result will be:

code:
helow $world
hello, Kurumonkey
you see?
Note that $world will make its way unchanged to the browser.

Single quotes are, because of that lack of processing, marginally more efficient than double quotes. In a complex string managing program, it can add up. (its a habit to build; singles where no variables, doubles where variables)


Edit: the real pro-tip is, of course, to be consistent in your style. Thats always more important than exactly what your style is. Which was the main thrust of the previous reply, I think.

KuruMonkey fucked around with this message at 19:41 on Sep 2, 2009

Mr Viper
Jun 21, 2005

Derezzed...
Oh yeah, that's true about the single/double quotes thing. I just never use variables in the middle of strings, I've never felt comfortable doing it. I'll just type
code:
echo("hello my name is " . $name . "!");
It just seems cleaner, and clearly defines where the variable is.

xezton
Jan 31, 2005

Mr Viper posted:

Oh yeah, that's true about the single/double quotes thing. I just never use variables in the middle of strings, I've never felt comfortable doing it. I'll just type
code:
echo("hello my name is " . $name . "!");
It just seems cleaner, and clearly defines where the variable is.

I do that, too. I agree it's cleaner and it's easier to pick out variables in strings when you're scanning through code (in my opinion at least).

I never knew this thread (and the web dev thread) existed. It makes me happy that there is at least one thread on SA that I might actually be able to helpfully contribute to.

duz
Jul 11, 2005

Come on Ilhan, lets go bag us a shitpost


Mr Viper posted:

Oh yeah, that's true about the single/double quotes thing. I just never use variables in the middle of strings, I've never felt comfortable doing it. I'll just type
code:
echo("hello my name is " . $name . "!");
It just seems cleaner, and clearly defines where the variable is.

It's better to put the variable in curly braces if you're putting them in quotes, plus it lets you use non-alphanumeric characters, like -> and []. Your IDE had better highlight it as well.

php:
<?
echo "hello my name is {$person->name}!";?>

Tad Naff
Jul 8, 2004

I told you you'd be sorry buying an emoticon, but no, you were hung over. Well look at you now. It's not catching on at all!
:backtowork:

xezton posted:

I do that, too. I agree it's cleaner and it's easier to pick out variables in strings when you're scanning through code (in my opinion at least).

I'm so very, very ashamed...
php:
<?
foreach(array('Type','Null','Key','Default','Extra') as $v){
  if(${"c$v"}!=${"n$v"}){
    echo("***\t ojs222.$table.$cField $v '".${"c$v"}."' => ojs.$table.$nField $v '".${"n$v"}."'\n");
    switch($v){
      ...
    }
  }
}
?>

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



duz posted:

It's better to put the variable in curly braces if you're putting them in quotes, plus it lets you use non-alphanumeric characters, like -> and []. Your IDE had better highlight it as well.

php:
<?
echo "hello my name is {$person->name}!";?>

php:
<?
"$someObject->someLocal" //works in my test
"$someArray[1]" //works fine, too (maybe just in 5+?)
?>

Rat Supremacy
Jul 15, 2007

The custom title is an image and/or line of text that appears below your name in the forums

duz posted:

It's better to put the variable in curly braces if you're putting them in quotes, plus it lets you use non-alphanumeric characters, like -> and []. Your IDE had better highlight it as well.

php:
<?
echo "hello my name is {$person->name}!";?>


Wait, from a speed perspect isn't "blah".$blah the fastest? With "blah $blah" php has to iterate through the string to find all the variables :S

For I rather like printf/sprintf, though :)

Ideally you shouldn't echo except within a template, though.

I personally find concatenation to be easiest to read, too. "Blah blah blah" . $ohlookavariable . "blah";

Mr Viper
Jun 21, 2005

Derezzed...

haywire posted:

Ideally you shouldn't echo except within a template, though.

Hold on, what? What do you mean?

Rat Supremacy
Jul 15, 2007

The custom title is an image and/or line of text that appears below your name in the forums

Mr Viper posted:

Hold on, what? What do you mean?

Surely you should only output once you have decided what your output is (IE after system logic).

Rat Supremacy fucked around with this message at 22:54 on Sep 2, 2009

Mr Viper
Jun 21, 2005

Derezzed...

haywire posted:

Mr Viper posted:

Hold on, what? What do you mean?

Surely you should only output once you have decided what your output is (IE after system logic).

I prefer to fully write out my code rather than do the quick shortcuts, it's just so much easier for me. Not that I have a problem with the superfast haxxor scripting, and it's not like the pages go slow or anything, I just do it my way. Three spaces per tab, brackets organized all nice and clean, no 200 character lines of a huge function.

So, not to repeat myself, but what?

Rat Supremacy
Jul 15, 2007

The custom title is an image and/or line of text that appears below your name in the forums

quote:

Mr Viper posted:

Surely you should only output once you have decided what your output is (IE after system logic).

I prefer to fully write out my code rather than do the quick shortcuts, it's just so much easier for me. Not that I have a problem with the superfast haxxor scripting, and it's not like the pages go slow or anything, I just do it my way. Three spaces per tab, brackets organized all nice and clean, no 200 character lines of a huge function.

So, not to repeat myself, but what?

What are you actually asking me? IIRC what I'm talking about is more laid out and has more code. :S Having dynamic data in data sent to a template for output.

Also, what I suggested earlier works, but not for echo, weirdly.

php:
<?php
strlen$data ) > 0  printf"<br/>" ) : include( "a file" );
?>

Although I probably wouldn't use it in that situation.


Edit: Oh wait, did you think I was trying to say that not using whitespace when concatenating was faster? Obviously that isn't true, they're interchangable.

Rat Supremacy fucked around with this message at 13:07 on Sep 12, 2009

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



haywire posted:

Also, what I suggested earlier works, but not for echo, weirdly.

That's not so weird - echo is one of those magical things that doesn't work outside the narrow context some PHP dev felt it should be used in (like empty)

quote:

Surely you should only output once you have decided what your output is (IE after system logic).

Heh, sounds like someone works with a codebase that's actually organized according to some well-known development scheme other than "write C in PHP and what the gently caress is a 'standard,' anyway?"

duz
Jul 11, 2005

Come on Ilhan, lets go bag us a shitpost


Munkeymon posted:

php:
<?
"$someObject->someLocal" //works in my test
"$someArray[1]" //works fine, too (maybe just in 5+?)
?>

Must've fixed that in 5.something then because I could've sworn it didn't used to work. Curly braces are still good for the variable variable name trick though.

haywire posted:

Wait, from a speed perspect isn't "blah".$blah the fastest? With "blah $blah" php has to iterate through the string to find all the variables :S

No idea about the speed vs concat or inline, if you're using " it will be evaluating regardless. None of my code has gotten to the point where that would make a difference so I havn't checked.

Mr Viper posted:

Hold on, what? What do you mean?

He means you shouldn't be outputting anything until you're done processing all your data. Assuming you're using some type of MVC setup or something similar.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
Is there a good reason to use sprintf instead of str_replace? Is it faster?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Hammerite posted:

Is there a good reason to use sprintf instead of str_replace? Is it faster?

You use them for very different things in general, so it's not really an "instead" thing.

EDIT: as for the discussion du jour, I used to be an echo guy, but I have come to love the printf

Lumpy fucked around with this message at 23:58 on Sep 2, 2009

waffle iron
Jan 16, 2004

Lumpy posted:

You use them for very different things in general, so it's not really an "instead" thing.

EDIT: as for the discussion du jour, I used to be an echo guy, but I have come to love the printf
I'm a real big fan of printf and sprintf and vsprintf. The formatting abilities make it easier to read. Also useful if you end up having to do localization later.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Lumpy posted:

You use them for very different things in general, so it's not really an "instead" thing.

Well... I am in the middle of internationalising my site, and I have various pieces of text that I'm allowing users to translate into other languages so that my pages can be in multiple languages. The way I do this is to have a database table of english phrases; one column in this table records which page a phrase is used from, so at the start of a script I load all the phrases for that page and put them in an array, $TranslatableText. Then if the user has his language set to something other than English, I fetch corresponding translations, and translations that exist overwrite the English versions of text in $TranslatableText. I have the following function:
php:
<?
function transtext($x) {
    global $TranslatableText;
    if ( isset($TranslatableText[$x]) ) { return $TranslatableText[$x]; }
    else                                { return 'MISSING TEXT ('.$x.')'; }
}
?>
So I can write things like echo transtext(1234); and it echoes whatever that might be. Some phrases have variables in them. For example phrase number 193 in English is The rail link between \start and \end has been built by \playername. At the moment I output this phrase like this:
php:
<?
echo str_replace(
         array('\start','\end','\playername'),
         array($LocationNames[$RailStarts[$i]],
               $LocationNames[$RailEnds[$i]],
               $RailOwners[$i]
               ),
         transtext(193)
     );
?>
But I know that sprintf can also be used for this purpose. Which is better?

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
Never mind - I did my own test and found that for a typical string I want processed in this way, str_replace takes about 50% longer than sprintf.

I guess I'm not sure whether that's worth getting worked up about, when using str_replace leads to more readable code and to translation work that's easier to review and understand.

Rat Supremacy
Jul 15, 2007

The custom title is an image and/or line of text that appears below your name in the forums

duz posted:

Must've fixed that in 5.something then because I could've sworn it didn't used to work. Curly braces are still good for the variable variable name trick though.


No idea about the speed vs concat or inline, if you're using " it will be evaluating regardless. None of my code has gotten to the point where that would make a difference so I havn't checked.

You'd think so. Funnily enough, it "blah" . $blah is faster than 'blah' . $blah, with "blah $blah" being the slowest. Yes, this scared me too.

TBH speed isn't really a factor, but variables in strings is just one of those horrible things that makes PHP horrible.

quote:


He means you shouldn't be outputting anything until you're done processing all your data. Assuming you're using some type of MVC setup or something similar.

Yeah, this is ideal. Even if you arent you can have a buffer for $output, as it helps you to be organised.

waffle iron posted:

I'm a real big fan of printf and sprintf and vsprintf. The formatting abilities make it easier to read. Also useful if you end up having to do localization later.


It is so nice. If your language file can contain things like "welcome back, %s", your life is so much easier. It is one of the main reasons I discovered sprintf other than previous use of C.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



duz posted:

Must've fixed that in 5.something then because I could've sworn it didn't used to work. Curly braces are still good for the variable variable name trick though.

This is 5.2.5, which is closing in on its second birthday, but I gather being on the bleeding edge of PHP isn't something most server admins are really concerned with.

Hanpan
Dec 5, 2004

I'm having some problems with the output buffer. I am buffering my script and printing the result using a callback. The problem is that if a error is thrown at any point, nothing is being shown and I am getting a blank screen. I have tried setting my own custom error handlers but nothing seems to work. I have a feeling this is because the errors are causing my buffer to call the callback method instead of flushing in my error handler. Either that or it's because I have the error handler as a static method, but changing this causes issues.

I'd really appreciate any help because this one has me stumped!

code:
public function constructor()
{
    ob_start(array(__CLASS__, 'render'));
    self::$buffer_level = ob_get_level();
	
    set_error_handler(array(__CLASS__, 'exception_handler'));
    set_exception_handler(array(_C_LASS__, 'exception_handler'));

    RUNNING MY SCRIPT HERE

    ob_end_flush();
}

public static function exception_handler($exception, $message = NULL, $file = NULL, $line = NULL)
{
	while (ob_get_level() > self::$buffer_level)
	{
	ob_end_clean();
	}

	echo $exception.' - '.$message.' - '.$file.' - '.$line.'<br/>';
}  

Supervillin
Feb 6, 2005

Pillbug

Hanpan posted:

set_exception_handler(array(_C_LASS__, 'exception_handler'));

Typo in your post, or typo in your file?

Try fetching the result of error_reporting(), that is checkable even if you set your own error handler.

Edit: Sorry, not even sure anymore what the hell I was thinking. Yes you can check error_reporting (it returns an int of the last value it was set to), but not sure what benefit I thought that would provide. Maybe I meant error_get_last(). Damned if I know for sure, sorry.

Supervillin fucked around with this message at 23:03 on Sep 6, 2009

Hanpan
Dec 5, 2004

Supervillin posted:

Typo in your post, or typo in your file?

Try fetching the result of error_reporting(), that is checkable even if you set your own error handler.

Sorry, typo in my post. It's all fine in the script.

Could you elaborate on what you mean by "fetch the result"? I thought error_reporting() was just a way of changing which errors are shown?

TreFitty
Jan 18, 2003

The Codeigniter thread is apparently closed, but I'm trying to get going with Codeigniter now and running in to a big problem. I seem to have error logging and the display of errors turned on (it's the default setting), but I can't figure out what the gently caress is wrong with the Database library. As soon as I try to call it (either from autoload or explicitly) I get just a blank page instead of all the content that should be there....like the error message. I'm pretty drat sure I'm feeding the database library the right server info, but it refuses to start and won't tell me why.

The question is: how do I get access to the error message? I can't fix it if I don't know what's wrong.

edit: I have it working on my paid-for web server, but not my local machine. MySQL itself, PHP, and Apache are all otherwise working very well on my local machines. On the hosted site it will throw an error and on my local machines it will only die and give me a blank page. What's up here?

edit2: I meant to say it's working just fine with the correct settings on the remote web server. It will also throw an error with the incorrect settings. Locally, all I get is a blank page with correct or incorrect settings.

FIXED! After nearly a day of searching to fix this problem I finally found a post that narrowed it down for me: re-install PHP and include the MySQL module - which I thought was enabled by default.

Oh well.

TreFitty fucked around with this message at 07:07 on Sep 6, 2009

Happysafer
Feb 12, 2007

"You idiots!"
I am extremely new to PHP and don't know where to begin with this, but it seems simple enough. I want to dynamically generate a list of links from a database. So for example I would have some sort of database or file on my website that was just a single column on numbers:

125375
193745
058214

Like that and it would insert the numbers into two links:

1. site.com/link?id=125375 site.com/link2?id=125375
2. site.com/link?id=193745 site.com/link2?id=193745
3. site.com/link?id=058214 site.com/link2?id=058214

Also, I want to format the output into an ordered list. I don't really know what I am doing, so any help is appreciated. Thanks.

Happysafer fucked around with this message at 15:18 on Sep 7, 2009

Adbot
ADBOT LOVES YOU

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Happysafer posted:

I am extremely new to PHP and don't know where to begin with this, but it seems simple enough. I want to dynamically generate a list of links from a database. So for example I would have some sort of database or file on my website that was just a single column on numbers:

125375
193745
058214

Like that and it would insert the numbers into two links:

1. site.com/link?id=125375 site.com/link2?id=125375
2. site.com/link?id=193745 site.com/link2?id=193745
3. site.com/link?id=058214 site.com/link2?id=058214

Also, I want to format the output into an ordered list. I don't really know what I am doing, so any help is appreciated. Thanks.

How you get the list of numbers in the first place will vary depending on whether you are using a database management system (DBMS), storing the data in a text file, or using some other method to store it (you don't seem sure).

If you're storing it in a file then PHP has input/output functions that you can use to get at it. I'm not familiar with these. If you're using a database, then the functions used to connect to the database and issue queries depends on which DBMS you are using, but the query itself will be the same regardless of the DBMS, as it's quite a simple thing you want to do.

Here is how I would do what you are describing, using a MySQL database called MyDatabase with a table called MyTable in which is the single column MyColumn. (Since you give an example of a number with leading zeroes, I guess you might use a CHAR or VARCHAR datatype for the column. They all seem to be the same number of digits though, and if that's always the case you could make the column an integer type and give it the ZEROFILL attribute. Whichever you did, the ORDER BY clause given here would work.)

php:
<?
$host = 'localhost';
$user = 'username';        // Enter the name of your database user here
$password = 'password';    // Enter the password for that database user here
$dbname = 'MyDatabase';

$dblink = @mysqli_connect($host,$user,$password,$dbname)
          or die('Failed to connect to database');
$query_result = mysqli_query($dblink,'SELECT MyColumn FROM MyTable ORDER BY MyColumn')
                or die('Failed to read database table');

$output = '';
$i = 0;

while ( $number = mysqli_fetch_assoc($query_result) ) {
    $i++;                               // The line number needs to get bigger every time
    $output .= $i.                      // Puts in the line number
               '. site.com/link?id='.
               $number['MyColumn'].
               ' site.com/link2?id='.
               $number['MyColumn'].
               '<br>';                  // Adds an HTML line break at the end
}

echo $output;             // Echoes the output to your browser
?>

Hammerite fucked around with this message at 18:32 on Sep 7, 2009

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply