joecooper Posted May 9, 2006 Share Posted May 9, 2006 I have this 30x30 gridwww.joeyjoe.co.uk/grid.htmland i need to have it so when someone clicks any of the cells, it will change the colour (to lets say black) and who ever veiws the page, will see that same cell as black. im not asking for someone to make this script, i have good knollage of php and mysql but dont know what will be the best way of doing it, to save bandwidth ect. Quote Link to comment Share on other sites More sharing options...
Guest askjames01 Posted May 9, 2006 Share Posted May 9, 2006 I think you are refering to CSS.will that's not PHP anymore. It's CSS. go ahead and read the CSS document manual at the left sideof this forum.GOOD LUCK! Quote Link to comment Share on other sites More sharing options...
joecooper Posted May 9, 2006 Author Share Posted May 9, 2006 you didnt understand what i need. read it though next time please.When a cell is clicked, a query is sent to the database to set a feild named 'select' for corodinates for that cell to 1. and when the page is loaded, it will turn every cell background where the feild 'select' is set to 1.but with 900 cells, it will need to do 900 querys to load a single page...instead of doing it via tables, can easily do it by little 8x8 images. The idea behind it is that the user can click one square per day and certain squares can have a prize behind it. but first i need to make the main bit. Quote Link to comment Share on other sites More sharing options...
ober Posted May 9, 2006 Share Posted May 9, 2006 Updating on the fly is going to require something like AJAX. That doesn't have much to do with PHP except for the simple query on the backend to do the updating.However, I don't recommend using 8x8 images for 900 cells. If you thought running 900 queries was bad (and you wouldn't have to... you could run 1 query to get the status of all the cells at once), imagine the time it would take to load 900 8x8 images. Quote Link to comment Share on other sites More sharing options...
joecooper Posted May 9, 2006 Author Share Posted May 9, 2006 well thats a good idea, having 1 feild in the database hold 900 bytes for all of themso like 00000010000100000101000000100000010101000 would set which ones are on / off. ill look into doing it that way Quote Link to comment Share on other sites More sharing options...
ober Posted May 9, 2006 Share Posted May 9, 2006 WHOA WHOA WHOA....NOT a good idea to do it that way. All you have to do is add a field to each record that contains a 1 or a 0. What happens to the single record idea if you add or remove one? That's a horrible way to go about it.I assume there are other information going along with each one of these records... so when you echo the text or associated image or whatever for the block, you can just run a simple if statement to see if the extra field is a 1 or a 0. 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.