Bwilly Posted January 8, 2009 Report Share Posted January 8, 2009 (edited) I am just stating to play around with php and mysql so don't beat me up to much I have a database set up already with tables and our customer info inputed into the tables already, we are in the vehicle detailing business and would like to be able to allow our customers to be able to access the status of there boat detailing but only there info and not the others in the database. I have been able to connect the database and retrieve data but only everyones data and Im starting to think this is way over my head, so any help would be greatly appreciated, thanks. Edited January 8, 2009 by Bwilly Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 8, 2009 Report Share Posted January 8, 2009 Probably the easiest way is to do this is assign each customer a unique id #, and then link each of the boats in the database to that customer id. Linked by the id number, you could then choose to retrieve specific data per customer, rather than all of the data at once. Make sense? Quote Link to comment Share on other sites More sharing options...
Bwilly Posted January 8, 2009 Author Report Share Posted January 8, 2009 I did setup an id table in the database and have the auto option turned on, is this what you are refering to? sorry Im a little green so please bare with me, also how would the client gain access to this by submitting the id in a form? Right now we have a secured area in our website using SSL and I give them a password to login but it has all our boating customers info in there and I would like to make this more private and secure by using the database and php. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 8, 2009 Report Share Posted January 8, 2009 I'd have to look at your database, but yes, it sounds like you have the right idea. Assuming that you have a table in your database that includes all of your clients (and one unique id # per client) and that you also have a table for each of the boats you work on, with a column for the client with their id... For example: Client #1 has an id of "4", so any of his boats would have an "owners" column with the value "4" You could then use SQL to grab all of the boats in the boat table that match a certain user id, something along the lines of this (I'm not exactly sure if mysql_real_escape_string() is all you need to secure this, so this example may be insecure): $id = mysql_real_escape_string($_GET['id']); $query = "SELECT * FROM boats WHERE owner = $id"; You may have to do a bit of experimenting, but I believe that should work. More info: (http://www.tizag.com/mysqlTutorial/mysqlwhere.php) If you are new to PHP, take a look at Stefan's videos on killerphp, and definitely look at videos on phpvideotutorials too -- it's been really helpful to me. Quote Link to comment Share on other sites More sharing options...
Bwilly Posted January 8, 2009 Author Report Share Posted January 8, 2009 Yes I have looked at his tutorials very nicely done, but there just is not enough info there to accomplish what I would like to do on our website as I think there may be more coding there than I am capible of doing with just a few tutorials:) It is mind boggling as to all of the functions, arrays, querys and so on. I guess I have been playing around with html way to long. I have a few php scripts on our website right now such as phpbb3 and online support but they were pretty much self install stuff so I have not played around with the code end of it much. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 8, 2009 Report Share Posted January 8, 2009 As I have been finding, it's best to start small, so it won't seem quite so overwhelming. Perhaps get your database set up first.... Then figure out how to pull out specific records (like my example above) then worry about how the user will see this data, etc. Don't attempt to write a huge application -- write a small one and slowly add to it. Quote Link to comment Share on other sites More sharing options...
Bwilly Posted January 8, 2009 Author Report Share Posted January 8, 2009 Thanks for your great suggestions and your help, I will do as you suggest and just continue to work on it and learn more about the language and add as I go, again thaks for the support much appreciated. 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.
Note: Your post will require moderator approval before it will be visible.