Jump to content

Array Size problem


williamZanelli

Recommended Posts

The problem I;m having now is with Arrays, I'm a Java convert and a newbie to PHP.

 

An  array [returned from the database query] is empty I know this as I do print_r ($result_array) and it prints nothing

 

However when I do use the function count($result_array) it returns 1 - Have I missed something??

 

??? ??? ???

 

Thanks in advance

 

Will

Link to comment
https://forums.phpfreaks.com/topic/112462-array-size-problem/
Share on other sites

I'm using the Smarty framework

 

The code function is

 

	$n = $db->get_row("SELECT `link_field1` FROM " . _link . " WHERE `x_field` = '" .$incomming."' AND `_category` != ". $_cat . " AND `_status` != 'discard'");
	return $n;

 

I could do run a query like

 


"SELECT count(*) FROM " ...

 

But I want to avoid going into the database more than necessary...

 

Hope this code helps

 

Thanks for your help.

 

Will

Link to comment
https://forums.phpfreaks.com/topic/112462-array-size-problem/#findComment-577435
Share on other sites

Yes the code above is inside a fucntion that calls another fucntion [provided by the Smarty Framework] which manages database transactions.

 

Is there any other way other than count/sizeof to check if the size of the results array from the database?

 

Thanks

 

Will

Link to comment
https://forums.phpfreaks.com/topic/112462-array-size-problem/#findComment-577567
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.