Jump to content

pumaf1

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

pumaf1's Achievements

Member

Member (2/5)

0

Reputation

  1. wellt he lcioations of the files wont change - i know that much the two tables both have a field called country. on the main table - infobase - it displays text. what i want to be able to do is to connect the two tables by that field (country) and instead of the text being shown i would like it to show the countries flag d
  2. ojk should be read as country not flag - wghoops also why am i going to get into trouble storing that data? sorry for all of the questions
  3. i am trying to store all of the images for some flags in a table called "flags" eg: id - 1 nat - Great Britian flag - <img src = "http://www.pumaf1.org.uk/img/flagico/britain.png" alt="Great Britain"> what i have on the screen at the minute is the words "great britain" (taken from the infobase table) printed what I would like to to link the two database tables via the one page so that the image for the drivers nationality is shown instead of the words. in the case this page http://www.pumaf1.org.uk/drivera.php, taking the united states driver - i would want it to pick out the following record from the flags table (and only display the flag img) id - 2 nat - united states flag - <img src = "http://www.pumaf1.org.uk/img/flagico/united_states.png" alt="United States"> does that help? thanks
  4. // retrieve all the rows from the database $query = "SELECT * FROM infobase JOIN `flags` ON infobase.nat = flags.nat"; $query = "SELECT DISTINCT name, nat FROM infobase WHERE name LIKE 'a%' ORDER BY name asc"; $results = mysql_query( $query ); thats what gets the code from the database <?php while( $contact = mysql_fetch_object( $results ) ) { // print out the info $id = $contact -> id; $name = $contact -> name; $nat = $contact -> nat; $year = $contact -> year; $flag = $contact -> flag; ?> <tr> <td width="31%"><div align="center"> <p><font size="1" face="verdana"><? echo( "$name" ) ;?></font></p> </div></td> <td width="33%"><font size="1" face="verdana"><? echo( "$nat" ) ;?><? echo( "$flag" ) ;?></font></td> <td width="18%"><font size="1" face="verdana"><?php echo( "<a HREF='driveralld.php?name=$name'>Results<br></a>" );?></font></td> <td width="18%"><font size="1" face="verdana"><?php echo( "<a HREF='driverallp.php?name=$name'>Print Version<br></a>" );?></font></td> thats how its printed to the page. thanks
  5. Hi, Sorry about this but I am having problems getting this to work - can I have some further assistance please? I have attached my page code below: you can see the page at http://www.pumaf1.org.uk/drivera.php knid regards <html> <?php // listing script // connect to the server mysql_connect( 'localhost', 'web16-results', '*******' ) or die( "Error! Could not connect to database: " . mysql_error() ); // select the database mysql_select_db( 'web16-results' ) or die( "Error! Could not select the database: " . mysql_error() ); // retrieve all the rows from the database $query = "SELECT * FROM infobase JOIN `flags` ON infobase.nat = flags.nat"; $query = "SELECT DISTINCT name, nat FROM infobase WHERE name LIKE 'a%' ORDER BY name asc"; $results = mysql_query( $query ); // print out the results if( $results ) { ?> <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#0000FF" alink="#0000FF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><div align="center"> </div> <div align="center"><font size="2" face="verdana"> <? include 'header.php' ?> </font> </div> <div align="center"> <table width="770" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="57" valign="top"> <p> </p> <table width="516" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#FFFFFF"><div align="center"><font color="#0000FF" face="verdana"><strong>"A"</strong></font></div></td> </tr> <tr> <td height="1" bgcolor="#CCCCCC"></td> </tr> </table> <table width="516" border="0" align="center" cellpadding="1" cellspacing="1"> <?php while( $contact = mysql_fetch_object( $results ) ) { // print out the info $id = $contact -> id; $name = $contact -> name; $nat = $contact -> nat; $year = $contact -> year; $flag = $contact -> flag; ?> <tr> <td width="31%"><div align="center"> <p><font size="1" face="verdana"><? echo( "$name" ) ;?></font></p> </div></td> <td width="33%"><font size="1" face="verdana"><? echo( "$nat" ) ;?><? echo( "$flag" ) ;?></font></td> <td width="18%"><font size="1" face="verdana"><?php echo( "<a HREF='driveralld.php?name=$name'>Results<br></a>" );?></font></td> <td width="18%"><font size="1" face="verdana"><?php echo( "<a HREF='driverallp.php?name=$name'>Print Version<br></a>" );?></font></td> </tr> <tr> <td colspan="4" height="1" bgcolor="#CCCCCC"></td> </tr> <? } } else { die( "Sorry we are having a database problem, please contact admin and report the following error : " . mysql_error() ); } ?> </table> <p> </p> <div align="center"><a href="javascript:history.go(-1)" class="style1"><font size="2" face="verdana">Back</font></a> </div></td> </tr> </table> <font size="2" face="verdana"> <? include 'footer.php' ?> </font></div> </body> </html>
  6. ahh ok i misunderstood you, how do i get the page which pulls the infobase data out to connect to the flags table?
  7. because i am a newbie and its not being stored in the infobase table due to the fact i would have <img src = "http://www.pumaf1.org.uk/images/flagico/britain.png" alt="Great Britain"> or simalr over 1000 times in the table. :-\
  8. Heres the table structures: Server: localhost Database: web16-results -- phpMyAdmin SQL Dump -- version 2.11.4 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Nov 28, 2008 at 03:23 PM -- Server version: 5.0.67 -- PHP Version: 4.4.8 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `web16-results` -- -- -------------------------------------------------------- -- -- Table structure for table `flags` -- CREATE TABLE `flags` ( `id` int(11) NOT NULL auto_increment, `Country` text NOT NULL, `nat` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -------------------------------------------------------- -- -- Table structure for table `infobase` -- CREATE TABLE `infobase` ( `id` int(7) NOT NULL, `year` text NOT NULL, `date` text NOT NULL, `event` text NOT NULL, `round` text NOT NULL, `country` text NOT NULL, `track` text NOT NULL, `pos` text NOT NULL, `points` int(2) NOT NULL, `name` text NOT NULL, `nat` text NOT NULL, `team` text NOT NULL, `engine` text NOT NULL, `Chassis` text NOT NULL, `tyres` text NOT NULL, `laps` text NOT NULL, `racetime` text NOT NULL, `class` text NOT NULL, `reason` text NOT NULL, `grid` text NOT NULL, `weather` text NOT NULL, `inputted` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  9. Hi, I wonder if someone could help me. I have two tables within the same database. one called infobase and one called flags. I am displaying data from the infobase table on a page ( http://www.pumaf1.org.uk/drivera.php ) and I would like to have an image for the drivers nationality shown. I know how to actually get the image from the database from within one single table. I have fields in infobase and flags both called "nat". for example both contain a value of "Great Britain". What i want to do is on http://www.pumaf1.org.uk/drivera.php is to show the flag by the drivers name, but to do this I am unsure of how to do it. (I am doing this to purely save on disc space and a field on each record filled with <img src = "http://www.pumaf1.org.uk/images/flagico/britain.png" alt="Great Britain"> ) any help greatly taken regards dave
  10. thank you - i was loking at php not actually on the Database - thanks!
  11. Hi, I am trying to write a very simple "noticeboard" app for my website, something very very simple. I would like ti when a user posts a comment for the system to automatically enter the date and time of that post something like dd/mm/yy @ hh:mm I have benen looking all day and I cant see anything for this? can anyone please help me? regards Dave
  12. Of course!!!!!! You know when you have been staring it in the face for ages then leave it.... thanks very much for your help!
  13. sorry I have done some re-gigging so please use this address: http://www.pumaf1.org.uk/ib/drivera.php
  14. Hi, I am trying to write a F1 GP database - Yes i know its been done before but it is just a bit of fun for me. What I want to do is get the a list from my SQL database, in this example we are looking for the drivers surname beginning with the letter A. you can see what I have done so far here: http://www.pumaf1.org.uk/members/ib/drivera.php now then when I try and add a column, in this case to show the drivers Nationality, it wont do it. here is the code I have so far: <html> <?php // listing script // connect to the server mysql_connect( '', '', '' ) or die( "Error! Could not connect to database: " . mysql_error() ); // select the database mysql_select_db( 'web16-results' ) or die( "Error! Could not select the database: " . mysql_error() ); // retrieve all the rows from the database $query = "SELECT * FROM infobase "; $query = "SELECT DISTINCT name FROM infobase WHERE name LIKE 'a%' ORDER BY name asc"; $results = mysql_query( $query ); // print out the results if( $results ) { ?> <body bgcolor="#FFFFFF" text="#000000" link="#FF0000" vlink="#FF0000" alink="#FF0000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><div align="center"> </div> <div align="center"><font size="2" face="verdana"> <? include '../../header.php' ?> </font> </div> <div align="center"> <table width="770" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="57" valign="top"> <p> </p> <table width="247" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#FF0000"><div align="center"><font color="#FFFFFF" face="verdana"><strong>"A"</strong></font></div></td> </tr> <tr> <td><table width="300" border="0" align="center" cellpadding="1" cellspacing="1"> <?php while( $contact = mysql_fetch_object( $results ) ) { // print out the info $id = $contact -> id; $name = $contact -> name; $nat = $contact -> nat; ?> <tr> <td bgcolor="#CCCCCC"><font size="1" face="verdana"><?php echo( "<a HREF='driveralld.php?name=$name'>$name<br></a>" );?></font></td> <td bgcolor="#CCCCCC"><div align="center"><font size="1" face="verdana"><?php print( "$nat" );?></font></div></td> </tr> <? } } else { die( "Sorry we are having a database problem, please contact admin and report the following error : " . mysql_error() ); } ?> </table></td> </tr> </table> <p> </p><div align="center"><a href="javascript:history.go(-1)" class="style1"><font size="2" face="verdana">Back</font></a> </div></td> </tr> </table> <font size="2" face="verdana"> <? include '../../footer.php' ?> </font></div> </body> if anyone could point me in the right direction i would be very happy!
  15. basically becuase i am learning php and dont know how to do that, I dont even know how to correct the problems outlined above!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.