PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
$qur = "select id , title from News where 1 order by id desc limit 0, 4";
$res = mysql_query($qur) or die (mysql_error());
while ($row = mysql_fetch_array($res,MYSQL_ASSOC)) {
$id = $row["id"];
$tit = $row["title"];
}
?>
i try to change to swtich and none help he give me the data only for the first id
so how i can do at the i can view the data on the last 4 entered data
i thing not because i dont know from what id is the last on the db table
so where 1 i dont know what is doing there i really whant to know
but some one tell me to puit that there
are you doing anything else insode that while loop? or is this the entire code? in order to use each record in the table your code must reside within the while loop.
what are u mean can u plz show methis is almost the entire code
what i need to do that what the php manual is say to do for get the data so that what i done there is anuder way?
<?php
$qur = "select id , title from News where 1 order by id desc limit 0, 4";
$res = mysql_query($qur) or die (mysql_error());
while ($row = mysql_fetch_array($res,MYSQL_ASSOC)) {
$id = $row["id"];
$tit = $row["title"];
}
print $id;
print $tit;
?>
those two print lines need to be located inside the while loop or else they are only going to print one recorde of your data. this is what it should look like:
<?php
$qur = "select id , title from News where 1 order by id desc limit 0, 4";
$res = mysql_query($qur) or die (mysql_error());
while ($row = mysql_fetch_array($res,MYSQL_ASSOC)) {
$id = $row["id"];
$tit = $row["title"];
print $id;
print $tit;
}
?>
u miss understood me
the prob is
for exp id = 45 is the last info get in
i try to get info form
the id's
45,44,43 and 42
the prob is only 45 is been view so how i can kill this prob
well, show that too. everything that is in that file. it is all part of the same script and is therefore all related. everything that is in that file you should paste into here so we can see what is going on.