Jump to content

pumaf1

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Everything posted by pumaf1

  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!
  16. I have been working on a new section of my site, of which will be launched early next year. I have been working on this section: http://www.pumaf1.org.uk/infobase/ for a while and thanks to help from here i have pretty much got it running I would like some feedback if at all possible, mainly offf those that know F1 and those that may be able to see ways of improving the way it works. Dont worry about the layout thats going to change its just set out like it is to look like its "being worked on" The whole site www.pumaf1.org.uk is a work in progress and again any comments or suggestions on how to improve it are greatly taken the 2009 site is at www.pumaf1.org.uk/en/ which will be moved over in early 2009. it has little or no formatting, but it has improvements on the news system over the current live version, again any comments will be accepted GOOD or BAD. (and i know a lot of site for F1 exist but its my love and what i REALLY care about!)(aka a hobby)
  17. is that all to the yearalld.php file?
  18. Hi all I am having problems with my script here: http://www.pumaf1.org.uk/infobase/yearall.php what I want it to do is when you select the year, its lists the rounds (which it does) in this case "1970" then i want the user to click the round, say "round 1" and for it to display the list of the results from that year (1970) and display that rounds results (round 1). All I can get is get the *********** thing to list all round 1 results! it works fine upto the point of the round selection: code for the "yearalld.php" file // select the database mysql_select_db( 'web16-results' ) or die( "Error! Could not select the database: " . mysql_error() ); // get the year from URL request $year = $_REQUEST['year']; // retrieve all the rows from the database $query = "SELECT * FROM infobase WHERE `year`='$year' "; $query = "SELECT DISTINCT round FROM infobase ORDER BY round asc"; $results = mysql_query( $query ); // print out the results if( $results ) { ?> <body bgcolor="#000000" background="img/back.jpg" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF"><div align="center"> <p><font size="2"> <? include 'top.php' ?> </font></p> </div> <table width="300" border="0" align="center"> <tr> <td> <div align="center"><font size="2" face="verdana"><span class="style3"></span></font> <font size="2" face="verdana"> </font> <font size="4" face="verdana"><strong>Rounds </strong></font><font size="2" face="verdana"><?php echo( "$year" );?></font><font size="4" face="verdana"><strong> </strong></font></div></td> </tr> </table> <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; $year = $contact -> year; $round = $contact -> round; ?> <tr> <td><div align="center"> <p><font size="2" face="verdana"> <?php echo( "<a HREF='rounds.php?round=$round>$round<br></a>" ); ?> </font></p> </div> </td> </tr> <? } } else { die( "Sorry we are having a database problem, please contact admin and report the following error : " . mysql_error() ); } ?> </table> <p align="center"><a href="javascript:history.go(-1)" class="style1"><font size="2" face="verdana">Back</font></a></p> </body> the code for the round page // select the database mysql_select_db( 'web16-results' ) or die( "Error! Could not select the database: " . mysql_error() ); // get the round and year from the URL request $round = $_REQUEST['round']; $year = $_REQUEST['year']; // retrieve the row from the database $query = "SELECT * FROM `infobase` WHERE `round`='$round'"; $result = mysql_query( $query ); // print out the results if( $result && $contact = mysql_fetch_object( $result ) ) { // print out the info $round = $contact -> round; $year = $contact -> year; ?> <table width="100%" border="0" cellpadding="1" cellspacing="1"> <tr> <th align="left"><div align="center"><font color="#FFFFFF" size="3" face="Arial, Helvetica, sans-serif"><?php echo($round) ?></font></div></th> </tr> <tr> <th align="left"> </th> </tr> <tr> <th align="left"> <?php mysql_select_db($database_results, $results); $query_driver = "SELECT * FROM infobase WHERE `round`='$round' ORDER BY year asc"; $driver = mysql_query($query_driver, $results) or die(mysql_error()); $row_driver = mysql_fetch_assoc($driver); $totalRows_driver = mysql_num_rows($driver); ?> <table width="1028" border="0" align="center" cellpadding="1" cellspacing="1"> <tr bgcolor="#666666"> <td width="67"><div align="center" class="style7"><strong><font size="2" face="verdana"><span class="style5">Year</span></font></strong></div></td> <td width="76"><div align="center" class="style7"><strong><font size="2" face="verdana"><span class="style5">Round</span></font></strong></div></td> <td width="83"><div align="center" class="style7"><strong><font size="2" face="verdana"><span class="style5">Country</span></font></strong></div></td> <td width="70"><div align="center" class="style7"><strong><font size="2" face="verdana">Circuit</font></strong></div></td> <td width="65"><div align="center" class="style7"><strong><font size="2" face="verdana"><span class="style5">Pos</span></font></strong></div></td> <td width="72"><div align="center" class="style7"><strong><font size="2" face="verdana"><span class="style5">Team</span></font></strong></div></td> <td width="82"><div align="center" class="style7"><strong><font size="2" face="verdana"><span class="style5">Engine</span></font></strong></div></td> <td width="68"><div align="center" class="style7"><strong><font size="2" face="verdana"><span class="style5">Tyres</span></font></strong></div></td> <td width="68"><div align="center" class="style7"><strong><font size="2" face="verdana"><span class="style5">Laps</span></font></strong></div></td> <td width="92"><div align="center" class="style7"><strong><font size="2" face="verdana"><span class="style5">Race Time </span></font></strong></div></td> <td width="92"><div align="center" class="style7"><strong><font size="2" face="verdana"><span class="style5">Notes</span></font></strong></div></td> <td width="65"><div align="center" class="style7"><strong><font size="2" face="verdana"><span class="style5">Grid</span></font></strong></div></td> <td width="88"><div align="center" class="style7"><strong><font size="2" face="verdana"><span class="style5">Weather</span></font></strong></div></td> </tr> <?php do { ?> <tr bgcolor="#999999"> <td><div align="center"><font size="2" face="verdana"><?php echo $row_driver['year']; ?></span></font></div></td> <td><div align="center"><font size="2" face="verdana"><?php echo $row_driver['round']; ?></span></font></div></td> <td><font size="2" face="verdana"><?php echo $row_driver['country']; ?></span></font></td> <td><font size="2" face="verdana"><?php echo $row_driver['track']; ?></span></font></td> <td><div align="center"><font size="2" face="verdana"><span class="style3"><?php echo $row_driver['pos']; ?></span></font></div></td> <td><font size="2" face="verdana"><span class="style3"><?php echo $row_driver['team']; ?></span></font></td> <td><font size="2" face="verdana"><span class="style3"><?php echo $row_driver['engine']; ?></span></font></td> <td><font size="2" face="verdana"><span class="style3"><?php echo $row_driver['tyres']; ?></span></font></td> <td><div align="center"><font size="2" face="verdana"><span class="style3"><?php echo $row_driver['laps']; ?></span></font></div></td> <td><font size="2" face="verdana"><span class="style3"><?php echo $row_driver['racetime']; ?></span></font></td> <td><font size="2" face="verdana"><span class="style3"><?php echo $row_driver['reason']; ?></span></font></td> <td><div align="center"><font size="2" face="verdana"><span class="style3"><?php echo $row_driver['grid']; ?></span></font></div></td> <td><font size="2" face="verdana"><span class="style3"><?php echo $row_driver['weather']; ?></span></font></td> </tr> <?php } while ($row_driver = mysql_fetch_assoc($driver)); ?> </table></th> </tr> <tr> <th align="left"><div align="center"><a href="javascript:history.go(-1)" class="style1"><font size="2" face="verdana">Back</font></a></div></th> </tr> </table> <font color="#000000"> <?php } else { die( "Error: Could not get contact from database. ".mysql_error() ); } ?> </td> </tr> <tr> <td></td> </tr> </table> </div> </body> </html> <?php mysql_free_result($driver); ?>
  19. hi, I am writing a fantasy f1 system for 2008. What I have so far is the system taking the records perfectly fine but I want it to check to see if a few things have been duplicated 1 - username the login system uses sessions and i have the users name as the team owners name. I want it to check to see if the user has already registered a team, and if so i want it to say "you already have a team." 2 - teamname pretty much the same as the above - aka that team name is already in use. I dont want it to check all the fields as some will be duplicates within the database. If anyone could point me in the right firection i would be really gratefull. thanks
  20. pumaf1

    Repeat region

    fenway thankyou for your response however i an a total rookie at this, i have allowed dreamweaver to do this in the past and i would love some links to somewhre i could learn from thankyou again dave
  21. sorry should have put the resolution, my apologies From // retrieve all the rows from the database $query = "SELECT * FROM `infobase` ORDER BY team asc"; to // retrieve all the rows from the database $query = "SELECT * FROM infobase"; $query = "SELECT DISTINCT team FROM infobase ORDER BY team asc"; dave
  22. pumaf1

    Repeat region

    sorry this is what I mean 1 - you select a driver - for example Berger, Gerhard from this page - http://www.pumaf1.org.uk/res/infobase/driverall.php 2 - the system then takes you to a page - (which it does) 3 - what it should do is - select ALL the races the driver has driven. (I want to expand on this to limit it to say 50 records per page) hope that helps show you want i want it to do.
  23. Hia All (again), I can get a list of what i want like this: http://www.pumaf1.org.uk/res/infobase/driverall.php (but it need tweaking - under another topic) now i have got it to go to the results page (took me ages) the code: <?php // connect to the server mysql_connect( 'localhost', '', '' ) or die( "Error! Could not connect to database: " . mysql_error() ); // select the database mysql_select_db( '' ) or die( "Error! Could not select the database: " . mysql_error() ); // get the id from the URL request $name = $_REQUEST['name']; // retrieve the row from the database $query = "SELECT * FROM `infobase` WHERE `name`='$name'"; $result = mysql_query( $query ); // print out the results if( $result && $contact = mysql_fetch_object( $result ) ) { // print out the info $name = $contact -> name; ?> no what i want it to do is query the db and bring out all of the records for that driver as defined in $name, for the wholeof that drivers career but limited to a certain number of records. again anyone that can help please do! thanks
×
×
  • 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.