PHP

PHP

PHP: Gerando nome de arquivo aleatório

Função rand() <? function pegaExtensao($arquivo){ $ext = explode(’.’,$arquivo); $ext = array_reverse($ext); return ".".$ext[0]; } function pegaSomenteNome($arquivo){ $nome = pathinfo($arquivo); return

MySQL, PHP

PHP-MySQL: Trabalhando com função

<? function quantidade(){ $select = "SELECT quantidade FROM qtd_noticias"; $rs = mysql_query($select); while($row = mysql_fetch_array($rs)){ $qtd = $row[’quantidade’]; return $qtd;

MySQL, PHP

PHP-MySQL: Descobrindo a versão do MySQL

<? $result = mysql_query(’SELECT VERSION()’) or die(’Query failed: ‘ . mysql_error()); $mysql_version = mysql_fetch_array($result, MYSQL_ASSOC); echo $mysql_version[’VERSION()’]; ?><? $result =

Rolar para cima