• 0
Sign in to follow this  
Bob_Design

Problamas Com Mysql_query

Question

<?

$host="localhost";

$user="root";

$pwd="";

$dbname = "bob";

mysql_connect($host, $user, $pwd) or die("Not Conneted");

mysql_select_db($dbname);

$consulta = "SELECT * FROM usuario";

$resultado = mysql_query($consulta);

while ($linha = mysql_fetch_assoc($resultado));

{

$log = $linha["log"];

$pass = $linha["pass"];

echo "<b> Login: </b> $log<br>";

echo "<b> Sennha: </b> $pass<br>";

}

echo "$resultado";

?>

ERRO:

Login:

Sennha:

Resource id #3

Qual será o problema? :blink:

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Nessa linha

mysql_connect($host, $user, $pwd) or die("Not Conneted");

mysql_select_db($dbname);

deixe assim

$sConect = mysql_connect( $host, $user, $pwd );

$sBd = mysql_select_db( $dbname, $sConect );

Share this post


Link to post
Share on other sites
  • 0

$host="localhost";///Endereço do mysql, na maioria das vezes será localhost.

$user="root";///Nome de usuário

$pwd="";///Senha

$dbname = "bob";

$connect = mysql_connect($host, $user, $pwd);

$select = mysql_select_db($dbname, $connect);

$consulta = "SELECT log, pass FROM usuario";

$resultado = mysql_query($consulta);

while ($linha = mysql_fetch_assoc($resultado));

{

$log = $linha["log"];

$pass = $linha["pass"];

echo "<b> Login: </b> $log<br>";

echo "<b> Sennha: </b> $pass<br>";

}

echo $resultado;

não está indo =/

sera o mysql?

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

Sign in to follow this