[PHP] Re: mysql_fetch_array() doesn't work

2001-09-25 Thread Pedja


array mysql_fetch_row (resource result)

MySql_fetch_array returns an array that corresponds to the fetched row, or
FALSE if there are no more rows. So put MySql_fetch_array in FOR loop. Look
like this:
for ($count = 1; $row = mysql_fetch_row ($query_result_handle); ++$count)
{
...
}

...the same thing with WHILE:
a)
while ($row = mysql_fetch_row ($query_result_handle))
{ 
... 
} 
b)
while (list($first, $second) = mysql_fetch_row($resource)) { 
[...] 
}


"Web User" <[EMAIL PROTECTED]> wrote in message 
008601c1459e$5f853800$6a915fd3@hexiao">news:008601c1459e$5f853800$6a915fd3@hexiao...
> System: PHP4.06 + Mysql3.23.41 Win32 + Apache 1.3.20 Win32 + Win98
> 
> 
>  ..
> ..
> $res=mysql_query($query);
> $num=mysql_num_rows($res);
> for($i=0; $i<$num; $i++){
> $arr=mysql_fetch_array($res);
> ...
> }
> ...
> 
> When PHP is running at the line: $arr=mysql_fetch_array($res);
> The IE always show info as below:
> "Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
> `T_NUM_STRING' in
> c:\program files\apache group\apache\...\page.php on line ..."
> 
> What's the problem wiht mysql_fetch_array() or other?
> 
> Thanks!
> Mike
> 
> 
> 
> 
> 
> 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: problem with arrays. Please Help!!

2001-09-25 Thread Pedja


mixed array_search (mixed needle, array haystack, bool strict)


Searches haystack for needle and returns the key if it is found in the
array, FALSE otherwise. If the third parameter strict is set to TRUE then
the array_search() will also check the types of the needle in the haystack.

function array_search ($needle, $haystack, $strict = FALSE)

foreach (array_keys($haystack) as $key)

if ($strict)

if ($haystack[$key] === $needle) return $key;
}
else

if ($haystack[$key] == $needle) return $key;
}
}
return FALSE;
}





"Ewunia" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> I need some help with checkboxes and multiple arrays,
>
> Here is the peace of code I am working with, and it gives me a list of
> products.
>
> This is the while statement which grabs information from the database:
> $tplv .= "";
> $P.=" if($id == $select[$auctions_count])
>   $P .= " CHECKED";
> $P .= ">";
>
> $tplv .= "$P";
> $tplv .= " value=\"$q[id]\">". $actual."";
> $tplv .= " value=\"$q[price]\">". $actual."";
> $tplv .= " value=\"\" size=\"10\">";
> $tplv .= " value=\"$q[status]\">$stat1";
> $tplv .= "";
>
> and creates someing like this
> checkboxesidpriceshippingstatus
> 11 4.99 1.99 0
> 245.99   2.990
>
> As you can see I have 5 arrays. one is select /checkbox, id, price,
shipping
> and status.
> What I am trying to do is search through the array of checkboxes and if
the
> checkbox is checked I want the information in arrays id, price, shipping,
> status be added to the database.
>
> Ale there need to be a check if the status[] == 0;
> then add the information to a table.
> Can anyone help me to resolve the problem.
>
> Thanks
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: problem with arrays. Please Help!!

2001-09-25 Thread Pedja

function array_search ($needle, $haystack, $strict = FALSE)


foreach (array_keys($haystack) as $key)
{ 
if ($strict) { 
if ($haystack[$key] === $needle) return $key; 
} 
else { 
if ($haystack[$key] == $needle) return $key; 
} 
} 
return FALSE; 
} 


"Ewunia" <[EMAIL PROTECTED]> wrote in message 
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
> 
> I need some help with checkboxes and multiple arrays,
> 
> Here is the peace of code I am working with, and it gives me a list of
> products.
> 
> This is the while statement which grabs information from the database:
> $tplv .= "";
> $P.=" if($id == $select[$auctions_count])
>   $P .= " CHECKED";
> $P .= ">";
> 
> $tplv .= "$P";
> $tplv .= " value=\"$q[id]\">". $actual."";
> $tplv .= " value=\"$q[price]\">". $actual."";
> $tplv .= " value=\"\" size=\"10\">";
> $tplv .= " value=\"$q[status]\">$stat1";
> $tplv .= "";
> 
> and creates someing like this
> checkboxesidpriceshippingstatus
> 11 4.99 1.99 0
> 245.99   2.990
> 
> As you can see I have 5 arrays. one is select /checkbox, id, price, shipping
> and status.
> What I am trying to do is search through the array of checkboxes and if the
> checkbox is checked I want the information in arrays id, price, shipping,
> status be added to the database.
> 
> Ale there need to be a check if the status[] == 0;
> then add the information to a table.
> Can anyone help me to resolve the problem.
> 
> Thanks
> 
> 
> 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] File Uploading

2002-01-21 Thread Pedja Delic

Try this:




- Original Message - 
From: "Uma Shankari T." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 21, 2002 3:34 AM
Subject: [PHP] File Uploading 


> 
> 
> Hello,
> 
>   How to upload files in a particular directory using php script in the
>  browser itself
> 
> 
> Regards,
> Uma
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]