473,883 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Nested MySQL database call does not return any data

Hi,

I am having a little problem with my PHP - MySQl code, I have two tables
(shown below) and I am trying populate a template page with data from both.
<disclaimer>N ow I would like to say my skills, especially with MySQL are
rudimentary</disclaimer> However my code (link below) fails, the nested
database call does not return any data and this has me stumped. Any help
will be much appreciated.

Many thanks in advance

Simon

http://www.charterflights.co.uk/testcode/code.txt

CREATE TABLE `DESTINATION` (
`ID` int(11) NOT NULL auto_increment,
`AREA_ID` int(11) NOT NULL default '0',
`IATA_CODE` char(3) NOT NULL default '',
`DESTINATION_NA ME` varchar(30) NOT NULL default '',
`GRAPHIC` varchar(30) NOT NULL default '',
`DESCRIPTION` text NOT NULL,
`CONTENT_DESC` text NOT NULL,
`KEYWORDS` text NOT NULL,
UNIQUE KEY `DESTINATION_NA ME` (`DESTINATION_N AME`),
KEY `ID` (`ID`)
) TYPE=MyISAM AUTO_INCREMENT= 17 ;

#
# Dumping data for table `DESTINATION`
#

INSERT INTO `DESTINATION` VALUES (7, 3, 'TFS', 'Tenerife', '', 'The largest
of the Canary Islands has two distinct climates. The south is desert like,
hot and dry, while the north is altogether more lush and tropical, tending
to be cooler and wetter. Tenerife is home to Mount Teide, a giant snow
capped volcano and Spain\'s highest peak. Tenerife started of as winter sun
destination but it is now popular year round and offers many modern well
equipped purpose built resorts and complexes. Tenerife really does have
something for everyone, Las Americas with it\'s strip of bars and clubs and
intense nightlife to specialist golf club resorts and the old colonial charm
of Santa Cruz in the North.', '', '');
INSERT INTO `DESTINATION` VALUES (11, 3, 'FUE', 'Fuerteventura' , '', 'The
second largest Canary Island but the least populated is a beach lovers
dream, offering over 150 separate beaches to choose from. The scenery is
dominated by the island\'s volcanic history and has a bizarre beauty.
Fuerteventura (big wind) is a popular destination for sailors and especially
windsurfers who hold several competitions through out the year. The
atmosphere on the Island is that of peace and quiet and the nightlife is a
lot quieter than that of Tenerife or Gran Canaria.', '', '');
INSERT INTO `DESTINATION` VALUES (12, 3, 'LPA', 'Gran Canaria', '', 'The
capital Las Palmas boasts historic museums, galleries and shops giving it a
very cosmopolitan feel. The Island offers a variety of landscapes unexpected
in a small island, the north is dominated by pine forest and plantations,
the centre is a rugged collection of ravines and cliffs and the south has
long sandy beaches backed by huge sand dunes. After a hard day on one of
Gran Canaria great beaches there plenty of restaurants, bars and clubs to
party the night away in.', '', '');
INSERT INTO `DESTINATION` VALUES (13, 3, 'SPC', 'La Palma', '', 'World
famous for its huge volcanic crater and often referred to as the \'Green
Island\' La Palma is a rocky mountainous island surrounded by cliffs. The
resorts here a small and peaceful with relaxed and friendly atmospheres.
There are a few coves with small beaches of pebbles or black volcanic
sand.', '', '');
INSERT INTO `DESTINATION` VALUES (14, 3, 'ACE', 'Lanzarote', '', 'The
weather systems travelling from the near by Sahara ensures long sunny days
in Lanzarote. The scenery is almost lunar and at \'fire mountain\' you can
see the hissing volcanic activity for yourself. Most resorts are on the
quiet side and cater well for beach and water sports enthusiasts.', '', '');

CREATE TABLE `RESORT` (
`ID` int(11) NOT NULL auto_increment,
`DEST_ID` int(11) NOT NULL default '0',
`RESORT_NAME` varchar(30) NOT NULL default '',
`GRAPHIC` varchar(30) NOT NULL default '',
`DESCRIPTION` text NOT NULL,
KEY `ID` (`ID`)
) TYPE=MyISAM AUTO_INCREMENT= 24 ;

#
# Dumping data for table `RESORT`
#

INSERT INTO `RESORT` VALUES (1, 7, 'Playa Las Americas', '', ' Tenerife\'s
\'most popular resort\' has several beaches, some white sand and some black
and stretches along the coast as far as Los Christianos. The promenade is
lined by shops and restaurants, Las Americas comes alive at night with
Casinos, bars and clubs.\r\nChart er flights from the UK to Tenerife flying
time 4 hours. Airport transfer 30 minutes.');
INSERT INTO `RESORT` VALUES (2, 7, 'Play Paraiso', '', 'Is a small quiet
resort to the north of Las Americas, it is set in a cove with a pebble beach
and a lagoon-style Lido. The are a few restaurants and bars. Transfer time
from Tenerife south airport 1 hour.');
INSERT INTO `RESORT` VALUES (3, 7, 'Playa de la Areina', '', 'Close to the
spectacular cliffs of Los Gigantes with a gently sloping black sand beach
Playa de la AReina offers a selection of bars and restaurants If you fancy a
change of pace then there is a regular bus service into Las americas taking
about 30 minutes. Transfer from Reina Sofia airport takes 1 hour and 45
minutes.');
INSERT INTO `RESORT` VALUES (4, 7, 'Peurto de Santiago', '', 'Set on the
west coast of the island the coast here is suited to walkers, there are
sweeping valleys and small coves to explore. The resort its self offers a
wide selection of shops, bars and restaurants, enough to cater to most
tastes. Transfer time is 1 hour and 45 minutes.');
INSERT INTO `RESORT` VALUES (5, 7, 'Peurto de la Cruz', '', 'The islands
oldest resort and still very popular with Spanish visitors offers a massive
array of shops, bars and restaurants set amongst the towns squares. The Old
town retains much of its Canarian charm. Peurto de la Cruz also offers a
beach front lido and a man made white sand beach at Punta Brava as well as
original stretches of black sand beaches.\r\nCha rters operate UK to Tenerife
south Reina Sofia , Transfer 1 hour 40 minutes. (Although Tenerife North
airport is closer it is only served by scheduled flights from the UK via
Madrid or Barcelona )');
INSERT INTO `RESORT` VALUES (6, 7, 'La Caleta', '', 'This resort is just
outside Las Americas and offers a hand full of bars and a few restaurants as
well as a mini market. There are several black sand beaches to chose from.
Transfer 50 minutes from Reina Sofia airport.');
INSERT INTO `RESORT` VALUES (7, 7, 'Los Christianos', '', 'Now very much a
twin resort with Las Americas, Los Christianos retains a lot of its original
fishing village style. The town centre is a pedestrian zone and there are
many small streets leading off from the town square along which there are
numerous shops and restaurants The town beach is original black sand but the
stretch of beach towards Las Americas boasts a wide sweep of white sand
imported from the Sahara. Night life is quite quiet but the main strip of
Playa de las Americas is only a few minutes taxi ride away. Transfer 25
minutes.');
INSERT INTO `RESORT` VALUES (8, 7, 'Golf de Sur', '', 'As the name suggest
this a custom built golfing resort catered for those looking for a warm golf
holiday year round. Much of the accommodation is time share although some is
available for rental to holiday makers. There are a few bars and
restaurants, and the resort is mid way between the airport and Los
Christianos Transfer 15 minutes.');
Jul 17 '05 #1
2 3959

"Simon dsl.pipex.com>" <simon.perry<AT > wrote in message
news:3f******** **************@ news.dial.pipex .com...
Hi,

I am having a little problem with my PHP - MySQl code, I have two tables
(shown below) and I am trying populate a template page with data from both. <disclaimer>N ow I would like to say my skills, especially with MySQL are
rudimentary</disclaimer> However my code (link below) fails, the nested
database call does not return any data and this has me stumped. Any help
will be much appreciated.

Many thanks in advance

Simon

http://www.charterflights.co.uk/testcode/code.txt

CREATE TABLE `DESTINATION` (
`ID` int(11) NOT NULL auto_increment,
`AREA_ID` int(11) NOT NULL default '0',
`IATA_CODE` char(3) NOT NULL default '',
`DESTINATION_NA ME` varchar(30) NOT NULL default '',
`GRAPHIC` varchar(30) NOT NULL default '',
`DESCRIPTION` text NOT NULL,
`CONTENT_DESC` text NOT NULL,
`KEYWORDS` text NOT NULL,
UNIQUE KEY `DESTINATION_NA ME` (`DESTINATION_N AME`),
KEY `ID` (`ID`)
) TYPE=MyISAM AUTO_INCREMENT= 17 ;

#
# Dumping data for table `DESTINATION`
#

INSERT INTO `DESTINATION` VALUES (7, 3, 'TFS', 'Tenerife', '', 'The largest of the Canary Islands has two distinct climates. The south is desert like,
hot and dry, while the north is altogether more lush and tropical, tending
to be cooler and wetter. Tenerife is home to Mount Teide, a giant snow
capped volcano and Spain\'s highest peak. Tenerife started of as winter sun destination but it is now popular year round and offers many modern well
equipped purpose built resorts and complexes. Tenerife really does have
something for everyone, Las Americas with it\'s strip of bars and clubs and intense nightlife to specialist golf club resorts and the old colonial charm of Santa Cruz in the North.', '', '');
INSERT INTO `DESTINATION` VALUES (11, 3, 'FUE', 'Fuerteventura' , '', 'The
second largest Canary Island but the least populated is a beach lovers
dream, offering over 150 separate beaches to choose from. The scenery is
dominated by the island\'s volcanic history and has a bizarre beauty.
Fuerteventura (big wind) is a popular destination for sailors and especially windsurfers who hold several competitions through out the year. The
atmosphere on the Island is that of peace and quiet and the nightlife is a
lot quieter than that of Tenerife or Gran Canaria.', '', '');
INSERT INTO `DESTINATION` VALUES (12, 3, 'LPA', 'Gran Canaria', '', 'The
capital Las Palmas boasts historic museums, galleries and shops giving it a very cosmopolitan feel. The Island offers a variety of landscapes unexpected in a small island, the north is dominated by pine forest and plantations,
the centre is a rugged collection of ravines and cliffs and the south has
long sandy beaches backed by huge sand dunes. After a hard day on one of
Gran Canaria great beaches there plenty of restaurants, bars and clubs to
party the night away in.', '', '');
INSERT INTO `DESTINATION` VALUES (13, 3, 'SPC', 'La Palma', '', 'World
famous for its huge volcanic crater and often referred to as the \'Green
Island\' La Palma is a rocky mountainous island surrounded by cliffs. The
resorts here a small and peaceful with relaxed and friendly atmospheres.
There are a few coves with small beaches of pebbles or black volcanic
sand.', '', '');
INSERT INTO `DESTINATION` VALUES (14, 3, 'ACE', 'Lanzarote', '', 'The
weather systems travelling from the near by Sahara ensures long sunny days
in Lanzarote. The scenery is almost lunar and at \'fire mountain\' you can
see the hissing volcanic activity for yourself. Most resorts are on the
quiet side and cater well for beach and water sports enthusiasts.', '', '');
CREATE TABLE `RESORT` (
`ID` int(11) NOT NULL auto_increment,
`DEST_ID` int(11) NOT NULL default '0',
`RESORT_NAME` varchar(30) NOT NULL default '',
`GRAPHIC` varchar(30) NOT NULL default '',
`DESCRIPTION` text NOT NULL,
KEY `ID` (`ID`)
) TYPE=MyISAM AUTO_INCREMENT= 24 ;

#
# Dumping data for table `RESORT`
#

INSERT INTO `RESORT` VALUES (1, 7, 'Playa Las Americas', '', ' Tenerife\'s
\'most popular resort\' has several beaches, some white sand and some black and stretches along the coast as far as Los Christianos. The promenade is
lined by shops and restaurants, Las Americas comes alive at night with
Casinos, bars and clubs.\r\nChart er flights from the UK to Tenerife flying
time 4 hours. Airport transfer 30 minutes.');
INSERT INTO `RESORT` VALUES (2, 7, 'Play Paraiso', '', 'Is a small quiet
resort to the north of Las Americas, it is set in a cove with a pebble beach and a lagoon-style Lido. The are a few restaurants and bars. Transfer time
from Tenerife south airport 1 hour.');
INSERT INTO `RESORT` VALUES (3, 7, 'Playa de la Areina', '', 'Close to the
spectacular cliffs of Los Gigantes with a gently sloping black sand beach
Playa de la AReina offers a selection of bars and restaurants If you fancy a change of pace then there is a regular bus service into Las americas taking about 30 minutes. Transfer from Reina Sofia airport takes 1 hour and 45
minutes.');
INSERT INTO `RESORT` VALUES (4, 7, 'Peurto de Santiago', '', 'Set on the
west coast of the island the coast here is suited to walkers, there are
sweeping valleys and small coves to explore. The resort its self offers a
wide selection of shops, bars and restaurants, enough to cater to most
tastes. Transfer time is 1 hour and 45 minutes.');
INSERT INTO `RESORT` VALUES (5, 7, 'Peurto de la Cruz', '', 'The islands
oldest resort and still very popular with Spanish visitors offers a massive array of shops, bars and restaurants set amongst the towns squares. The Old town retains much of its Canarian charm. Peurto de la Cruz also offers a
beach front lido and a man made white sand beach at Punta Brava as well as
original stretches of black sand beaches.\r\nCha rters operate UK to Tenerife south Reina Sofia , Transfer 1 hour 40 minutes. (Although Tenerife North
airport is closer it is only served by scheduled flights from the UK via
Madrid or Barcelona )');
INSERT INTO `RESORT` VALUES (6, 7, 'La Caleta', '', 'This resort is just
outside Las Americas and offers a hand full of bars and a few restaurants as well as a mini market. There are several black sand beaches to chose from.
Transfer 50 minutes from Reina Sofia airport.');
INSERT INTO `RESORT` VALUES (7, 7, 'Los Christianos', '', 'Now very much a
twin resort with Las Americas, Los Christianos retains a lot of its original fishing village style. The town centre is a pedestrian zone and there are
many small streets leading off from the town square along which there are
numerous shops and restaurants The town beach is original black sand but the stretch of beach towards Las Americas boasts a wide sweep of white sand
imported from the Sahara. Night life is quite quiet but the main strip of
Playa de las Americas is only a few minutes taxi ride away. Transfer 25
minutes.');
INSERT INTO `RESORT` VALUES (8, 7, 'Golf de Sur', '', 'As the name suggest
this a custom built golfing resort catered for those looking for a warm golf holiday year round. Much of the accommodation is time share although some is available for rental to holiday makers. There are a few bars and
restaurants, and the resort is mid way between the airport and Los
Christianos Transfer 15 minutes.');

You should raise this post in the MySQL newgroup (I use
mailing.databas e.mysql) - however I've been picking up mysql these past six
months and might be able to help...

First off... you are inserting in to the database (writing data) so of
course, no data will be dumped (read). You need to perform a SELECT query
to dump/read data from the database...

Have you bought a book to teach you MySQL? How did you come up with the idea
that an INSERT would read your database? You'll have a very long road ahead
of you if you don't start off on the right foot and the last thing you want
to do is give up due to frustration that was easily solved....

Jul 17 '05 #2
You should raise this post in the MySQL newgroup (I use
mailing.databas e.mysql) - however I've been picking up mysql these past six months and might be able to help...
Thanks I found it after I posted here!
First off... you are inserting in to the database (writing data) so of
course, no data will be dumped (read). You need to perform a SELECT query
to dump/read data from the database...

Have you bought a book to teach you MySQL? How did you come up with the idea that an INSERT would read your database? You'll have a very long road ahead of you if you don't start off on the right foot and the last thing you want to do is give up due to frustration that was easily solved....


I'm clueless but not that clueless the PHP code I referred to is viewable at
the link just above the relevant table dumps that I included only so people
could see the data structures I am working with.

The fix was a simple typo

$resort_list==@ mysql_query($sq l);

Should have been:

$resort_list=@m ysql_query($sql );

I however was fixated on the problem as being the nesting of two queries and
couldn't see the wood for the trees.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3392
by: apchar | last post by:
I am trying to use php as a kind of servlet to act as a middle man between a java applet and mysql. I know java has jdbc but it's flakey and painful. php access to mysql is much nicer. So I have: 1. An html page that holds the applet. 2. a php page that accepts data submitted to it by the applet via the $_POST array and writes it to the mysql database. This page never makes it to the browser window. 3. a simple Thank you page that shows...
3
8537
by: Me Alone | last post by:
Hello: I am trying to edit some C code I found in "The definitive guide to using, programming, and administering MySQL" by Paul DuBois. This C client program connects and then segfaults when the function load_image is called. Would anyone be able to point me to what I might be doing wrong? Thanks in advance, C Newbie
110
10672
by: alf | last post by:
Hi, is it possible that due to OS crash or mysql itself crash or some e.g. SCSI failure to lose all the data stored in the table (let's say million of 1KB rows). In other words what is the worst case scenario for MyISAM backend? Also is it possible to not to lose data but get them corrupted?
8
3887
by: The Natural Philosopher | last post by:
This is so weird. What I am trying to do is to upload files and stuff them in a mysql database. Everything works except the file content is zero. using the load_file command from mysql command line as 'root' works and i can download the inserted file ok.
6
38547
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get through this without much trouble. Programming knowledge is not required. Index What is SQL? Why MySQL? Installing MySQL. Using the MySQL command line interface
2
2612
by: LeoLassen | last post by:
Hi.. Can anyone help me to make a nested repeater. I use C# (.asp 2.0) and MySQL database. (SORRY IF MY ENGLISH AN'T GOOD. Live in Denmark) I have try to find something on the internet but i can get it right so it works whit MySQL only with MSSQL i can get it to work. <asp:Repeater ID="CategoryList" runat="server" EnableViewState="False"> <ItemTemplate> <h4><%# Eval("Titel") %></h4> <p><%#...
39
5893
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f ISO-8859-1 -t UTF-8 mydb.sql mydb_utf8.sql mysqlCREATE DATABASE mydb_utf8 CHARACTER SET utf8 COLLATE utf8_general_ci;
2
3828
by: floortje | last post by:
Hi, the past few days I have been looking at the nested set model. (http://dev.mysql.com/tech-resources/articles/hierarchical-data.html) Currently i have the following problem: I want to reorder the data alphabetically after a node 1 level deep. Does anyone have a tip / link / know a book / etc on the problem below ? Original data:
1
9604
ssnaik84
by: ssnaik84 | last post by:
Hi Guys, Last year I got a chance to work with R&D team, which was working on DB scripts conversion.. Though there is migration tool available, it converts only tables and constraints.. Rest of things (stored procedures, functions).. we have to manually edit. That time, we face some interesting challenges.. I failed to document all of them, but whatever I can share with u.. I will try.. :) ...
0
9953
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9799
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11166
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10868
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10422
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7980
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7137
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5808
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.