Re: [PHP] Warning Extract
I meant there is no row in table members where username='$logname', whatever value $logname contains. Don't forget to run session_start() at the begining of every script. Andy wrote: logname is not in my database. It is a session variable used to hold the members login name. In the form it is session_register('logname'); which is then set to a variable with this code: if ($num2 > 0) { // password is correct $auth="yes"; $logname=$fusername; $today = date("Y-m-d h:m:s"); $sql = "INSERT INTO login (username,loginTime) VALUES ('$logname','$today')"; does that make any sense? Andy "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Andy wrote: (and Marek fixed) $connection = mysql_connect($host, $user,$password) or die ("Couldn't connect to server."); $db = mysql_select_db($database, $connection) or die ("Couldn't select database."); $sql = "SELECT name FROM members WHERE username='$logname'"; $result = mysql_query($sql) or die("Couldn't execute query 1."); if($row = mysql_fetch_array($result,MYSQL_ASSOC)) extract($row); if $logname is not in members table, then your query returns zero rows and mysql_fetch_array returns false. First argument to extract (see manual) must be an array, but is false in your case, and php warns you about that. echo " New Member Welcome etc Thank you all again Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning Extract
logname is not in my database. It is a session variable used to hold the members login name. In the form it is session_register('logname'); which is then set to a variable with this code: if ($num2 > 0) { // password is correct $auth="yes"; $logname=$fusername; $today = date("Y-m-d h:m:s"); $sql = "INSERT INTO login (username,loginTime) VALUES ('$logname','$today')"; does that make any sense? Andy "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > > Andy wrote: (and Marek fixed) > > >$connection = mysql_connect($host, $user,$password) > > or die ("Couldn't connect to server."); > >$db = mysql_select_db($database, $connection) > > or die ("Couldn't select database."); > >$sql = "SELECT name FROM members > > WHERE username='$logname'"; > >$result = mysql_query($sql) > > or die("Couldn't execute query 1."); > >if($row = mysql_fetch_array($result,MYSQL_ASSOC)) extract($row); > > > if $logname is not in members table, then your query returns zero rows > and mysql_fetch_array returns false. First argument to extract (see > manual) must be an array, but is false in your case, and php warns you > about that. > > > echo " > >New Member Welcome etc > > > >Thank you all again > > > >Andy > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning Extract
Andy wrote: (and Marek fixed) $connection = mysql_connect($host, $user,$password) or die ("Couldn't connect to server."); $db = mysql_select_db($database, $connection) or die ("Couldn't select database."); $sql = "SELECT name FROM members WHERE username='$logname'"; $result = mysql_query($sql) or die("Couldn't execute query 1."); if($row = mysql_fetch_array($result,MYSQL_ASSOC)) extract($row); if $logname is not in members table, then your query returns zero rows and mysql_fetch_array returns false. First argument to extract (see manual) must be an array, but is false in your case, and php warns you about that. echo " New Member Welcome etc Thank you all again Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Warning Extract
Help AGAIN!!! Thank you for all the help so far, i am close to getting this members section working correctly now i think! I think i would have given up by now if it were not for the help i get from you all, thank you. I have a warning that i don't understand: Warning: extract() expects first argument to be an array in /home/.sites//New_member.php on line 23 I also find that although i get through to the new members page OK when filling in the form it does not write to the mysql database with the new details, yet if i enter a username that already exists it tells me, so the php and mysql must be interacting. Here is the code for the warning message, hope it helps: $connection = mysql_connect($host, $user,$password) or die ("Couldn't connect to server."); $db = mysql_select_db($database, $connection) or die ("Couldn't select database."); $sql = "SELECT name FROM members WHERE username='$logname'"; $result = mysql_query($sql) or die("Couldn't execute query 1."); $row = mysql_fetch_array($result,MYSQL_ASSOC); extract($row); echo " New Member Welcome etc Thank you all again Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php