Jump to content

Recommended Posts

Posted

Hello,

 

I created a mysql query,but it does not work.

 

It outputs no errors , it just won't work.

 

 

<?php

 

Include('config.php');

 

mysql_query("INSERT INTO message(message)

 

 

VALUES (' <font color=green><u>Test.....</u> </font>')

or exit(mysql_error())");

 

?>

 

 

 

Before you ask, Table message does exist,and I know Font is deprecated.

Posted

Try this:

<?php
include('config.php');
mysql_select_db('username_dbname');
mysql_query("INSERT INTO `message` (`message`) VALUES (' <font color=green><u>Test.....</u> </font>')") or exit(mysql_error());
?>

Be sure to change username_dbname to your values.

Posted

Hi Ice, Thank you for your reply.

 

I did what you said, but it still won't work.

 

 

 

There are also no errors being displayed.

Posted

<?php

$config['host'] = "localhost";

$config['user'] = "orb_orb";

$config['pass'] = "********";

$config['db'] = "orb_database";

@mysql_connect("$config[host]","$config[user]","$config[pass]") or die("There was an error connecting to the database, MySql said:<br />".mysql_error()."");

@mysql_select_db("$config[db]") or die("There was an error connecting to the database, MySql said:<br />".mysql_error()."");

?>

 

 

I'm sure there's nothing wrong in config.php, I use it on almost every file.

Posted

Oh! Silly mistake on my end. The MySQL query isn't working because of special characters.

<?php
include('config.php');
$value = addslashes(' <font color=green><u>Test.....</u> </font>');
mysql_query("INSERT INTO `message` (`message`) VALUES ('$value')") or exit(mysql_error());
?>

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...