Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[SOLVED]More PHP help - Tables

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Localhost
I post too much
Reputation: 0

Joined: 28 Apr 2007
Posts: 3402

PostPosted: Sun May 04, 2008 8:51 pm    Post subject: [SOLVED]More PHP help - Tables Reply with quote

http://pastebin.com/m4e7f6da7

Yeah, well this is the problem:

Everytime, say, there is a new message, it does not create a new row in the table, it creates another table.. Which i do not want...

I want one subject/message after another. Which is not working. Please help.

_________________


Last edited by Localhost on Sun May 04, 2008 9:24 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun May 04, 2008 9:10 pm    Post subject: Reply with quote

Code:

while($row = mysql_fetch_array($result))
  {
// From, Subject, Message, Date //
echo "<table border='1'>";
echo "<tr>";
echo "<td>From</td>";
echo "<td>Subject</td>";
echo "<td>Message</td>";
echo "<td>Date</td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $row['from'] . "</td>";
echo "<td>" . $row['subject'] . "</td>";
echo "<td>" . $row['message'] . "</td>";
echo "<td>" . $row['date'] . "</td>";
echo "</tr>";
echo "</table>";
  }


You need to take the table echos out and only echo the <tr> / <td> sections inside the loop.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Localhost
I post too much
Reputation: 0

Joined: 28 Apr 2007
Posts: 3402

PostPosted: Sun May 04, 2008 9:15 pm    Post subject: Reply with quote

I am not understanding what you are saying :\

Take the echos out of what exactly?
And why?

_________________
Back to top
View user's profile Send private message MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun May 04, 2008 9:19 pm    Post subject: Reply with quote

You said you don't want it to create a new table for each post, but instead, just enter the post into the table. You are echoing out a new table inside the while.

Code:
while($row = mysql_fetch_array($result))
  {
// From, Subject, Message, Date //
echo "<table border='1'>";

 //.. other table shit in here ..

echo "</table>";
  }


Notice the <table> </table> in there? Thats why you are getting new tables for each post. Move them outside the loop

Code:
echo "<table border='1'>";

while($row = mysql_fetch_array($result))
{
   echo "<tr>";
   echo "<td>From</td>";
   echo "<td>Subject</td>";
   echo "<td>Message</td>";
   echo "<td>Date</td>";
   echo "</tr>";
   echo "<tr>";
   echo "<td>" . $row['from'] . "</td>";
   echo "<td>" . $row['subject'] . "</td>";
   echo "<td>" . $row['message'] . "</td>";
   echo "<td>" . $row['date'] . "</td>";
   echo "</tr>";
}

echo "</table>";

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Localhost
I post too much
Reputation: 0

Joined: 28 Apr 2007
Posts: 3402

PostPosted: Sun May 04, 2008 9:24 pm    Post subject: Reply with quote

So close Smile But i got it now!

That made it so it didnt make a new table, but it still kept on making From, Subject, ect

So i just moved From,Subject ect out and now it works

Code:

echo "<table border='1'>";
   echo "<tr>";
   echo "<td>From</td>";
   echo "<td>Subject</td>";
   echo "<td>Message</td>";
   echo "<td>Date</td>";
   echo "</tr>";
while($row = mysql_fetch_array($result))
{

   echo "<tr>";
   echo "<td>" . $row['from'] . "</td>";
   echo "<td>" . $row['subject'] . "</td>";
   echo "<td>" . $row['message'] . "</td>";
   echo "<td>" . $row['date'] . "</td>";
   echo "</tr>";
}

echo "</table>";


Thanks Smile

_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites