Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > PHP Development
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-10-2006, 08:17 AM   #1 (permalink)
Rusty073
Junior Member
 
Join Date: Jun 2006
Posts: 1
Default Confused

Please can someone help me I am trying to retrieve info out of a database but all that is happening is it is just repeating the same querie 30 times over
It seems to be just getting the first in the database that match Dash 8 300
<?
mysql_connect(localhost,$username,$password);

@mysql_select_db($database) or die( "Unable to select database");

$dash8300 = "SELECT `Flight_Number` , `Departure_ICAO` , `Arrival_ICAO` , `Departure_Time`
FROM `flights1`
WHERE `Aircraft` = 'Dash 8 300'
ORDER BY `Flight_Number` ASC
LIMIT 0 , 30";

$dash83001 = mysql_query($dash8300) or die(mysql_error());

$row_dash8300 = mysql_fetch_assoc($dash83001);

$totalRows_dash8300 = mysql_num_rows($dash83001);

Thanks in advance
Shane

mysql_close();





?>
Rusty073 is offline   Reply With Quote
Sponsored Links
Old 06-11-2006, 03:59 PM   #2 (permalink)
etono
Moderator
 
Join Date: May 2006
Posts: 86
Default Re: Confused

I didn't immediatly see anything wrong. Perhaps it is the way you are looping through your array? Try this code, and let me know if it is giving you what you want.
PHP Code:
<?php
//assuming connection is made
$sql "SELECT Flight_Number, Departure_ICAO, Arrival_ICAO, Departure_Time
        FROM flights1
        WHERE Aircraft = 'Dash 8 300'
        ORDER BY Flight_Number ASC
        LIMIT 0, 30"
;
$result mysql_query$sql );
while( 
$row mysql_fetch_array$resultMYSQL_ASSOC ) ) {
    echo 
"Flight Number: {$row['Flight_Number']}<br />Departure ICAO: {$row['Departure_ICAO']}<br />Arrival ICAO: {$row['Arrival_ICAO']}<br />Departure Time: {$row['Departure_Time']}";
}
?>

I have had troubles in the past with quoting of SQL statements so I always use the form wrote above where only values are single quoted and table fields are not quoted at all. Please repost if this solves your problem, or let me know that it is still not working.
__________________
Jeremy Moseley
My Links: Design Related Blog | Personal Website | Portfolio
etono is offline   Reply With Quote
Old 06-22-2006, 07:45 AM   #3 (permalink)
humair
Junior Member
 
Join Date: Jun 2006
Posts: 3
Default Re: Confused

you can also use the for...each function to do the same thing
__________________
http://www.exportersus.com/<- Products and Services
http://www.psocl.com
humair is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 03:10 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums