Finally figured it out! Simple really!
If you have the above error, check out your reference to your table on the following line:
// Get the records from transition table
$mydata = mysql_query("SELECT * FROM excel.table", $link);
Remember that when calling to another database when connected to your joomla database, you need to make an absolute reference to the database as follows:
// Get the records from transition table
$mydata = mysql_query("SELECT * FROM root_excel.table", $link);
Where root is usually your username for cpanel/phpmyadmin.
I expect this problem only occurs for those who access all these features via PHPMyAdmin.
I hope this helps and I expect that this tutorial would be good as a sticky or FAQ as it works perfectly if you follow (the confusing) instructions point by point.
Thanks
Alex
OK, please bear with me, I'm new to all of this and just kind of fumbling my way through. I've used the script mentioned in this forum, made the changes you noted above, and I'm still getting this error:
Connected successfully
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /hermes/web09/b2318/moo.ozarks2/content/import.php on line 16
Done!
Here is a copy of the script as I've modified for my fields and such.
<?php
$link = mysql_connect('localhost', 'id', 'password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully<br>';
mysql_select_db("farmhand", $link);
// Get the records from transition table
$mydata = mysql_query("SELECT * FROM root_farmhand.farmhand", $link);
//set the counter for the last query
$i=0;
//Add record jos_sobi2_item table
while ($row = mysql_fetch_assoc($mydata)) {
//insert a record into the item table
$results = mysql_query("INSERT INTO jos_sobi2_item (title) VALUES ('".$row['Company']."')", $link);
//get the last item itemid
$itemid = mysql_query("SELECT MAX(itemid) FROM jos_sobi2_item", $link);
$row_itemid = mysql_fetch_row($itemid);
//now build a record for the fields data
$result1 = mysql_query("INSERT INTO jos_sobi2_fields_data (fieldid, data_txt, itemid) VALUES ('1', '".$row['Phone']."', '".$row_itemid[0]."')");
$result2 = mysql_query("INSERT INTO jos_sobi2_fields_data (fieldid, data_txt, itemid) VALUES ('2', '".$row['Fax']."', '".$row_itemid[0]."')");
$result3 = mysql_query("INSERT INTO jos_sobi2_fields_data (fieldid, data_txt, itemid) VALUES ('3', '".$row['First_Name']."', '".$row_itemid[0]."')");
$result4 = mysql_query("INSERT INTO jos_sobi2_fields_data (fieldid, data_txt, itemid) VALUES ('4', '".$row['Last_Name']."', '".$row_itemid[0]."')");
$result5 = mysql_query("INSERT INTO jos_sobi2_fields_data (fieldid, data_txt, itemid) VALUES ('5', '".$row['Email']."', '".$row_itemid[0]."')");
$result6 = mysql_query("INSERT INTO jos_sobi2_fields_data (fieldid, data_txt, itemid) VALUES ('6', '".$row['Website']."', '".$row_itemid[0]."')");
$result7 = mysql_query("INSERT INTO jos_sobi2_fields_data (fieldid, data_txt, itemid) VALUES ('7', '".$row['Street']."', '".$row_itemid[0]."')");
$result8 = mysql_query("INSERT INTO jos_sobi2_fields_data (fieldid, data_txt, itemid) VALUES ('8', '".$row['City']."', '".$row_itemid[0]."')");
$result9 = mysql_query("INSERT INTO jos_sobi2_fields_data (fieldid, data_txt, itemid) VALUES ('9', '".$row['State']."', '".$row_itemid[0]."')");
$result10 = mysql_query("INSERT INTO jos_sobi2_fields_data (fieldid, data_txt, itemid) VALUES ('10', '".$row['Zip']."', '".$row_itemid[0]."')");
$result11 = mysql_query("INSERT INTO jos_sobi2_fields_data (fieldid, data_txt, itemid) VALUES ('11', '".$row['Desc']."', '".$row_itemid[0]."')");
// update the cat_items_relations table
$result14 = mysql_query("INSERT INTO jos_sobi2_cat_items_relations (catid, itemid, ordering) VALUES ('3', '".$row_itemid[0]."', '".$i."')");
$i++;
//now update so the items are published and data is good
$result15 = mysql_query("UPDATE jos_sobi2_item SET published='1', confirm='0', approved='1', archived='0', publish_up=NOW(), publish_down='2050-12-12 00:00:00', checked_out='0', owner='62', ip='127.0.0.1'");
}
echo "Done!";
mysql_close($link);
?>