Jump to content

One simple question and I beleive one complex question.


Attila

Recommended Posts

First question I have a field in a MYSQL database that stores a users blog information.  If the user performs another blog action it adds the two fields together and stores them in the same field.  Am I going to be limited on how long of text I can store in that one field?  Will it eventually capp out? Would I be better to make each user their own table and store each blog as a new record?

 

Ok the above question was a simple question with alot of answers....LOL sorry but thanks.

 

Next question is when I retreive the people from the database I would like to display them diferently.  You can see how I have it displayed here.  http://www.thaczero.com/members.php

I would like to have 2-3 names across but I am not compleatly positive on how to do it.  I would assume I would have to store the data for each colum into an array but not sure how to do it.  Can someone get me going in the correct direction?

 

here is the code I am curently using:

 

<? 
$sql = "SELECT * FROM `Character` ORDER BY `maintoonsname` ASC";
database_connected();
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
?><BR/><br />
<table align="center">
<tr class="cindex">
    	<td>Main Toons Name:</td>
	<td><?php echo '<a href="membersblog.php?Uname='.$row['maintoonsname'].'">'.$row['maintoonsname'].'</a>' ?></td>
  </tr>
<tr class="cindex">
	<td colspan="2"><p align="center"><? echo "<img src=".$row['picture'].">"; ?></p>
	</td>
  </tr>

</table>
<br />
<? } ?>

<p> </p>

Link to comment
Share on other sites

Am I going to be limited on how long of text I can store in that one field?  Will it eventually capp out?

 

Yes but the limit is probably so big it doesn't matter.  But ..

 

Would I be better to make each user their own table and store each blog as a new record?

 

No!  But you can easily store multiple rows in one table, one for each blog entry, and have a "user" column to identify which user the row belongs to.  This will probably make your life easier later than trying to store everything in one big field.

 

Next question is when I retreive the people from the database I would like to display them diferently.  You can see how I have it displayed here.  http://www.thaczero.com/members.php

I would like to have 2-3 names across but I am not compleatly positive on how to do it.  I would assume I would have to store the data for each colum into an array but not sure how to do it.  Can someone get me going in the correct direction?

 

Representation of data in the database and display of the data are two separate things, and you should keep them separate.  You can do something like this:

 

<? 
$sql = "SELECT * FROM `Character` ORDER BY `maintoonsname` ASC";
database_connected();
$result = mysql_query($sql) or die(mysql_error());
$columns = 0;
while($row = mysql_fetch_array($result)) {
  if ($columns == 0) {
    # Start the table and start first row
  } elseif (($columns % 3) == 0) {
    # End a row and start a new row
  }
  # Display this entry's data (but do not start or finish any table row)

  $columns++;
}
# End last row and end table

 

Basically that will execute the code at "End a row and start a new row" every 3 columns.  That way you can put 3 items in a table row, then start a new table row.  Is that what you are looking for?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.