Jump to content

[SOLVED] variable in a query


techker

Recommended Posts

hi there i will explain my situation then ask the question

 

i have a login script that i need to mod.when you logue in i wan't the username to apear on top.thats done with this

<?
$USERNAME = $_COOKIE['LMUSERNAME'];
?>

<? echo $USERNAME ?>

 

now i want to display the clients info in a box on the web page.

 

so im ok for the connection but my question is how to query only that user not all..

 

im guessing in my sql query

 

$resultat = mysql_query("SELECT * FROM authuser ");

 

is there a way to in there only from $username

 

so i can fetch all the info of that user only.

Link to comment
Share on other sites

it gives me this

 

Unknown column 'username' in 'where clause'

 

<?
$USERNAME = $_COOKIE['LMUSERNAME'];
?>
<?php
// Make a MySQL Connection
mysql_connect("localhost", "techker_admin", "techker") or die(mysql_error());
mysql_select_db("hugues_login") or die(mysql_error());

// Retrieve all the data from the "example" table
$result = mysql_query(" SELECT * FROM authuser WHERE username ='$USERNAME'")
or die(mysql_error());  
while ($ligne = mysql_fetch_array($result)) { 
		// mysql_fetch_array() : Retourne une ligne de résultat MySQL sous la forme d'un tableau associatif,
		//echo("<ul>");
		//echo("<li>Phone : <b>" . $ligne['phone'] . "</b></li>");
		//echo("<li>Email : <b>" . $ligne['email'] . "</b></li>");
		//echo("<li>status : <b>" . $ligne['status'] . "</b></li>");
		//echo("</ul>");

	}
// Ferme la connexion au serveur MySQL
	mysql_close($connection);
?>
<html>
<head>
<title>LFNC </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-image: url(images/rez_1.jpg);
}
.style1 {color: #FFFFFF}
a:link {
color: #FFFFFF;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #FFFFFF;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
-->
</style>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (cpanel_2.psd) -->
<table width="766" height="601" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
	<td height="144" colspan="2">
		<img src="images/cpanel_2_01.jpg" width="189" height="144" alt=""></td>
<td colspan="3">
		<img src="images/cpanel_2_02.jpg" width="478" height="144" alt=""></td>
	<td colspan="2">
		<img src="images/cpanel_2_03.jpg" width="99" height="144" alt=""></td>
</tr>
<tr>
	<td height="30" colspan="7" background="images/cpanel_2_04.jpg"><table width="766" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="128" height="26" class="style1"><div align="center"><a href="logout.html">Déconnection</a></div></td>
            <td width="273">Utilisateur en ligne <? echo $USERNAME ?> </td>
            <td width="208"> </td>
            <td width="157"><div align="right" class="style1">
              <div align="center" class="style1">Utilisateur v1.0</div>
            </div></td>
          </tr>
        </table></td>
  </tr>
<tr>
	<td rowspan="2">
		<img src="images/cpanel_2_05.jpg" width="17" height="423" alt=""></td>
	<td height="409" colspan="2" valign="top" background="images/cpanel_2_06.jpg"><table width="211" height="162" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td><? echo("<ul>");
		echo("<li>Phone : <b>" . $ligne['phone'] . "</b></li>");
		echo("<li>Email : <b>" . $ligne['email'] . "</b></li>");
		echo("<li>status : <b>" . $ligne['status'] . "</b></li>");
		echo("</ul>");?></td>
          </tr>
        </table></td>
<td rowspan="2">
		<img src="images/cpanel_2_07.jpg" width="12" height="423" alt=""></td>
	<td colspan="2" rowspan="2"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','509','height','423','src','flash/web_panel_fr','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','flash/web_panel_fr' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="509" height="423">
          <param name="movie" value="flash/web_panel_fr.swf">
          <param name="quality" value="high">
          <embed src="flash/web_panel_fr.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="509" height="423"></embed>
    </object></noscript></td>
  <td rowspan="2">
		<img src="images/cpanel_2_09.jpg" width="17" height="423" alt=""></td>
</tr>
<tr>
	<td height="14" colspan="2">
		<img src="images/cpanel_2_10.jpg" width="211" height="14" alt=""></td>
  </tr>
<tr>
	<td height="2">
		<img src="images/spacer.gif" width="17" height="1" alt=""></td>
  <td>
		<img src="images/spacer.gif" width="172" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="39" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="12" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="427" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="82" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="17" height="1" alt=""></td>
</tr>
</table>
<p>
  <!-- End ImageReady Slices -->
</p>
<table width="100" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="http://www.tech-design.info" target="_blank"><img src="images/tech.jpg" width="125" height="45" border="0"></a></td>
  </tr>
</table>
<p>  </p>

</body>

</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.