Re: Warning Extract

From: Date: Wed, 02 Apr 2003 16:41:55 +0000
Subject: Re: Warning Extract
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-142009@lists.php.net to get a copy of this message
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" <kilimajer@webglobe.sk> wrote in message news:3E8B116B.1060003@webglobe.sk... > > > 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 "<html> > > <head><title>New Member Welcome</title></head> etc > > > >Thank you all again > > > >Andy > > > > > > > > > > >

« previous php.general (#142009) next »