Jump to content

[SOLVED] Wheres the error?


Lodius2000

Recommended Posts

im getting a parse error on line 148, which is the line that defines $sql

 

I use pearDB thus the placeholders (they auto escape data) on that line, but either way, I cant find the error

 

<?php
function process_form() {
global $db;
$password = $_POST['password'];
$username = $_POST['username'];
$realname = $_POST['realname'];
$email    = $_POST['email'];

//add user to database
$sql = ('INSERT INTO users (username, password, email, real_name) VALUES (?,?,?,?)', array($username, $password, $email, $realname));

$q = $db->query($sql);

$_SESSION['message'] = "$username has been registered as a user\n";
print '<a href="index.php">Login here</a>';

}
?>

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/141561-solved-wheres-the-error/
Share on other sites

aperantly pear doesnt allow the $q= $db->query($sql) structure

 

I replaced with

$db->query("INSERT INTO users (username, password, email, real_name) 
		VALUES (?,?,?,?)", array($username, $password, $email, $real_name));

 

and all is well

 

SOLVED

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.