Tech Support Guy banner
Status
Not open for further replies.

determine file type

828 views 2 replies 2 participants last post by  ckir5951 
#1 ·
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
 
#3 ·
That's where I'm stymied. This code links to a url. if I switch to line B it attempts to link to email. I'm also trying to alternate line colors.
code:
<!DOCTYPE>online selection



Select email/forum to visit

<?php
$con=mysqli_connect("localhost","root","cookie","homedb");

/* check connection */
if(mysqli_errno($con))
{ echo "Can't Connect to mySQL:".mysqli_connect_error(); }
else
/* This creates the drop down box */
echo "";
echo ''.'--- Select account ---'.'';
$query = mysqli_query($con,"SELECT target FROM emailtbl");
$query_display = mysqli_query($con,"SELECT * FROM emailtbl");
while($row=mysqli_fetch_array($query))
{
echo "".$row['target']
.'';}
echo '';
?>

<!DOCTYPE>test menu display


<?php
$con=mysqli_connect("localhost","root","cookie","homedb");
if(mysqli_errno($con))
{echo "Can't Connect to mySQL:".mysqli_connect_error();}
if(isset($_POST['target']))
{
$name = $_POST['target']; $count="";
$fetch="SELECT target, username, password, purpose, emailused, lastused,
visitcount, saved FROM emailtbl WHERE target = '".$name."'";
$result = mysqli_query($con,$fetch);
if(!$result)
{ echo "Error:".(mysqli_error($con)); }

/* display the table */
echo '
'. 'online menu'. '
'.'
'.'target'.''.'username'.''.'password'.''.'purpose'.''.'emailused'.''.'lastused'.''.'visitcount'.''.'saved'.'
$data[0]$data[1]$data[2]$data[3]$data[4]$data[5]$data[6]$data[7]]
'.' '.'
'.'
'.'
'.'
'.'
'.'
'.'
'.'
'.'
';
while($data=mysqli_fetch_row($result))
{
/* =====================trying to alternate table row color======================= */
/* If $count==1 table row color = #FFC600 */
$count=$count+1;
if($count==1)
{ echo " "; }
else
/* When $count not equal 1, use this table row color */

{ echo "[TR]"; $count = 0; }
/* ===================================================================== */

echo ("[TR]

/* ================ if url( http:// ) link to ===================== */
"); }

/* ==================if email link to==================================== */
// if (frm.FromEmailAddress.value.indexOf("@") < 1 || frm.FromEmailAddress.value.indexOf// (".") < 1) {
// [TD] ]
'.' '.' '.' ';
echo ' '.' [TD]
"); }
/* =============================================================================== */

echo '
'.'[/TD]'.'[/TR]'.'
';
}
?>​
 
Status
Not open for further replies.
You have insufficient privileges to reply here.
Top