homepage Welcome to WebmasterWorld Guest from 23.22.2.150
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
localhost / web - problem in array
deimon



 
Msg#: 4251224 posted 10:41 am on Jan 10, 2011 (gmt 0)

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 ?

 

coopster

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



 
Msg#: 4251224 posted 4:11 pm on Jan 14, 2011 (gmt 0)

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.

deimon



 
Msg#: 4251224 posted 11:01 am on Jan 15, 2011 (gmt 0)

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..

Readie

WebmasterWorld Senior Member



 
Msg#: 4251224 posted 4:13 am on Jan 16, 2011 (gmt 0)

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]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved