I have a database with three tables. I need to build a fourth table that in an index table summarizing data in the three main tables. I use this index table to show search results in an HTML page, and from the indexed results a link can be clicked to show all the data for a record in the main tables.
I'm trying to write a PHP script that will select rows from the main tables and insert the values of certain columns into the index table. I know the logic to use to accomplish this, but am having trouble writing the INSERT statement correctly. The code I am using that is not working is:
$query = "SELECT * FROM table LIMIT 0,10";
$result = mysql_query($query,$dbcnx);
while ($row = mysql_fetch_array($result)) {
if ($last =! ' ') {
$sndx=soundex($last);
$query1="INSERT INTO index (first, last, day, month, year, sndx, id) VALUES ($row['first'], $row['last'], $row['day'], $row['month'], $row['year'], '$sndx', $row['death_id'])";
$result1=($query1,$dbcnx);
}
}
I believe the problem is withing the $query1 line, but am not sure what's wrong. Is there anyone that can help me figure this out?
Thanks!