[PHP] Mysql join and aliasing with mysql_fetch_object()

2001-08-02 Thread rkirk.com Mail

I'm using a query similar to:

select tableA.*, tableB.* from tableA,
left join tableB ON tableA.keyfield = tableB.keyfield

When I then try to access the column keyfield, after using
mysql_fetch_object() e.g.

$resultObject-keyfield

I get no value returned. What is the correct way to reference a field/column
that has the same name (as it's a primary and foreign key) on both tables?
Is there some syntax like:

$resultObject-tableA.keyfield ?

I've tried specifically aliasing the field on tableA e.g.

select tableA.*, tableA.keyfield AS myKeyField, tableB.* from tableA,
left join tableB ON tableA.keyfield = tableB.keyfield

and then using $resultObject-myKeyField but that doesn't seem to work
either.
I can't find any useful info/examples about this on the PHP site.

Also if I change the query to be:

select tableA.*, tableB.* from tableA, tableB
left join tableB ON tableA.keyfield = tableB.keyfield

adding the joined table to the FROM clause I get an error. Surely this is
the correct syntax and if anything my initial syntax should fail! Am I not
understanding this correctly or is my mySQL manual out of sync?

Please help
Thanks





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


[PHP] urlencode

2001-03-17 Thread rkirk.com Mail

Help - I've a problem when using urlencode/decode functions (same with
rawurl...).
If I encode :
mnemonic = "lnkphoto"

I get:
mnemonic+%3D++%22lnkphoto%22

And if decode it during the same script execution it converts back to
exactly:
mnemonic = "lnkphoto"
which is what I'd expect.

However, if I pass this value as a URL argument and decode it in the
receiving script I get:
mnemonic = \"lnkphoto\"
which causes me all sorts of problems!
Is this a "feature" or have I misunderstood the way this should work?

Thanks





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]