Jump to content

Obtaining fields into variable


thefollower

Recommended Posts

Im stuck as this is beyond my realm of thought so i duno what to do.

 

I had the idea of a "letterbox" type thing... whereby your allowed 3 mails to be sent to you then you have "reached max"

now i can create a max and stop more than 3 occuring no problem.

 

But what i now have are:

 

$Message1

$Message2

$Message3

which obtain the 3 messages from my DB table

Then i echo these.

 

But say some one deletes message 2. I want message one to drop down so that any new message will be the top one in the list.

My method maybe a bit complex cos of the way i have coded the current html.

 

I created 3 seperate divs like this :

 

<div id="bv_" style="position:absolute;left:375px;top:468px;width:224px;height:128px;z-index:19" align="center">
<font style="font-size:13px" color="#000000" face="Arial"> Test </font></div>
<div id="bv_" style="position:absolute;left:381px;top:630px;width:224px;height:128px;z-index:20" align="center">
<font style="font-size:13px" color="#000000" face="Arial"> Test2 </font></div>
<div id="bv_" style="position:absolute;left:388px;top:794px;width:224px;height:128px;z-index:21" align="center">
<font style="font-size:13px" color="#000000" face="Arial">Test3 </font></div>

 

where i have "TEST" i will replace with <?= $Message1 ?>/<?= $Message2 ?>/<?= $Message3 ?> once i have done all the connect and query stuff. But mainly im stuck in terms of how to make them drop down in the list when one is removed. So the latest one will be above the others. I have time stamps on the message so i can order them youngest first but how would you echo it to do that?

 

 

Is there a simpler way than i have done it ?

Link to comment
Share on other sites

Easier to store them in an array. eg;

 

<?php

  // run query and place resultant resource within $result.

  $messages = array();
  while ($row = mysql_fetch_assoc($result)) {
    $messages[] = $row['message'];
  }

?>

 

Now you can use $message[0], $message[1] and $message[2].

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.