I got this code that has to get the last news from the database and print it but the output is weird an instead of printing the last new it prints: "Resource id #4"
anybody knows whats wrong with this code?
mysql_connect ('localhost' , 'root' , '');
mysql_select_db ('db2');
$data = mysql_query ("SELECT * FROM news");
$rowsnum = mysql_num_rows ($data);
$news1 = mysql_query ("SELECT new FROM news WHERE id = '$rowsnum'");
echo $news1;
2006-06-08
03:10:43
·
3 answers
·
asked by
aryaxt
3
in
Computers & Internet
➔ Programming & Design
I have the databass and when i get the number of the rows its exactly the same as number of the rows in database so theres nothing wrong with connecting to the database and getting the information
2006-06-08
03:28:39 ·
update #1
thx M. raja it fixed my problem but i still dont understand wat was wrong with my code lol.
doesnt matter it works now :)
2006-06-08
03:54:59 ·
update #2