| 5:03 pm on Jun 24, 2013 (gmt 0)|
welcome to WebmasterWorld, ricksum!
|What I want to accomplish is to store these three values for later use. |
where and how much later do you want to use these values?
| 5:43 pm on Jun 24, 2013 (gmt 0)|
Actually I would like to use them immediately, just didn't know how to ask it.
Here's the code I'm now using:
IF( LOCATE( ' ', `username` ) >0, SUBSTRING( `username` , 1, LOCATE( ' ', `username` ) -1 ) , `username` )
IF( LOCATE( ' ', `username` ) >0,
SUBSTRING( `username` , LOCATE( ' ', `username` ) +1 ) , NULL )
which allow me to get the first and last names, but I would like to add is a locate an & that would allow me to get the mate's name:
If username = 'Sumrall Glenn R & Julia' the desired result would be memberlast='Sumrall' and memberfirst = 'Glenn R' and another field membermate='Julia'
| 5:56 pm on Jun 24, 2013 (gmt 0)|
What if username is "Smith Johnson Jack & Jill"?
What if username is "Jones Jean Paul & Sibylla"?
| 6:21 pm on Jun 24, 2013 (gmt 0)|
Isn't that the same as Glenn R?
| 6:25 am on Jun 25, 2013 (gmt 0)|
Your data seems to me to not be normalized and that's going to continue to cause trouble forever.
Easiest way around it is to fix the datamodel first. and then clean up the mess.
| 12:10 pm on Jun 25, 2013 (gmt 0)|
Sorry if I seem to be stupid, which I may be, but I've just begun using php/mysql and have no idea what I doing except trying to learn.
What do you mean by 'normalized' and how do I accomplish that?
I've read up on normalization and the most I could determine is to eliminate duplicate columns ... what are the duplicates and then what needs to be done to clean up the mysql mess?
Can you suggest a good tutorial for learning php/mysql.
| 2:35 pm on Jun 25, 2013 (gmt 0)|
Trick is not to store things like "Smith Johnson Jack & Jill"
Store First Name, Last Name, Spouse Name, etc all in separate columns in your database.
Actually: use the relationship capabilities of mysql and store the owner(s) in a separate table from the property and reference them via an intermediate table (as one property can have multiple owners and one owner can own more than one property).
And if you're still learning: stop using the mysql interface, it's obsolete.
Use the mysqli (note the i) interface instead.
| 7:01 pm on Jun 25, 2013 (gmt 0)|
Thanks for the help/info. I'll redesign my db.
One last question are the mysql and mysqli commands the same. If not, how do I implement mysqli?
| 8:10 pm on Jun 25, 2013 (gmt 0)|
I'd suggest to focus a bit on the ability to use prepared statements (they offer quite a bit extra protection against SQL injection if used properly.