Re: cookie working only 90% array missing one var and sql query burns [YIKES!]

From: Date: Thu, 05 Apr 2001 12:09:21 +0000
Subject: Re: cookie working only 90% array missing one var and sql query burns [YIKES!]
Groups: php.general 
Request: Send a blank email to php-general+get-47245@lists.php.net to get a copy of this message
Correct line: > setcookie ("user_reg[1]" , "$pass_w", $lifetime, "/", ".mydotcom.com"); Now look at this line: > setcookie ("user_reg[2]" , "$full_name", $lifetime, > ".mydotcom.com"); Don't you just hate it when you forget a "/"? ;) -- Plutarck Should be working on something... ...but forgot what it was. ""PHPretard"" <phpretard@yahoo.com> wrote in message news:001501c0bb17$09f7f1a0$1983bc18@pixeldesire... > hi peoples, Im going insane here, I have this script working great except > two things ... > for one , the sql query returns an error that couldnt run the query... > and the second is that the variable $user_reg[2] holds nothing even though > I cheked the html form and also checked the cookie variable and all are set > except [2] . > > heres my script snippet: > > -- > ... > $user_reg[0] = $user_name; > $user_reg[1] = $pass_w; > $user_reg[2] = $full_name; > $user_reg[3] = $email; > $user_reg[4] = $age; > $user_reg[5] = $icq; > $user_reg[6] = $aim; > > function add_newuser() { > $date = gmdate ( "M d Y H:i:s" ); > $sql = "INSERT INTO mytable (user_name, pass_w, full_name, email, > age, icq, aim, date) VALUES ('$user_reg[0]', '$user_reg[1]', '$user_reg[2]', > '$user_reg[3]', '$user_reg[4]', '$user_reg[5]', > '$user_reg[6]', '$date')"; > $connection = mysql_connect("localhost", "mylog", > "mypass") or die > ("Could not connect to database"); > $db = mysql_select_db("mydb",$connection); > $sql_result = mysql_query($sql, $connection) or die ("Couldnt run > query"); > } > ?> > <? > if (isset($newuse) AND $newuse == "yes") { > $lifetime = time() + 180 * 86400; > setcookie ("user_reg[0]" , "$user_name", $lifetime, "/", > ".mydotcom.com"); > setcookie ("user_reg[1]" , "$pass_w", $lifetime, "/", ".mydotcom.com"); > setcookie ("user_reg[2]" , "$full_name", $lifetime, > ".mydotcom.com"); > setcookie ("user_reg[3]" , "$email", $lifetime, "/", > ".mydotcom.com"); > setcookie ("user_reg[4]" , "$age", $lifetime, "/", > ".mydotcom.com"); > setcookie ("user_reg[5]" , "$icq", $lifetime, "/", > ".mydotcom.com"); > setcookie ("user_reg[6]" , "$aim", $lifetime, "/", > ".mydotcom.com"); > add_newuser(); > --

« previous php.general (#47245) next »