Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6623849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:34:53+00:00 2026-05-25T21:34:53+00:00

I have a simple messaging script that allows the Admin to send pre-defined messages

  • 0

I have a simple messaging script that allows the Admin to send pre-defined messages to the users.

The two fields that seem to prevent the query from completion are the subject and body – the formats within the database are both ‘text’ with default set to NULL. Correlation has been set to latin1_swedish_ci for some reason.

I know these are the error’s as if I make them NULL when inserting them into the database, the entire query is successful.

The query is triggered on a button press (The fault isn’t here as I have queries above that work perfectly).

The two variables are defined as such:

$subject = "You have a new message!";
$body    = "<a href='?page=update'>click here to see it.</a>";

With the mysql query following:

mysql_query("INSERT INTO message VALUES(NULL, '$user_id', '$list_id', $subject , $body, '0', '$query_date_user', '1')");

I have seen a few tutorials on messaging scripts and they all appear to not have any other factors that i have missed out.

Any help would be hugely appreciated.

Many thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:34:54+00:00Added an answer on May 25, 2026 at 9:34 pm

    You’re causing a syntax error with the single quotes (') in your $body variable. Since you don’t have any error handling on the query call, you will not see the messages mysql would be screaming at you.

    Your code should be:

    $subject = mysql_real_escape_string("You have a new message!");
    $body    = mysql_real_escape_string("<a href='?page=update'>click here to see it.</a>");
    $sql = "INSERT INTO message VALUES(NULL, '$user_id', '$list_id', '$subject' , '$body', '0', '$query_date_user', '1')";
    mysql_query($sql) or die(mysql_error());
    

    Note the quotes around the variables inside the query string as well. You cannot insert a raw string into an SQL query and expect it to work.

    BIG NOTE: adding or die(mysql_error()) during your development process helps catch these kinds of errors. If’d you been doing this from the get-go, you’d have seen immediately that there’s a problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a simple messaging system with Rails3 that allows users to send
I have a simple messaging system that up till now uses file based storage.
I have simple win service, that executes few tasks periodically. How should I pass
I have simple issue setting a two-way databinding of a checkbox in Silverlight 3.0.
I have simple HTML code with some JavaScript. It looks like: <html> <head> <script
I have simple WinForms application where modifying Windows Registry. The problem is that in
I have a simple messaging system in Rails with a Message table for the
i have a string like this: some_string=A simple demo of SMS text messaging. +
I have a set of messages, that all derive from Message, and implement the
I have a simple messaging queue setup and running using the Zend_Queue object heirarchy.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.