CodeLobster IDE

Free cross-platform PHP IDE (HTML, PHP, CSS, JavaScript, Python code editor) with support Drupal, Joomla, Twig, JQuery, BackboneJS, LaravelJS, Node.js, CodeIgniter, CakePHP, Laravel, Magento, MeteorJS, Phalcon, Symfony, VueJS, WordPress, Yii
It is currently Thu Mar 28, 2024 9:40 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: php help
PostPosted: Wed Nov 13, 2019 9:52 am 
Offline

Joined: Wed Nov 13, 2019 9:22 am
Posts: 2
I'm trying to read records from database into table and select a target to display a particular record and its info and url. I then want to click on that record and o to that url. below is my code:
---------------------------------------------------------------------------------
<!DOCTYPE html><html>
<title>email menu</title>
<head>
</head>
<BODY bgcolor="#ccffff"><b><center>
<FORM name=Form action="" method=post>

<?php
echo "Date: " . date("Y/m/d");
echo "Time: " . date("h:i:sa") . "<br>";
$con=mysqli_connect("localhost","root","cookie","homedb");

if(mysqli_errno($con))
{echo 'Can't Connect to mySQL:'.mysqli_connect_error();}
else
{echo 'Connected to mySQL</br>';}

$query = mysqli_query($con,'SELECT target FROM emailtbl');
$query_display = mysqli_query($con,'SELECT * FROM emailtbl');
while($row=mysqli_fetch_array($query))

$target = $con->query('SELECT target FROM emailtbl');
while ($row = $target->fetch_array(MYSQLI_ASSOC)){ echo '
<option value="'.$row['target'].'">'.$row['target']. '</option>';
}

<input type="submit" name="submit" value="Submit">
</form>';
}

$con=mysqli_connect("localhost","root","cookie","homedb");
if(mysqli_errno($con))
{echo "Can't Connect to mySQL:".mysqli_connect_error();}
if(isset($_POST['target']))
{
$target = $_POST['target'];
$fetch="SELECT target, purpose, username, password, emailused, lastused, count, time, saved FROM emailtbl WHERE target = "$target";
$result = mysqli_query($con,$fetch);
if(!$result)
{echo "Error:".(mysqli_error($con));}
echo '<table border="1">'.'<tr>'.'<td bgcolor="#ccffff align="center">'. 'Email menu'. '</td>'.'</tr>';
echo '<tr>'.'<td>'.'<table border="1">'.'<tr>'.'
<td bgcolor="#D4AAFF align="center">'.'target'.'</td>'.'
<td bgcolor="#D4AAFF align="center">'.'purpose'. '</td>'.'
<td bgcolor="#D4AAFF align="center">'.'username'.'</td>'.'
<td bgcolor="#D4AAFF align="center">'.'password'.'</td>'.'
<td bgcolor="#D4AAFF align="center">'.'emailused'.'</td>'.'
<td bgcolor="#FFD4D4 align="center">'.'lastused'.'</td>'.'
<td bgcolor="#FFD4D4 align="center">'.'count'. '</td>'.'
<td bgcolor="#FFD4D4 align="center">'.'time'. '</td>'.'
<td bgcolor="#FFD4D4 align="center">'. 'saved' .'</td>'.'</tr>';
while($data=mysqli_fetch_row($result))
{echo ("<tr><td>$data[0]</td><td>$data[1]</td><td>$data[2]</td><td>$data[3]</td><td>$data[4]</td><td>$data[5]</td><td>$data[6]</td><td>$data[7]</td><td>$data[8]</td></tr>");}
echo '</table>'.'</td>'.'</tr>'.'</table>';
}
?>
</body></html>
===============================================================
below the result:
-----------------------
"; $con=mysqli_connect("localhost","root","cookie","homedb"); if(mysqli_errno($con)) {echo 'Can't Connect to mySQL:'.mysqli_connect_error();} else {echo 'Connected to mySQL
';} $query = mysqli_query($con,'SELECT target FROM emailtbl'); $query_display = mysqli_query($con,'SELECT * FROM emailtbl'); while($row=mysqli_fetch_array($query)) $target = $con->query('SELECT target FROM emailtbl'); while ($row = $target->fetch_array(MYSQLI_ASSOC)){ echo ' '; } '; } $con=mysqli_connect("localhost","root","cookie","homedb"); if(mysqli_errno($con)) {echo "Can't Connect to mySQL:".mysqli_connect_error();} if(isset($_POST['target'])) { $target = $_POST['target']; $fetch="SELECT target, purpose, username, password, emailused, lastused, visitcount, time, saved FROM emailtbl WHERE target = "$target"; $result = mysqli_query($con,$fetch); if(!$result) {echo "Error:".(mysqli_error($con));} echo ''.''.''.''; echo ''.''.''.'
'. 'Email menu'. '
'.''.''.' '.' '.' '.' '.' '.' '.' '.' '.' '.''; while($data=mysqli_fetch_row($result)) {echo ("");} echo '
'.'target'.' '.'purpose'. ' '.'username'.' '.'password'.' '.'emailused'.' '.'lastused'.' '.'visitcount'. ' '.'time'. ' '. 'saved' .'
$data[0] $data[1] $data[2] $data[3] $data[4] $data[5] $data[6] $data[7] $data[8]
'.'
'; } ?>


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: php help
PostPosted: Thu Apr 02, 2020 4:20 pm 
Offline

Joined: Fri May 29, 2015 2:49 am
Posts: 9
Delete this and see if it works:
Code:
echo "Date: " . date("Y/m/d");
echo "Time: " . date("h:i:sa") . "<br>";

It appears to be echoing everything after the break's closing tag. If it does work, try:
Code:
echo 'Date: ' . date("Y/m/d");
echo 'Time: ' . date("h:i:sa") . '<br>';


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 114 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2016 phpBB Group