Wanber Posted January 20, 2012 Report Share Posted January 20, 2012 tenho o codigo$query = mysql_query("SELECT * FROM cms_news ORDER BY published DESC LIMIT 1"); while($noticias = mysql_fetch_array($query)) { $id = $n_id; ?> <li id="<?php $n_id = $id + 1; echo $n_id; ?>"><?php echo $noticias['title'] ?></li> <?php } ?>a intenção era que o id seja inicialmente 1 ai no próximo while o id ser 2, 3, etc...mais não funcionou, sera que alguém pode me dizer o que esta errado? Quote Link to comment Share on other sites More sharing options...
0 ESerra Posted January 21, 2012 Report Share Posted January 21, 2012 while($noticias = mysql_fetch_array($query)) { ?> <li id="<?php $id++; echo $id; ?>"><?php echo $noticias['title'] ?></li> <?php } ?> Quote Link to comment Share on other sites More sharing options...
Question
Wanber
tenho o codigo
a intenção era que o id seja inicialmente 1 ai no próximo while o id ser 2, 3, etc...
mais não funcionou, sera que alguém pode me dizer o que esta errado?
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.