Jump to content

Show table status (Or something similar)


snookian

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.