my table contains both urls(http://) and email addresses. Using PHP, I want to take different actions depending on the current record and dont have a clue. any advice? thanks

Recommended Answers

All 4 Replies

Start by explaining how your topic meshes with your table and what you want to do.

That is, you can't write an app if you don't know what you want it to perform.

Member Avatar for diafol

Does your table have a field to say what type of link it is?

You can try something like this...

<? php
.
.
.
$i = 0;
while($table[$i]) {
    if(preg_match('/@/', $table[$i]) {
        // do email process 

    } else if (preg_match('/http:\/\//', $table[$i]) {
        // do url process

    } else {
        throw new exception ('Unrecognized table entry');
    }
    $i++;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.