I'm new to PHP, and I'm having problems with getting error messages to display on multiple lines. My syntax must be wrong, but I haven't been able to figure out the problem.
I've tried:
$query ="INSERT INTO usersTable
VALUES ('0','karen','$encrypted_password')";
$result = mysql_query($query);
if (!$result) {
print "Invalid query: " . mysql_error() . "\n";
print "Whole query: " . $query;
die;
I've also tried:
$query ="INSERT INTO usersTable
VALUES ('0','karen','$encrypted_password')";
$result = mysql_query($query);
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . '\n';
$message .= 'Whole query: ' . $query;
die($message);
Both output this on one line:
kds1973 d27e2a00960df8585d1ccce348ad3eae Invalid query: Duplicate entry 'karen' for key 2 Whole query: INSERT INTO usersTable VALUES ('0','karen','d27e2a00960df8585d1ccce348ad3eae')
Where I want:
kds1973
d27e2a00960df8585d1ccce348ad3eae
Invalid query: Duplicate entry 'karen' for key 2
Whole query: INSERT INTO usersTable VALUES ('0','karen','d27e2a00960df8585d1ccce348ad3eae')
(I know the 2 newlines won't give me exactly what I want, but it should have split it into at least 2 lines.) Can someone help me out?
Thanks!
PETERV
Syracuse, NY &
Boston, MA
I've tried:
$query ="INSERT INTO usersTable
VALUES ('0','karen','$encrypted_password')";
$result = mysql_query($query);
if (!$result) {
print "Invalid query: " . mysql_error() . "\n";
print "Whole query: " . $query;
die;
I've also tried:
$query ="INSERT INTO usersTable
VALUES ('0','karen','$encrypted_password')";
$result = mysql_query($query);
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . '\n';
$message .= 'Whole query: ' . $query;
die($message);
Both output this on one line:
kds1973 d27e2a00960df8585d1ccce348ad3eae Invalid query: Duplicate entry 'karen' for key 2 Whole query: INSERT INTO usersTable VALUES ('0','karen','d27e2a00960df8585d1ccce348ad3eae')
Where I want:
kds1973
d27e2a00960df8585d1ccce348ad3eae
Invalid query: Duplicate entry 'karen' for key 2
Whole query: INSERT INTO usersTable VALUES ('0','karen','d27e2a00960df8585d1ccce348ad3eae')
(I know the 2 newlines won't give me exactly what I want, but it should have split it into at least 2 lines.) Can someone help me out?
Thanks!
PETERV
Syracuse, NY &
Boston, MA