Het is de bedoeling dat ik indien de waarde van destination van de tabel calls gelijk is aan de waarde destination van de tabel destination, dat dan de waarde omschrijving van de tabel destinations getoond wordt.

En dat ik dus de omschrijving zie, het moet op deze manier omdat ik afhankelijk ben van een ander programma.

Hieronder nog een mogelijke query:

SELECT omshrijving FROM calls,destination where destination(van)destination=destination(van)cal



Ik heb het nou op onderstaande manier geprobeert maar dat werkt niet.

$omschrijving= mysql_query("SELECT * FROM calls,destination WHERE $destination=$destination )" ,$connect);
//gegevens naar het scherm schrijven

while(list($call_id,$datum,$tijd,$clip,$omschrijving)=
mysql_fetch_row($omschrijving)){
echo("<tr><td>$call_id</td><td> $datum</td><td> $tijd </td><td> $clip </td><td> $omschrijving</td> </tr> <br>\n");
}


Database telefoon running on localhost
# phpMyAdmin MySQL-Dump
# version 2.3.2
# http://www.phpmyadmin.net/ (download page)
#
# Host: localhost
# Generation Time: Jul 06, 2004 at 01:21 PM
# Server version: 4.00.00
# PHP Version: 4.2.3
# Database : `telefoon`
# --------------------------------------------------------

#
# Table structure for table `calls`
#

CREATE TABLE calls (
call_id int(11) NOT NULL auto_increment,
datum date NOT NULL default '0000-00-00',
tijd time NOT NULL default '00:00:00',
clip int(20) NOT NULL default '0',
destination int(20) NOT NULL default '0',
PRIMARY KEY (call_id)
) TYPE=MyISAM;
# --------------------------------------------------------

#
# Table structure for table `destination`
#

CREATE TABLE destination (
destination int(20) NOT NULL default '0',
omschrijving text NOT NULL,
PRIMARY KEY (destination,destination)
) TYPE=MyISAM;
# --------------------------------------------------------

#
# Table structure for table `gsm`
#

CREATE TABLE gsm (
naam varchar(40) NOT NULL default '',
nummer varchar(40) NOT NULL default ''
) TYPE=MyISAM;
Als ik me de SQL lessen nog goed herinner moet je dit doen:

SELECT destination.omshrijving FROM calls,destination WHERE calls.destination = destination.destination

Ik ben er niet 100% zeker van dat dit zo werkt maar ik geloof wel dat je iets met die punten moest doen.

Reageren