Ver Mensaje Individual
  #9 (permalink)  
Antiguo 18/06/2008, 09:07
Avatar de frins
frins
 
Fecha de Ingreso: enero-2008
Ubicación: Osor, Girona
Mensajes: 227
Antigüedad: 16 años, 3 meses
Puntos: 5
Respuesta: Separar las columnas de una bd en variables

Mira te dejo el code php:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $usuari ' Control Panel';?></title>
</head>
<body>

<?php
/////////////////////////////////////////////////////////
////////////////// Informació //////////////////////////
///////////////////////////////////////////////////////
$_GET[usuari] = $usuari;
$datadate('l d, F Y');
echo 
'Hi, ' $usuari ' today is ' $data '<br />';
echo 
'<h1> Community: </h1>';
echo 
'You can: <br /> <li /> <a href="upload.php?usuari=' $usuari '&id=' $id '">Suggest a thing that other users and visitors can rate it <a/><br />';
echo 
'<h2>Or</h2>';
echo 
'<li /><a href="vote.php?usuari=' $usuari '&id=' $id '">Vote users things <a/>';
echo 
'<h1> User details </h1>';
?> 
<?php
///////////////////////////////////////////////////////
////////////////////// MySql /////////////////////////
/////////////////////////////////////////////////////

$connection mysql_connect('localhost''root''972190131')
    or die(
'Could not connect. Please contact the webmaster (webmaster@localhost). The error is: ' mysql_error());
mysql_select_db('rateit') or die('Could not select database. Please contact the webmaster (webmaster@localhost)');
$query 'SELECT user_id FROM users WHERE username ="' $usuari '";';
$result mysql_query($query) or die('Query failed: ' mysql_error());
//echo $result['user_id']; No funciona


?>
</body>
</html>
Con esta query, sólo muestra el user_id, pero, yo necesito que el user_id este en una variable, ¿me entiendes?