GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   PHP Code Syntax (help please) (https://gfy.com/showthread.php?t=344018)

Smut 08-20-2004 06:30 PM

PHP Code Syntax (help please)
 
Here's what I'm wanting to do...

I have a little script that outputs a few parts in 1 string...
Example:

Form input:
Name
ICQ
Email

The script writes the data to file in the format of:
bob jones:5551212:[email protected]

Seperated with the ":".

Now, I'm trying to display each line on a seperate page formatted like so:

Name: Bob Jones
ICQ: 5551212
Email: [email protected]


I know there's something with the explode() function, or split()... but, not exactly sure if this is the best way to do it, and if it is, I'm not quite sure of the syntax.

Any help is appreciated.

Thanks

JSA Matt 08-20-2004 06:34 PM

PHP Code:

<?php
//    List

    
$data file("file.txt");
    
    if (
count($data) < 0)    {
        for (
$i 0$i count($data); $i++)    {
            list(
$name,$icq,$email) = explode(":"$data[$i]);
            
            echo 
"Name: " $name "<BR>";
            echo 
"ICQ: " $icq "<BR>";
            echo 
"Email: " $email "<BR><BR>";
        }
    } else {
        echo 
"Data File Empty";
    }
?>


Smut 08-20-2004 08:11 PM

Quote:

Originally posted by JSA Matt
PHP Code:

<?php
//    List

    
$data file("file.txt");
    
    if (
count($data) < 0)    {
        for (
$i 0$i count($data); $i++)    {
            list(
$name,$icq,$email) = explode(":"$data[$i]);
            
            echo 
"Name: " $name "<BR>";
            echo 
"ICQ: " $icq "<BR>";
            echo 
"Email: " $email "<BR><BR>";
        }
    } else {
        echo 
"Data File Empty";
    }
?>


Great! Thanks! That's what I was looking for. :)


All times are GMT -7. The time now is 09:35 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123