Jump to content
  • 0

pomoc detekce portu podla DB


Deleted User

Dotaz

12 odpovědí na tuto otázku

Recommended Posts

  • 0

tak pouzij AUTO_INCREMENT ne ? :) jako primary key. tzn ze se bude pricitat porad 1. auto_increment nastav na 7777 ...

 

tedy

 

CREATE TABLE `users`

(

`port` int(100) NOT NULL auto_increment,PRIMARY KEY (`port`)

) AUTO_INCREMENT=7777 ;

Link to comment
Share on other sites

  • 0

to auto_increment nastav userum jako jejich ID, dle necj pouzij funkci mysql_insert_id, tabulku `port` pouzij normalne. a trebas sem narychlo ti napsal takovou funkci nejak takto logicky dle posledniho zaznamu...

 

 

function _PosledniPort()

{

$query = mysql_query("SELECT LAST_INSERT_ID() FROM `users`") or die("error");

$array = mysql_fetch_array( $query );

//------------

if($array)

{

return $array["port"];

}

}

 

tedy

 

<?php

 

echo _PosledniPort(); // posledni

echo "

"; // konec radku

echo _PosledniPort()+1; // nasledujci

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...