This topic is locked
[SOLVED]

 Registration page - event code

9/26/2010 7:02:24 PM
PHPRunner General questions
R
rod author

I added a telephone field to my Registration page and noticed that it did not correct the format when a user registers with his phone number. I have the event code for "before record updated" working for the edit page on the users table. I am stuck with trying to fix the registration page "after successful registration" event code:
This is what I am trying...



global $conn;

$number = $userdata['cell_phone'];

$number = str_replace(array('(', ')', '-', ' '), '', $number);

if (strlen($number) == 10)

{

$area = substr($number, 0, 3);

$part1 = substr($number, 3, 3);

$part2 = substr($number, 6);
$num = '('.$area.') '.$part1.'-'.$part2;

//********** Update users record ************

$strSQLUpdate("UPDATE users set cell_phone = '".$num."' WHERE id='".$userdata['id']."'");

$db_exec($strSQLUpdate,$conn);

}


This gives me a "Undefined variable: strSQLUpdate" error. Any ideas on fixing this?

Sergey Kornilov admin 9/27/2010

I think you meant

$strSQLUpdate = "UPDATE users set cell_phone = '".$num."' WHERE id='".$userdata['id']."'";


instead of

$strSQLUpdate("UPDATE users set cell_phone = '".$num."' WHERE id='".$userdata['id']."'");
R
rod author 9/27/2010



I think you meant

$strSQLUpdate = "UPDATE users set cell_phone = '".$num."' WHERE id='".$userdata['id']."'";


instead of

$strSQLUpdate("UPDATE users set cell_phone = '".$num."' WHERE id='".$userdata['id']."'");



Funny... Was looking too hard at the placement of the "'" and forgot the = sign!

Also had to remove the $ in front of the db_exec line.
Thanks