Click here to Skip to main content
15,887,027 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: JSON UI to SQL DB Pin
VarunSharma4330-Aug-16 3:14
professionalVarunSharma4330-Aug-16 3:14 
QuestionWEBSITE TO SELL CARS Pin
akshay kariyanapillil24-Aug-16 6:26
akshay kariyanapillil24-Aug-16 6:26 
AnswerRe: WEBSITE TO SELL CARS Pin
Vincent Maverick Durano24-Aug-16 6:54
professionalVincent Maverick Durano24-Aug-16 6:54 
AnswerRe: WEBSITE TO SELL CARS Pin
Richard Deeming24-Aug-16 7:02
mveRichard Deeming24-Aug-16 7:02 
Questionusage of $.validator.unobtrusive.parse Pin
Raghavendra.Kodimala19-Aug-16 22:35
professionalRaghavendra.Kodimala19-Aug-16 22:35 
Questionlearning to upgrade code Pin
Member 1244422419-Aug-16 17:14
Member 1244422419-Aug-16 17:14 
SuggestionRe: learning to upgrade code Pin
ZurdoDev24-Aug-16 7:45
professionalZurdoDev24-Aug-16 7:45 
Questiontrouble with MYSQLi dropdown Pin
Member 1244422418-Aug-16 15:19
Member 1244422418-Aug-16 15:19 
Hi, I'm trying for awhile to code up a MYSQLi dropdown from a database, select a field(url, formatted as "http://www.thisurl.com) and arrive at that destination. I've tried several forums re. compatability (connection/query/output etc..Problem is I blow up at the first query (see screen shot). It's like my PHP isn't working. If someone will advise of the PHP issue maybe I can work out the app code. Any volunteers? Thanks!
--------------------------------------------------------------------- 1
HTML
<!DOCTYPE html><html>.  
<title>email visit info</title>
<head>
</head>
<BODY>
create and display dropdown from database, url selected provides needed username and password. clicking on selected takes the user(me) to that url<br>
<center>
<form id="testform" name="testform" action="" method="post" accept-charset="UTF-8">
      
<?php 
echo "<center>";echo date('m/d/y');echo "</center>";
$con=mysqli_connect("localhost","root","cookie","homedb");
//---------------------- check connection ------------------------
    if(mysqli_errno($con))
    {echo "Can't Connect to mySQL:".mysqli_connect_error();}
    else
    {echo "</br>";}
 $id = ''; $url= ''; $username = ''; $password = ''; $purpose = ''; 
 $emailused = ''; $date-time = ''; $count = '';  $saved = ''; 

// ----------This creates the drop down box using records in the table -----------
       echo "<select name= 'url'>";
    echo '<option value="">'.' ---select email account ---'.'</option>';
    $query = mysqli_query($con,"SELECT url FROM emailtbl");
    $query_display = mysqli_query($con,"SELECT * FROM emailtbl");
    while($row=mysqli_fetch_array($query))
    { echo "<option class=highlight value='". $row['url']."'>".$row['url']
    .'</option>';}
    echo '</select>';
    ?>
<input type="submit" name="submit" value="Submit"/>
    </form>
  {   
    $url = $_POST['url'];

// ----------------------- display the table ------------------------
    echo '<tr>'.'<td>'.'<table border="1">'.'<tr>'.'
<td bgcolor="#ccffff">'.'url'.'</td>'.'
<td bgcolor="#ccffff">'.'username'.'</td>'.'
<td bgcolor="#ccffff">'.'password'.'</td>'.'
<td bgcolor="#ccffff">'.'purpose'.'</td>'.'
<td bgcolor="#ccffff">'.'emailused'.'</td>'.'
<td bgcolor="#FFD47F">'.'date-time'.'</td>'.'
<td bgcolor="#FFD47F">'.'count'.'</td>'.'
<td bgcolor="#ccffff">'.'saved'.'</td>'.'</tr>';
    // while($data = mysqli_fetch_row($fetch))
    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>
</tr>");
 }
    echo '</table>'.'</td>'.'</tr>'.'</table>';
mysqli_query($con,"UPDATE emailtbl SET 
 date-time = 'DATE()'; count = 'count + 1';      
 WHERE url=$url");
?>  
    </center></body></html>

------------------------------------------------------------------------
                                    2
<?php 
echo "<center>";echo date('m/d/y');echo "</center>";
$con=mysqli_connect("localhost","root","cookie","homedb");
//---------------------- check connection ------------------------
    if(mysqli_errno($con))
    {echo "Can't Connect to mySQL:".mysqli_connect_error();}
    else
    {echo "</br>";}
 $id = ''; $url= ''; $username = ''; $password = ''; $purpose = ''; 
 $emailused = ''; $date-time = ''; $count = '';  $saved = ''; 

// ----------This creates the drop down box using records in the table -----------
       echo "<select name= 'url'>";
    echo '<option value="">'.' ---select email account ---'.'</option>';
    $query = mysqli_query($con,"SELECT url FROM emailtbl");
    $query_display = mysqli_query($con,"SELECT * FROM emailtbl");
    while($row=mysqli_fetch_array($query))
    { echo "<option class=highlight value='". $row['url']."'>".$row['url']
    .'</option>';}
    echo '</select>';
    ?>
<input type="submit" name="submit" value="Submit"/>
    </form>
  {   
 
// ----------------------- display the table ------------------------
    echo '<tr>'.'<td>'.'<table border="1">'.'<tr>'.'

// ======================anchor attempt=========================
// echo "<a href='".$row['url']."'>".$row['url']."</a>";
// ==========================================================

<td bgcolor="#ccffff">'.'username'.'</td>'.'
<td bgcolor="#ccffff">'.'password'.'</td>'.'
<td bgcolor="#ccffff">'.'purpose'.'</td>'.'
<td bgcolor="#ccffff">'.'emailused'.'</td>'.'
<td bgcolor="#FFD47F">'.'date-time'.'</td>'.'
<td bgcolor="#FFD47F">'.'count'.'</td>'.'
<td bgcolor="#ccffff">'.'saved'.'</td>'.'</tr>';
    // while($data = mysqli_fetch_row($fetch))
    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>
</tr>");
 }
    echo '</table>'.'</td>'.'</tr>'.'</table>';
mysqli_query($con,"UPDATE emailtbl SET 
 date-time = 'DATE()'; count = 'count + 1';      
 WHERE url=$url");
?>  
    </center></body></html>
-----------------------------------------------
                             3
<!DOCTYPE html><html>
<head>
<title>test 3</title>
</head>
<body><center>
 <form id="testform" name="testform" action="" method="post" accept-charset="UTF-8">

  <table border=1 cellpadding=2 cellspacing=2 bgcolor="#D4FFAA">
 <tr>
    <th>url</th><th>username</th><th>password</th><th>purpose</th>
    <th>emailused</th><th>date-time</th><th>count</th><th>saved</th>
 </tr>
<?php
$connect=mysql_connect("localhost", "root", "cookie") or die("error");
mysql_select_db("homedb", $connect);
$sql="SELECT * from emailtbl";
$result=mysql_query($sql, $connect);
$url='';;
while($res=mysql_fetch_assoc($result))
{
echo "<tr>"; 
echo "<td>"; echo '<input type="radio" name="url" >'; echo "</td>"; 
echo "<td>"; echo $res['username']>'; echo "</td>"; 
echo "<td>"; echo $res['password']; echo "</td>"; 
echo "<td>"; echo $res['purpose']; echo "</td>"; 
echo "<td>"; echo $res['emailused']; echo "</td>";
echo "<td>"; echo $res['date-time']; echo "</td>"; 
echo "<td>"; echo $res['count']; echo "</td>"; 
echo "<td>"; echo $res['saved']; echo "</td>"; 
echo "</tr>";
}
?>
  </table> </form></body></html>
--------------------------------------------------------


modified 19-Aug-16 9:24am.

SuggestionRe: trouble with MYSQLi dropdown Pin
Richard Deeming19-Aug-16 3:27
mveRichard Deeming19-Aug-16 3:27 
Questionweb form 2010 display error message Pin
dcof16-Aug-16 5:00
dcof16-Aug-16 5:00 
AnswerRe: web form 2010 display error message Pin
ZurdoDev24-Aug-16 7:48
professionalZurdoDev24-Aug-16 7:48 
QuestionProblem Accessing Site Hosted in IIS Pin
Kevin Marois15-Aug-16 16:13
professionalKevin Marois15-Aug-16 16:13 
QuestionWhat makes an excellent web developer? Pin
DesignersX12-Aug-16 19:16
professionalDesignersX12-Aug-16 19:16 
AnswerRe: What makes an excellent web developer? Pin
Richard MacCutchan12-Aug-16 22:17
mveRichard MacCutchan12-Aug-16 22:17 
AnswerRe: What makes an excellent web developer? Pin
Nathan Minier15-Aug-16 1:14
professionalNathan Minier15-Aug-16 1:14 
GeneralRe: What makes an excellent web developer? Pin
petter201230-Aug-16 19:26
petter201230-Aug-16 19:26 
GeneralRe: What makes an excellent web developer? Pin
Nathan Minier31-Aug-16 1:59
professionalNathan Minier31-Aug-16 1:59 
GeneralRe: What makes an excellent web developer? Pin
petter201231-Aug-16 13:43
petter201231-Aug-16 13:43 
GeneralRe: What makes an excellent web developer? Pin
Nathan Minier1-Sep-16 0:58
professionalNathan Minier1-Sep-16 0:58 
AnswerRe: What makes an excellent web developer? Pin
Mohd Shibli21-Sep-16 7:32
professionalMohd Shibli21-Sep-16 7:32 
Questionconverting string to html Pin
Raghavendra.Kodimala11-Aug-16 4:18
professionalRaghavendra.Kodimala11-Aug-16 4:18 
AnswerRe: converting string to html Pin
Richard MacCutchan11-Aug-16 4:25
mveRichard MacCutchan11-Aug-16 4:25 
AnswerRe: converting string to html Pin
W Balboos, GHB11-Aug-16 8:36
W Balboos, GHB11-Aug-16 8:36 
AnswerRe: converting string to html Pin
ellegonzalez19-Aug-16 23:51
ellegonzalez19-Aug-16 23:51 
Questionevent for partial view unload Pin
Raghavendra.Kodimala10-Aug-16 22:53
professionalRaghavendra.Kodimala10-Aug-16 22:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.