Jump to content

Mostrar todos os dado da tabela da bd sem saber o nome da coluna


Recommended Posts

Posted

primeiro, qual e' a BD que estas a usar?

Por muito mais que que estude só aprendo uma coisa, que ainda tenho muita coisa para aprender.

A beleza de um código está em decompor problemas complexos em pequenos blocos simples.

"learn how to do it manually first, then use the wizzy tool to save time."

"Kill the baby, don't be afraid of starting all over again. Fail soon, learn fast."

Posted

Por muito mais que que estude só aprendo uma coisa, que ainda tenho muita coisa para aprender.

A beleza de um código está em decompor problemas complexos em pequenos blocos simples.

"learn how to do it manually first, then use the wizzy tool to save time."

"Kill the baby, don't be afraid of starting all over again. Fail soon, learn fast."

Posted (edited)
$ query  =  "SELECT nome, SurfaceArea de ORDER BY País Código LIMIT 5" ; if (
$ result  =  $ mysqli -> query ( $ query )) {
   / * Obter informações de campo para todas as colunas * /
   while ( $ finfo  =  $ result -> fetch_field ()) {
       printf ( "Nome:% s \ n" ,  $ finfo -> nome );
       printf ( "Tabela:% s \ n" ,  $ finfo - > mesa );
       printf ( "max Len:.% d \ n" ,  $ finfo -> max_length );
       printf ( "Flags:% d \ n" ,  $ finfo -> bandeiras ),
       printf ( "Tipo:% d \ n \ n " ,  $ finfo -> tipo );
   }
   $ result -> Fechar ();
}

Este é o código que estava no link eu tenho que substituir o nome....

Mas eu so sei uma coluna da minha tabela.

Tipo a minha tabela(traducasite) com uma coluna(conteudo).

E eu preciso mostrar esta tabela mas mas na sua totalidade.

Cumpz

Edited by brunoais
geshi
Posted

qual e' o erro que esta' a dar?

qual e' esta funcao?

 $ result -> Fechar ();

Por muito mais que que estude só aprendo uma coisa, que ainda tenho muita coisa para aprender.

A beleza de um código está em decompor problemas complexos em pequenos blocos simples.

"learn how to do it manually first, then use the wizzy tool to save time."

"Kill the baby, don't be afraid of starting all over again. Fail soon, learn fast."

Posted (edited)
  $query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";
if ($result = $mysqli->query($query)) {
   /* Get field information for all columns */
   while ($finfo = $result->fetch_field()) {
       printf("Name:     %s\n", $finfo->conteudo);
       printf("Table:    %s\n", $finfo->traducasite);
   }
   $result->close();
}
/* close connection */
$mysqli->close();
?>

Dame erro no if

Edited by brunoais
geshi
Posted (edited)

Nao existem esses campos....

printf("Name:		%s\n", $finfo->conteudo);
printf("Table:	%s\n", $finfo->traducasite);

Parece que o chrome ataca de novo 😄

o codigo que esta' la' no link e' este:


<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");

/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}

$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";

if ($result = $mysqli->query($query)) {

/* Get field information for all columns */
while ($finfo = $result->fetch_field()) {

	printf("Name:	 %s\n", $finfo->name);
	printf("Table:	%s\n", $finfo->table);
	printf("max. Len: %d\n", $finfo->max_length);
	printf("Flags:	%d\n", $finfo->flags);
	printf("Type:	 %d\n\n", $finfo->type);
}
$result->close();
}

/* close connection */
$mysqli->close();
?>


Edited by pikax

Por muito mais que que estude só aprendo uma coisa, que ainda tenho muita coisa para aprender.

A beleza de um código está em decompor problemas complexos em pequenos blocos simples.

"learn how to do it manually first, then use the wizzy tool to save time."

"Kill the baby, don't be afraid of starting all over again. Fail soon, learn fast."

Posted

deves ter que alterar a connection e tambem a query

Por muito mais que que estude só aprendo uma coisa, que ainda tenho muita coisa para aprender.

A beleza de um código está em decompor problemas complexos em pequenos blocos simples.

"learn how to do it manually first, then use the wizzy tool to save time."

"Kill the baby, don't be afraid of starting all over again. Fail soon, learn fast."

Posted

Qual e' o output?

Por muito mais que que estude só aprendo uma coisa, que ainda tenho muita coisa para aprender.

A beleza de um código está em decompor problemas complexos em pequenos blocos simples.

"learn how to do it manually first, then use the wizzy tool to save time."

"Kill the baby, don't be afraid of starting all over again. Fail soon, learn fast."

Posted

ta' certo, faz o que e' suposto.

agora podes guardar num dicionario e depois fazer o while para ver o resultado da query

Por muito mais que que estude só aprendo uma coisa, que ainda tenho muita coisa para aprender.

A beleza de um código está em decompor problemas complexos em pequenos blocos simples.

"learn how to do it manually first, then use the wizzy tool to save time."

"Kill the baby, don't be afraid of starting all over again. Fail soon, learn fast."

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. 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.