Jump to content

sql errorz *SOLVED*


pouncer

Recommended Posts

this is my class_functions.php

[code=php:0]
<?php

require_once("php_classes/class_db.php");

DB::Connect();

class Functions {
// Send a private message to a user.
function SendPrivateMessage($From, $To, $Subject, $Message) {
$privmessage = mysql_query("INSERT INTO private_messages (From, To, Subject, Message, Date_Sent) VALUES('$From', '$To', '$Subject', '$Message', now())") or die (mysql_error());
}

function RegistrationMessage() {
return "Hellogfdhgfdg";
}

}

?>
[/code]

This is my test.php

[code=php:0]
<?php
require_once('php_classes/class_functions.php');

$func = new Functions();
$msg = $func->RegistrationMessage();

$func->SendPrivateMessage("From-Mike", "To-John", "Subject-Welcome to the site", $msg);

?>
[/code]

on test.php though, i keep getting:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'From, To, Subject, Message, Date_Sent) VALUES('From-Mike', 'To-J
Link to comment
https://forums.phpfreaks.com/topic/28279-sql-errorz-solved/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.