snookian Posted February 28, 2013 Share Posted February 28, 2013 Hi guys, I am having a problem with a system im creating with php/mysql, What i need, and this may or not be a good way to do things but its the only way i think of that may work without a full rebuild, anyways I have a form that submits a field to a table (for agrugment sake we shall call it table1 - ID) and on the same form a field that submits to table 2 - code. ID in table 1 is an autoincrement number, code in table 2 is not, but what i need to happen is when the 2 values are submitted for the code in table 2 to be the same as table 1 - ID, now i thought of using @show table status! to show the next increment number at the top of the form and then use that value as the input for code. I have however tried a load of different scripts for the show table and none seem to work , such as: $con = mysql_connect("localhost","jason","admin123","rocketdb"); if (!$con) { die('Could not connect: ' . mysql_error()); } else { $result = mysql_query("SHOW TABLE STATUS LIKE 'quotes'"); $data = mysql_fetch_assoc($result); $next_increment = $data['AUTO_INCREMENT']; $result2 = mysql_query($result) or die($result."<br/><br/>".mysql_error()); } Yet with all the codes i keep getting the error Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given Can someone please help or point me in the right direction. Thanks in advance Ian Link to comment https://forums.phpfreaks.com/topic/275060-show-table-status-or-something-similar/ Share on other sites More sharing options...
Barand Posted February 28, 2013 Share Posted February 28, 2013 Insert into table 1 get id with mysql_insert_id Use this id in table 2 Link to comment https://forums.phpfreaks.com/topic/275060-show-table-status-or-something-similar/#findComment-1415630 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.