Jump to content

Recommended Posts

I'm trying to make it where I can have a "Global Message" on my site.  It will appear under the logo. I can do that part (lolbasic), but I have a page only accessable to admins/mods (that works too).

 

2 files are involved, template.php and global_message.php.

global message.php is the file that contains the text box and submit button. It will send the text in the box to the mysql database 'atbbs' and the table 'glbmsg'

The table has 2 fields:

no (AI)

text

 

I need to know what mysql query I should run to get the highest 'no' and the 'text' that goes with it.

 

Tell me if I need to elaborate,

FS

It will retrieve one record.

Could you help me with this too?

I have the code

$glob_msg = $result;

and in my browser it returns:

Catchable fatal error: Object of class mysqli_result could not be converted to string in C:\xampplite\htdocs\includes\template.php on line 83

A few lines prior to and after line 83 of template.php would probably be helpful.

Actually, line 83 is where $glob_msg is echo'ed.

 

Yeah, I figured that. Read my last post again.

I think it will have something to do with getting the `text` and making it the $glob_msg (if you know what I mean). I have little idea how to do this. (as you can see, I am new to mysql + php, and I learn by example) Do you have a link or could you explain?

Can you post some relevant code? Were not mind readers.

 

You are trying to echo a mysqli_result object. Objects can not be echo'd. See here for an example of what needs to be done with your object in order for you to extract its data.

 

as you wish.

{
$mys = "SELECT `text` FROM glbmsg ORDER BY no DESC LIMIT 1";
mysql_query($mys,$con);
$glob_msg = $result;
}

?>


<h1 id="logo">
<a rel="index" href="/"><?php echo SITE_TITLE . "<br>" . $glob_msg?></a>
</h1>

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.