Welcome to WebmasterWorld Guest from 54.159.179.132

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

localhost / web - problem in array

   
10:41 am on Jan 10, 2011 (gmt 0)

5+ Year Member



Hello, i have question about this ...


$stare = Array
(
[0] => trapek@academic.cz
[1] => booking@absolutumhotel.cz
)

------

$sql = mysql_query("SELECT objekty.nazev, objekty.email, objekty.expirace, firmy.email as femail FROM firmy, objekty WHERE firmy.id = objekty.idfirmy GROUP BY objekty.email ORDER BY ".$ord);
while ($q = mysql_fetch_array($sql)){ $a = 0;
foreach($stare as $l){ if(($l == $q['email']) OR ($l == $q['femail'])) {$a = 1; break;} else $a = 0; }
if($a == 1) $prava[$q['email']] = $q['nazev']." - ".$q['expirace'];
else $leva[$q['email']] = $q['nazev']." - ".$q['expirace']; }
print_r($prava);

------

On web :........

Array
(
[0] => trapek@academic.cz
[1] => booking@absolutumhotel.cz
[booking@absolutumhotel.cz] => Absolutum - 2011-01-31
[trapek@academic.cz] => Academic hotel & Congress centre - 2009-05-30
)

On localhost ....

Array
(
[booking@absolutumhotel.cz] => Absolutum - 2011-01-31
[trapek@academic.cz] => Academic hotel & Congress centre - 2009-05-30
)


do you know where can be problem ?
4:11 pm on Jan 14, 2011 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Are you certain you are using the same fetch method on both servers? mysql_fetch_array [php.net] and the other mysql fetch methods can return the associative index, numerical index, or in the case of mysql_fetch_array, both. That's what it looks like to me.
11:01 am on Jan 15, 2011 (gmt 0)

5+ Year Member



yes all codes, all databases are same. but if I send script od server nr 1 ... output is Array
(
[0] => trapek@academic.cz
[1] => booking@absolutumhotel.cz
[booking@absolutumhotel.cz] => Absolutum - 2011-01-31
[trapek@academic.cz] => Academic hotel & Congress centre - 2009-05-30
)

now i test second webserver on other server .. and problem isn't there .. output is :

Array
(
[booking@absolutumhotel.cz] => Absolutum - 2011-01-31
[trapek@academic.cz] => Academic hotel & Congress centre - 2009-05-30
)

... as on my PC (localhost)


100% it must be settings of apache or php..
4:13 am on Jan 16, 2011 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



It'll be the settings of your PC that are at fault.

The results on your local PC appear to be the results from mysql_fetch_assoc [uk3.php.net] - however mysql_fetch_array should contain a mysql_fetch_assoc return and a mysql_fetch_row [uk2.php.net]
 

Featured Threads

Hot Threads This Week

Hot Threads This Month