navwin » Tech Talk » Geek Stuff » PHP and Mysql
Geek Stuff
Post A Reply Post New Topic PHP and Mysql Go to Previous / Newer Topic Back to Topic List Go to Next / Older Topic
Parker
Member Elite
since 2000-01-06
Posts 3129
ON

0 posted 2004-09-28 01:12 PM


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 8669
Michigan, US
1 posted 2004-09-28 05:31 PM


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 3129
ON
2 posted 2004-09-29 01:18 AM


Ron, are you any good at this php language?

James

Ron
Administrator
Member Rara Avis
since 1999-05-19
Posts 8669
Michigan, US
3 posted 2004-09-29 07:46 AM


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 3129
ON
4 posted 2004-09-29 12:13 PM


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 8669
Michigan, US
5 posted 2004-09-30 05:27 AM


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 3129
ON
6 posted 2004-09-30 02:38 PM


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 3129
ON
7 posted 2004-10-04 03:14 AM


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 8669
Michigan, US
8 posted 2004-10-04 10:17 AM


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 3129
ON
9 posted 2004-10-05 02:05 AM


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 3129
ON
10 posted 2004-10-05 11:47 PM


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

Post A Reply Post New Topic ⇧ top of page ⇧ Go to Previous / Newer Topic Back to Topic List Go to Next / Older Topic
All times are ET (US). All dates are in Year-Month-Day format.
navwin » Tech Talk » Geek Stuff » PHP and Mysql

Passions in Poetry | pipTalk Home Page | Main Poetry Forums | 100 Best Poems

How to Join | Member's Area / Help | Private Library | Search | Contact Us | Login
Discussion | Tech Talk | Archives | Sanctuary