Ivo Pereira Posted December 27, 2009 at 02:35 PM Report Share #302565 Posted December 27, 2009 at 02:35 PM Boas pessoal, é o seguinte, decidi dividir o meu código por funções, como tal, tenho uma página para as funções, e outra que supostamente recorrerá a ela. functions.php: <?php require_once('db/ligar.php'); // functions.php function listagem() { echo "<table width='100%' border='1'>"; echo "<tr>"; echo "<td> </td>"; echo "<td><strong>URL:</strong></td>"; echo "<td><strong>Miniatura:</strong></td>"; echo "<td><strong>Data:</strong></td>"; echo "<td><strong>Título:</strong></td>"; echo "<td><strong>Descrição:</strong></td>"; echo "</tr>"; echo "<tr>"; $sql = mysql_query("SELECT ID FROM tv_noticias ORDER BY date"); for ($pass = 0; $pass < mysql_num_rows($sql); $pass++){ $query = mysql_query("SELECT ID FROM tv_noticias WHERE ID = ".mysql_result($sql, $pass)." LIMIT 1"); echo '<td><input type="radio" name="selectedid" value="'.mysql_result($query, 0).'"/></td>'; $query = mysql_query("SELECT url FROM tv_noticias WHERE ID = ".mysql_result($sql, $pass)." LIMIT 1"); echo '<td><a href="'.mysql_result($query, 0).'" target="_blank">'.mysql_result($query, 0).'</a></td>'; $query = mysql_query("SELECT thumbnail FROM tv_noticias WHERE ID = ".mysql_result($sql, $pass)." LIMIT 1"); echo '<td><a onclick="alert(\''.mysql_result($query, 0).'\')" href="#"><img src="'.mysql_result($query, 0).'" height="60" width="94" alt="'.mysql_result($query, 0).'" border="0" /></a></td>'; $query = mysql_query("SELECT date FROM tv_noticias WHERE ID = ".mysql_result($sql, $pass)." LIMIT 1"); echo '<td>'.mysql_result($query, 0).'</td>'; $query = mysql_query("SELECT title FROM tv_noticias WHERE ID = ".mysql_result($sql, $pass)." LIMIT 1"); echo '<td>'.mysql_result($query, 0).'</td>'; $query = mysql_query("SELECT description FROM tv_noticias WHERE ID = ".mysql_result($sql, $pass)." LIMIT 1"); echo '<td>'.mysql_result($query, 0).'</td>'; echo "</tr>"; echo"</tr></table>"; } ?> teste.php: (o nome da página não é esta, mas isso é irrelevante, e também tirei algo código referente ao design) <?php require_once('functions.php'); listagem(); ?> O erro que me dá é este: Parse error: syntax error, unexpected $end in /v2/gestao/functions.php on line 41 Alguém me pode dar uma mãozinha? 😞 Abraço Link to comment Share on other sites More sharing options...
softklin Posted December 27, 2009 at 05:12 PM Report Share #302609 Posted December 27, 2009 at 05:12 PM Assim de repente, parece que falta a chaveta de fechar a função 'listagem()'. Tem lá a chaveta de fecho do for, mas penso que te esqueceste da outra da função. Nick antigo: softclean | Tens um projeto? | Wiki P@P Ajuda a comunidade! Se encontrares algo de errado, usa a opção "Denunciar" por baixo de cada post. Link to comment Share on other sites More sharing options...
Ivo Pereira Posted December 27, 2009 at 05:24 PM Author Report Share #302615 Posted December 27, 2009 at 05:24 PM Ups, my bad. O PHP tem destas coisas 😞 Resolvido e obrigado 😉 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now