Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to use data from my table in mysql

Posted on 2013-06-11
3
Medium Priority
?
168 Views
Last Modified: 2013-06-11
Hi!

Have this webpage:

<?php // RAY_EE_login.php
require_once('RAY_EE_config.php');
$table1 = 'Kontroller';
// ACCESS TO THIS PAGE IS TESTED BUT NOT CONTROLLED
if ($uid = access_control(TRUE))
{

}
else
{
        header("location: login.php");
	    exit;
}

?>
<!DOCTYPE html>

<html>
<head>
<meta charset="utf-8" />
<title>Test system</title>

</head>

<body>
<link rel="stylesheet" href="default.css">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

<Form method="post" action="side3.php">
<table summary="Services, or Links box template" class="servicesT" cellspacing="1">
<tr><td colspan="2" class="servHd">Min Test</td></tr>


<tr>
	<td class="servBodL_medborder" >HERE I WANT DATA FROM MYSQL TABLE</td>
	<td class="servBodL_medborder"><input type="submit" id="GULKN" value=">"></td>
</tr>

</table>
</Form>
<br>
<table summary="Services, or Links box template" class="servicesT" cellspacing="0">
<tr><td colspan="2" class="servHd">MY OPEN</td></tr>
<tr>
	<td class="TESTE" width="92%">TEST</td>
	<td class="servBodL_medborder" width="8%"><input type="submit" id="GULKN" value=">"></td>
</tr>
</table>
<br><br>
<Form method="post" action="logut.php">
<fieldset id="actions">
	<input type="submit" id="LOGIN" value="Logg ut">
</fieldset>
</Form>

</body>
</html>

Open in new window


I need to pu this Php code in this block (code abow)
<tr>
	<td class="servBodL_medborder" >HERE I WANT DATA FROM MYSQL TABLE</td>
	<td class="servBodL_medborder"><input type="submit" id="GULKN" value=">"></td>
</tr>

Open in new window


<?php

$result3 = mysql_query("SELECT Navn FROM {$table1} WHERE Bruker_id='K007'") or die(mysql_error());
while ($row3 = mysql_fetch_array($result3)){
    $navn = $row3['Navn'];
	echo $navn;
}

?>

Open in new window


How do i do this ?
0
Comment
Question by:team2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 59

Accepted Solution

by:
Julian Hansen earned 2000 total points
ID: 39237559
<?php

$result3 = mysql_query("SELECT Navn FROM {$table1} WHERE Bruker_id='K007'") or die(mysql_error());
while ($row3 = mysql_fetch_array($result3)){
    $navn = $row3['Navn'];
?>
<tr>
	<td class="servBodL_medborder" ><?php echo $navn; ?></td>
	<td class="servBodL_medborder"><input type="submit" id="GULKN" value=">"></td>
</tr>
<?php
}

?>

Open in new window

0
 
LVL 59

Expert Comment

by:Julian Hansen
ID: 39237567
Or
<?php

$result3 = mysql_query("SELECT Navn FROM {$table1} WHERE Bruker_id='K007'") or die(mysql_error());
while ($row3 = mysql_fetch_array($result3)) :
?>
<tr>
	<td class="servBodL_medborder" ><?php echo  $row3['Navn']; ?></td>
	<td class="servBodL_medborder"><input type="submit" id="GULKN" value=">"></td>
</tr>
<?php
endwhile;
?>

Open in new window

using while() : endwhile; is sometimes preferable to using {} when mixing code with html output as it easily enables you to see where code blocks start and end.
0
 
LVL 2

Author Closing Comment

by:team2005
ID: 39237593
Exelent :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question