buna ziua
intampin urmatoarea problema ... am sa zicem un numar de X tabele din care trebuie sa afisez doar tabelele care au in campurile lor o anumita valoare (sa zicem -1)
ideea e ca atunci cand afisez tabelele, rezultatul sa fie sub forma unui link catre un fisier de forma nume_tabela.php
pana acum am reusit sa afisez doar numele tabelelor ...
fisierul arata cam asa ...
<?php
// Make a MySQL Connection
mysql_connect("localhost", "root", "1234")
or die('Could not connect: ' . mysql_error());
mysql_select_db("ping") or die('Could not select database');
// Get all the data from the "all" table
$result = mysql_query("SELECT DISTINCT 'a1' AS Nume_tabela FROM a1 WHERE time = -1
UNION
SELECT DISTINCT 'a2' AS Nume_tabela FROM a2 WHERE time = -1
UNION
SELECT DISTINCT 'a3' AS Nume_tabela FROM a3 WHERE time = -1")
or die(mysql_error());
echo "<table width='300' border='1' align='center'>";
echo "<tr>
<th>Nume tabela</th>
</tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<br>";
echo "<tr align='center'><td>";
echo $row['Nume_tabela'];
echo "</td></tr>";
}
echo "</table>";
?>
cum as putea sa obtin acele link-uri?
multumesc mult
creare link ca rezultat
Moderatori: Moderatori, Start Moderator
-
surrogates
- PHPRomania Supporter
- Mesaje: 8
- Membru din: Joi Oct 06, 2011 12:54 pm
-
surrogates
- PHPRomania Supporter
- Mesaje: 8
- Membru din: Joi Oct 06, 2011 12:54 pm
-
surrogates
- PHPRomania Supporter
- Mesaje: 8
- Membru din: Joi Oct 06, 2011 12:54 pm
Cine este conectat
Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 25 vizitatori