Jump to content

New to php ...help!


Bwilly

Recommended Posts

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 by Bwilly
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...