Geek Stuff |
PHP and Mysql |
Parker Member Elite
since 2000-01-06
Posts 3129ON |
I was directing this to Ron, but anybodys input is goo. I'm just delving into this territory of php/mysql anybody got an opinion on it, good or bad, directions to take etc. Parker |
||
© Copyright 2004 James Haley - All Rights Reserved | |||
Ron
Administrator
Member Rara Avis
since 1999-05-19
Posts 8669Michigan, US |
It's all good. My only warning would be to learn PHP first, becoming reasonably comfortable in that paradigm, before trying to also learn SQL. Download some programs that interest you from one of the many resources available, then change them to do something a bit differently. As you modify someone else's code, you'll likely learn a lot of different ways to do things in PHP, and most importantly, you'll start to "think" in code. When you later tackle the complexities of database design and SQL, it'll seem less daunting than it will if you try to learn both at the same time. Good luck! |
||
Parker Member Elite
since 2000-01-06
Posts 3129ON |
Ron, are you any good at this php language? James |
||
Ron
Administrator
Member Rara Avis
since 1999-05-19
Posts 8669Michigan, US |
The new forums software is being written in PHP (mostly), so let's hope I don't suck too bad. |
||
Parker Member Elite
since 2000-01-06
Posts 3129ON |
Ron, I hope you don't mind me picking your brain now and again, since you probably have alot of experience on this stuff. I've got a query i'm trying to perform that just wont work. Simple, I have a mysql database with say two tables, ones a member list and the other is a profile table. What i'm trying to do is only display the members in the member list that don't have a profile record in the profile table. Its no problem display members with a profile record in the profile table but display members without a matching record I can't get to work. It seems like it should be a short syntax statement. I tried using a join a few times but my skill in sql is not great. Does this sound simple? Parker |
||
Ron
Administrator
Member Rara Avis
since 1999-05-19
Posts 8669Michigan, US |
SELECT Field1, Field2, Field3 FROM Table1 LEFT JOIN Table2 ON Table1.CommonField = Table2.CommonField WHERE Table2.CommonField is null; |
||
Parker Member Elite
since 2000-01-06
Posts 3129ON |
Hi Ron, I'll try that out tonight. does the statement WHERE Table2.CommonField is null; assume that there is not even and entry in that table? Anyway I guess i'll know when I try it. Thanks for the input Parker |
||
Parker Member Elite
since 2000-01-06
Posts 3129ON |
Ron, this is what I tried... not sure whats wrong but it doesn't produce any results. Does this look like it should work. $r9=mysql_query("select id from members, left join profile, on members.id = profile.id where profile.id is null"); $nummems = mysql_num_rows($r9); echo ""; James |
||
Ron
Administrator
Member Rara Avis
since 1999-05-19
Posts 8669Michigan, US |
You have a smattering of commas in there, James, that are not correct (and weren't in my example). Try it without inserting anything extra? |
||
Parker Member Elite
since 2000-01-06
Posts 3129ON |
Ron, Here's what I put in... still no success. $r9=mysql_query("Select id from members LEFT JOIN profile ON members.id = profile.id WHERE profile.id is null"); $nummems = mysql_num_rows($r9); echo ""; |
||
Parker Member Elite
since 2000-01-06
Posts 3129ON |
Well got it to work with this little variation... don't know why the others didn't work... thats code for you. Too picky. $r9=mysql_query("Select members.id from members LEFT JOIN profile ON members.id = profile.id WHERE profile.id is null"); $nummems = mysql_num_rows($r9); echo ""; Thanks for all your help Ron... James |
||
⇧ top of page ⇧ | ||
All times are ET (US). All dates are in Year-Month-Day format. |