Hey all, I am trying to make a news system where I can insert news into a table and then pull the topics and messages from the table. I already got the insert working, now just need some help pulling the info, i am getting some problems and I do not understand why I am getting them. here is what I have that WORKs right now, but as you can tell, it is sloppy and very N00b.
$selecttitles = mysql_query("SELECT title FROM news ORDER BY id DESC");
$titles1 = mysql_fetch_row($selecttitles);
$titles2 = mysql_fetch_row($selecttitles);
echo $titles1[0];
echo $titles2[0];
That gives me the titles, but I do not really want to run the code like that. I have tried doing this and it did not work.
$selecttitles = mysql_query("SELECT title FROM news ORDER BY id DESC");
$titles1 = mysql_fetch_array($selecttitles);
echo $titles1[0];
echo $titles1[1];
This tells me that 1 is not valid array offset, I do have a lot of records in the table. I want them to appear as the last one post first, so that is why I am doing a ORDER By id DESC because ID is a auto_increment.
Please help me a out a little here, I do not have much hair left from me pulling it out trying to get this to work. It is really weird, I thought it would work. Also this did not work
$selecttitles = mysql_query("SELECT title FROM news ORDER BY id DESC");
$titles1 = mysql_fetch_row($selecttitles);
echo $titles1[0];
echo $titles1[1];
I had an old script laying around where I got this last try from and it use to work, but for some reason it is not working now.
I am using the newest PHP(The newest NONBeta, so not the version5) and the MySQL on a XP box.
Thanks