Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.www.php > #22620
| From | ^Bart <gabriele1NOSPAM@hotmail.com> |
|---|---|
| Newsgroups | it.comp.www.php |
| Subject | Mostrare il valore della FK tramite PHP |
| Date | 2019-04-07 22:50 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <q8dnrf$14id$1@gioia.aioe.org> (permalink) |
Salve,
sto studiando quindi le richieste che sto facendo sono da newbie giusto
per mettere da subito le cose in chiaro! :)
Ho un database in MariaDB, la seguente query funziona:
SELECT endusers.name, endusers.birthdate, users.username, cities.name
FROM endusers INNER JOIN cities ON FK_id_city=id_city INNER JOIN users
ON FK_id_user=id_user;
Mettendola all'interno di uno script php non funziona:
$sql = "SELECT endusers.name, endusers.birthdate, users.username,
cities.name FROM endusers INNER JOIN cities ON FK_id_city=id_city INNER
JOIN users ON FK_id_user=id_user";
if($result = mysqli_query($link, $sql)){
if(mysqli_num_rows($result) > 0){
echo "<table>";
echo "<tr>";
echo "<th>Name</th>";
echo "<th>Birthdate</th>";
echo "<th>Username</th>";
echo "<th>City</th>";
echo "</tr>";
while($row = mysqli_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['endusers.name'] . "</td>";
echo "<td>" . $row['endusers.birthdate'] . "</td>";
echo "<td>" . $row['users.username'] . "</td>";
echo "<td>" . $row['cities.name'] . "</td>";
echo "</tr>";
Se faccio una select * della stessa tabella endusers mostrando quattro
campi lo script funziona, probabilmente non devo inserire
tabella.nome_tabella...
Saluti.
^Bart
Back to it.comp.www.php | Previous | Next — Next in thread | Find similar | Unroll thread
Mostrare il valore della FK tramite PHP ^Bart <gabriele1NOSPAM@hotmail.com> - 2019-04-07 22:50 +0200
Re: Mostrare il valore della FK tramite PHP ^Bart <gabriele1NOSPAM@hotmail.com> - 2019-04-07 22:55 +0200
Re: Mostrare il valore della FK tramite PHP bramante <bramante@yopmail.com> - 2019-04-08 21:56 +0200
Re: Mostrare il valore della FK tramite PHP ^Bart <gabriele1NOSPAM@hotmail.com> - 2019-04-08 22:42 +0200
Re: Mostrare il valore della FK tramite PHP ^Bart <gabriele1NOSPAM@hotmail.com> - 2019-04-10 23:42 +0200
Re: Mostrare il valore della FK tramite PHP bramante <bramante@yopmail.com> - 2019-04-11 23:39 +0200
csiph-web