PHP Arrays and MySQLi

I have a sql table table one where one of the columns, column_int, holds integers:
1-20,
50-60,
100-110,
200-210;
and another column, column_name, that has names:
name1,
name2,
name3,…;

I have also have another table, table two.
This table has a column that also holds integers, however, it collects usr inputs so it may not contain each integer.

it also has another column that holds specific data that i wish to correlate with the integers in table one, respectfully, so the data can be copied with the rows that have the same integer.
ie:
(table one) column_int, column_name : (table two) column_int column_value;
1 , name : 1 , value;
2 , name : (no row with matching integer in table two);
3 , name : 3 , value;
4 , name : 4, value;
5 , name :(no row with matching integer in table two);

15, name :(no row with matching integer in table two);
16, name : 16, value;

;
I want to create an array:
array();
that and use it to get the data from table two to accomplish this.

Sounds like a few joins should do the trick.
Always good to check out php.net it is probably one of the best documentations going around.
http://php.net/manual/en/book.mysqli.php
[php]
$mysqli = new mysqli(“localhost”, “user”, “password”, “database”);
$results = $mysqli->query( "
SELECT column_int, data
FROM table_1
LEFT JOIN table_2 ON (table_1.column_int = table_2.column_int)
LEFT JOIN table_3 ON (table_2.column_int = table_3.column_int)
");
var_dump($results->fetch_all());

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service