browse: forums | FAQ
Connecting Tech Pros Worldwide

Hey there! Do you need PHP help?

Get answers from our community of PHP experts on BYTES! It's free.

PHP Block in Post Nuke - Problem

Cliff Roman
Guest
 
Posts: n/a
#1: Jul 17 '05
I have been trying to find the answer on the postnuke forums and I have even
tried Sitepoint but I am unable to find an answer. So now I am asking here
in hopes that someone may have an idea


I am trying to put a query in a PHP block. However, when I do.. the block
dissapears.

I will try to explain better..

If I use a query like

$result = mysql_query("Enter Array Query Here");
while ( $row = mysql_fetch_array($result) )
{
ENTER CODE HERE
}


The block does not show up (I KNOW the query and code is good because it
works on a seperate page)


However, queries like the following do work
$query = mysql_query("ENTER QUERY HERE");
$result = mysql_result($query, 0, 0);

Basically.. as soon you use a query with the line of "while ( $row =
mysql_fetch_array($result) )" the block does not show up anymore. As I
said before, I know the query is good and it works, cause I have tested it
on seperate pages and have even used the most basic of queries.

When I say dissapear.. I do mean exactly that. If you use the 2nd query
that I posted.. you can see the block on the front page. As soon as I
change it to the other kind of query the block dissapears and is no longer
visable.

Anyone have any ideas? Or maybe have another way that I can accomplish the
query that I am trying to get without using hte "while.." line? Basically
I am trying to get FirstName, LastName and SUM(Posts) out of a table and
sort them by SUM(Posts), keeping the top 3

Thanks





Charles E. Pelkey
Guest
 
Posts: n/a
#2: Jul 17 '05

re: PHP Block in Post Nuke - Problem


Have added any sql error checking??
Use the mysql_error( ) function to retrieve any errors between the query,
the fetch_array and the display of the rows.
The syntax you show in your examples is commonly used, and I for one can not
duplicate your problem using your example.

-Charles

"Cliff Roman" <cliff@nospam.theromans.us> wrote in message
news:BctZa.113637$o%2.49314@sccrnsc02...[color=blue]
> I have been trying to find the answer on the postnuke forums and I have[/color]
even[color=blue]
> tried Sitepoint but I am unable to find an answer. So now I am asking[/color]
here[color=blue]
> in hopes that someone may have an idea
>
>
> I am trying to put a query in a PHP block. However, when I do.. the block
> dissapears.
>
> I will try to explain better..
>
> If I use a query like
>
> $result = mysql_query("Enter Array Query Here");
> while ( $row = mysql_fetch_array($result) )
> {
> ENTER CODE HERE
> }
>
>
> The block does not show up (I KNOW the query and code is good because it
> works on a seperate page)
>
>
> However, queries like the following do work
> $query = mysql_query("ENTER QUERY HERE");
> $result = mysql_result($query, 0, 0);
>
> Basically.. as soon you use a query with the line of "while ( $row =
> mysql_fetch_array($result) )" the block does not show up anymore. As I
> said before, I know the query is good and it works, cause I have tested it
> on seperate pages and have even used the most basic of queries.
>
> When I say dissapear.. I do mean exactly that. If you use the 2nd query
> that I posted.. you can see the block on the front page. As soon as I
> change it to the other kind of query the block dissapears and is no longer
> visable.
>
> Anyone have any ideas? Or maybe have another way that I can accomplish[/color]
the[color=blue]
> query that I am trying to get without using hte "while.." line?[/color]
Basically[color=blue]
> I am trying to get FirstName, LastName and SUM(Posts) out of a table and
> sort them by SUM(Posts), keeping the top 3
>
> Thanks
>
>[/color]


Cliff Roman
Guest
 
Posts: n/a
#3: Jul 17 '05

re: PHP Block in Post Nuke - Problem


In Postnuke?

I have tried it on all 3 of my Postnuke sites and as soon as I do any query
like that the block dissapears.

I am stumped.. Guess I will just work around it and store temp results in
the database and call them out

"Charles E. Pelkey" <cpelkey@charter.net> wrote in message
news:vjenrrgg11gtda@corp.supernews.com...[color=blue]
> Have added any sql error checking??
> Use the mysql_error( ) function to retrieve any errors between the query,
> the fetch_array and the display of the rows.
> The syntax you show in your examples is commonly used, and I for one can[/color]
not[color=blue]
> duplicate your problem using your example.
>
> -Charles
>
> "Cliff Roman" <cliff@nospam.theromans.us> wrote in message
> news:BctZa.113637$o%2.49314@sccrnsc02...[color=green]
> > I have been trying to find the answer on the postnuke forums and I have[/color]
> even[color=green]
> > tried Sitepoint but I am unable to find an answer. So now I am asking[/color]
> here[color=green]
> > in hopes that someone may have an idea
> >
> >
> > I am trying to put a query in a PHP block. However, when I do.. the[/color][/color]
block[color=blue][color=green]
> > dissapears.
> >
> > I will try to explain better..
> >
> > If I use a query like
> >
> > $result = mysql_query("Enter Array Query Here");
> > while ( $row = mysql_fetch_array($result) )
> > {
> > ENTER CODE HERE
> > }
> >
> >
> > The block does not show up (I KNOW the query and code is good because it
> > works on a seperate page)
> >
> >
> > However, queries like the following do work
> > $query = mysql_query("ENTER QUERY HERE");
> > $result = mysql_result($query, 0, 0);
> >
> > Basically.. as soon you use a query with the line of "while ( $row =
> > mysql_fetch_array($result) )" the block does not show up anymore. As I
> > said before, I know the query is good and it works, cause I have tested[/color][/color]
it[color=blue][color=green]
> > on seperate pages and have even used the most basic of queries.
> >
> > When I say dissapear.. I do mean exactly that. If you use the 2nd query
> > that I posted.. you can see the block on the front page. As soon as I
> > change it to the other kind of query the block dissapears and is no[/color][/color]
longer[color=blue][color=green]
> > visable.
> >
> > Anyone have any ideas? Or maybe have another way that I can accomplish[/color]
> the[color=green]
> > query that I am trying to get without using hte "while.." line?[/color]
> Basically[color=green]
> > I am trying to get FirstName, LastName and SUM(Posts) out of a table and
> > sort them by SUM(Posts), keeping the top 3
> >
> > Thanks
> >
> >[/color]
>
>[/color]


Closed Thread