xNuminous Posted November 14, 2006 Share Posted November 14, 2006 im wondering if anybody could help me... I need to make a page that displays data from a database, these are tables town and price.EgTown | Pricestevenage 5Hitchin 6Letchworth 10thats how it would be displayedi also need a page to edit/add data to thisif anyone could help/assist it would be much appreciated and credit will be giventhanks in advance, xNuminous. Quote Link to comment Share on other sites More sharing options...
jsladek Posted November 14, 2006 Share Posted November 14, 2006 Not much info there. Are town and price two different tables? Quote Link to comment Share on other sites More sharing options...
xNuminous Posted November 14, 2006 Author Share Posted November 14, 2006 yeah, i just need a basic php page that will display it as shown like in a html table or somethingand as for the edit/add page anything will do i just need to be able to add/edit/delete towns/prices from the 2 tablesthanks, xNuminous Quote Link to comment Share on other sites More sharing options...
jsladek Posted November 14, 2006 Share Posted November 14, 2006 post the sql to create the tables and I'll give you 1 script for each table, that might help you get started. Quote Link to comment Share on other sites More sharing options...
xNuminous Posted November 15, 2006 Author Share Posted November 15, 2006 i already have the tables created i just need to be able to display it edit/add/delete Quote Link to comment Share on other sites More sharing options...
jsladek Posted November 15, 2006 Share Posted November 15, 2006 You have the tables but I do not, I can hook you up with some code to do the basic CRUD functions for each table but I would need to create the tables in my MySql database. If the information is coming out of two tables then what I was planning on doing for you is probably not exactly what you are looking for anyhow but it would be a good start.I don't suspect anyone here is going to be able to give you exactly what you are looking for with the info you have provided..Regards,John Sladek Quote Link to comment Share on other sites More sharing options...
Caesar Posted November 15, 2006 Share Posted November 15, 2006 If Town and Price are two diferent tables in your database, I'm curious as to how on earth you're relating the price to each town. ;) Unless you're leaving something else out. I suggest you go do some reading before tackling these things. And not just jump in blind. Doing that, will actually slow down the learning process.Anyway, you want something to tie the two together. In this very simple example, you have two tables, where records can relate to each other via a unique identifyer such as an id.Table = "town"====================[color=blue][u] id [/u]|[u] town [/u] 1 | Compton 2 | Watts 3 | San Diego 4 | Long Beach[/color]====================Table = "price"====================[color=blue][u] id [/u]|[u] price [/u] 1 | 10 2 | 5 3 | 20 4 | 15[/color]====================[code]<?php $query = $db->query("SELECT * FROM price WHERE id = '$town[id]'"); $price = $db->fetch_array($query);?>[/code]I hope you can understand why I showed the above examples. And you need to write seperate functions to edit/delete. Querying the database for displaying it, is only part of what you want to do. Short of someone here doing it for you, we can't do much more than point you in the right direction. (http://www.php.net) Quote Link to comment Share on other sites More sharing options...
xNuminous Posted November 15, 2006 Author Share Posted November 15, 2006 hm... yeah i dunno how to explain it any better1 database - mysql called database12 tables - town and pricebut caesar what you said is right, sorry im not entirely sure what other information to give youi just need the 2 tables displayed next to each other like caesars example but both next to each othersorry for the hassle everyone and thanks for the help Quote Link to comment Share on other sites More sharing options...
xNuminous Posted November 15, 2006 Author Share Posted November 15, 2006 friendly bump... Quote Link to comment Share on other sites More sharing options...
jpratt Posted November 15, 2006 Share Posted November 15, 2006 my question is this: is there a relation between town and price? can each town have many prices? or does one town have one price and one price have one town? I am failing to understand what you are doing with town and price. Quote Link to comment Share on other sites More sharing options...
xNuminous Posted November 15, 2006 Author Share Posted November 15, 2006 1 town has 1 priceegstevenage - 12 etckinda like how was said before where each town and each price has an id and they need to be displayed next to each other Quote Link to comment Share on other sites More sharing options...
jpratt Posted November 15, 2006 Share Posted November 15, 2006 why do you need two tables then? what would be the purpose? Why not have 1 table with 3 fields? Quote Link to comment Share on other sites More sharing options...
xNuminous Posted November 15, 2006 Author Share Posted November 15, 2006 sorry im not very good with php and mysql its for a company to do with driving lessons, its done in several areas and the prices changes now and again and as you can see im not very good with php/mysql so more than anything we need a way of editing/adding/deleting the feilds like a very simple version of phpadminsorry for all the problems but thanks for the help Quote Link to comment Share on other sites More sharing options...
Caesar Posted November 15, 2006 Share Posted November 15, 2006 I'll code it & do the database design for a percentage of your fee. :-P Quote Link to comment Share on other sites More sharing options...
jpratt Posted November 15, 2006 Share Posted November 15, 2006 This would be a very simple app. Would only need a few simple SELECT, UPDATE, and DELETE statements and a few pages. nothing to difficult. Just read up on some simple principles of mysql and read up on php and how to interact with a mysql db and you should not have any problems with it. A day or two worth of reading should have you up and going. Quote Link to comment Share on other sites More sharing options...
xNuminous Posted November 15, 2006 Author Share Posted November 15, 2006 would anyone be able to help code this? its for a project so it wont be used for the real thing but ill still give you credit Quote Link to comment Share on other sites More sharing options...
craygo Posted November 15, 2006 Share Posted November 15, 2006 We would be able to help no problem, but as stated before, there is no relation from the town table to the price tableyou saystevenage - 12but how is that going to happen. You may know stevenage is 12 but there is no way the query will know. In order for it to work you would have to create a relationtable 1 "town"==================== id | town | priceid 1 | Compton | 1 2 | Watts | 3 3 | San Diego | 2 4 | Long Beach | 2====================Table = "price"==================== id | price 1 | 10 2 | 5 3 | 20 4 | 15====================now you can see that Compton is priceid 1 which is 10 and Watts is priceid 3 which is 20 and so on. You just cannot make a query with 2 tables without relating them.Ray Quote Link to comment Share on other sites More sharing options...
jpratt Posted November 15, 2006 Share Posted November 15, 2006 or just create one table as that is how they belong. Quote Link to comment Share on other sites More sharing options...
xNuminous Posted November 15, 2006 Author Share Posted November 15, 2006 if it is easier as said before to put it in 1 table with 2 fields? and thank you i appreciate your help Quote Link to comment Share on other sites More sharing options...
xNuminous Posted November 15, 2006 Author Share Posted November 15, 2006 friendly bump... =] Quote Link to comment Share on other sites More sharing options...
jpratt Posted November 15, 2006 Share Posted November 15, 2006 I would not have the time for this until monday as I am going out of town. Please let me know if you still need it then. Quote Link to comment Share on other sites More sharing options...
trq Posted November 15, 2006 Share Posted November 15, 2006 What was the bump for? What part exactly are you stuck on? Quote Link to comment Share on other sites More sharing options...
jsladek Posted November 16, 2006 Share Posted November 16, 2006 "like a very simple version of phpadmin"Please try this.. http://www.iobe.net/proj/If you need help with it, let me know... I have an in with the developer....When I asked you to post the SQL to create the tables this is what I was going to run for you....-RegardsJohn Sladek Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.