|
|
|
|
![]() ![]() |
Feb 20 2006, 12:15 PM
Post
#1
|
|
|
Member - Active Contributor Group: Members Posts: 98 Joined: 27-January 06 Member No.: 10,907 |
Hey guys i need a simple help
i'm builing a homesite and i have a little spot for news. Well i just place there the Topics and add a link to another page "news.php". Well its obvious that i dont want to build a file for each news that i have so i know that exists a way to work with SQL & PHP. I will show want i'm doing CODE <?php require ('mysql.php'); $query="SELECT * FROM News ORDER BY `data` ASC LIMIT 0,5 "; $result=mysql_query($query); $num=mysql_num_rows($result); mysql_close(); echo "<font color='336699'><b>Outras Other News</b></font><br>"; $i=0; while ($i < $num) { $codigo=mysql_result($result,$i,"codigo"); $foto=mysql_result($result,$i,"foto"); $titulo=mysql_result($result,$i,"titulo"); $subtitulo=mysql_result($result,$i,"subtitulo"); $texto=mysql_result($result,$i,"texto"); $data=mysql_result($result,$i,"data"); echo " <br>"; echo "<li> <a href='news.php?Codigo=$codigo'>$titulo</a></li>"; $i++; } ?> Well this first code get from DB the news and then i've built the link code : CODE echo "<li> <a href='news.php?Codigo=$codigo'>$titulo</a></li>"; Now i've build the news.php. My Questions is this : I can't get data. There the news.php code CODE <?php include ('mysql.php'); $select= "SELECT FROM news Where Codigo='$codigo' ORDER BY `data` ASC"; $selectdo=mysql_query($select); $num=mysql_num_rows($result); mysql_close(); $i=0; while ($i < $num) { $codigo=mysql_result($result,$i,"codigo"); $titulo=mysql_result($result,$i,"titulo"); $i++; } ?> Whats its rong ? give me an help This post has been edited by miCRoSCoPiC^eaRthLinG: Feb 20 2006, 01:41 PM |
|
|
|
Feb 20 2006, 05:57 PM
Post
#2
|
|
|
Member - Active Contributor Group: Members Posts: 98 Joined: 27-January 06 Member No.: 10,907 |
I've resolved my problem
i just needed to add : $_GET['codigo']; before CODE ... $query="SELECT * FROM News ORDER BY `data` ASC LIMIT 0,5 "; $result=mysql_query($query); $num=mysql_num_rows($result); ... |
|
|
|
Feb 21 2006, 07:29 AM
Post
#3
|
|
|
Veteran Nut Group: Members Posts: 527 Joined: 4-October 05 From: UK Member No.: 8,895 |
***TOPIC RESOLVED. CLOSED.***
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 5th December 2008 - 01:33 AM |