Re: mysql_insert_id() and JOIN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Hi again?
> 
> I dont understand how to use this two?
> 
> I read php.net and other sites, but dont understand...

http://dev.mysql.com/doc/
Available in the major languages, pick your filter and start reading.
Having documentation in your own language may help a lot towards
understanding.

> I have this four tables: table1, 2, 3 and 4
> 
> So the SELECT is like this?:
> 
> <?
> 
> $query_select = "SELECT * FROM table1 FULL JOIN table2 FULL JOIN table3 FULL
> JOIN table4 ON table1.id=table2.id=table3.id=table4.id ORDER BY id ASC?;
> 
> mysql_query($query_select);
> 
> ?>
> 
> This is with FULL JOIN... How identificate the left table if I want to use
> LEFT JOIN?

The left table is the table to the left of the join. So:

SELECT id FROM table1 LEFT JOIN table2...

table1 is the left table and table2 is the right table (if you were to
use a RIGHT JOIN).

> 
> How is the UPDATE?
> 
> And the INSERT I dont understand yet how is it?

UPDATEs and INSERTs follow the same procedure.

When you INSERT an entry into the main table, you then use the function
mysql_insert_id() which will give you the value of the last 'id' column
generated, which you can then use to insert data into the secondary
tables.

> 
> I?m not to do a link between tables in PHPMyAdmin?
> 
>  
> 
> Thank you very... VERY... much!
> 

If you are using MySQL 4.1 or later you should use the mysqli extension
and not the older mysql one. UNLESS you are relying on the older style
passwords, which is a BAD idea.

--
Niel Archer



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux