SQL table data appears after html but called earlier.
SQL table data appears after html but called earlier.
am 14.11.2007 14:44:45 von matthew
Sorry if this is a newbie question I can't seem to find the answer with
web searches, prob. wrong search query but can't get it right.
My PHP file does some database processing, of various kinds, and displays
some of the returned data in html. When the PHP file is at the end of its
processing two final functions are called, the FIRST function called makes
a SQL query and calls another function to display the returned rows in an
html table. The SECOND function called just displays the copyright info.
line and html menu that is always at the bottom of the site's webpages.
However when testing the file, I've noticed that the html table created by
the FIRST function call is displayed below the info. line and html menu
which are the result of the SECOND function call. This is the wrong way
around and, from the site's aesthetic point of view, unacceptable.
I'm not really sure why this is happening, or how I stop it and get the
PHP to display the html in the order which I want. Any help would be most
welcome. Thanks to all you PHPers. Matthew.
Re: SQL table data appears after html but called earlier.
am 14.11.2007 17:00:49 von Courtney
Matthew wrote:
> Sorry if this is a newbie question I can't seem to find the answer with
> web searches, prob. wrong search query but can't get it right.
>
> My PHP file does some database processing, of various kinds, and
> displays some of the returned data in html. When the PHP file is at the
> end of its processing two final functions are called, the FIRST function
> called makes a SQL query and calls another function to display the
> returned rows in an html table. The SECOND function called just displays
> the copyright info. line and html menu that is always at the bottom of
> the site's webpages. However when testing the file, I've noticed that
> the html table created by the FIRST function call is displayed below the
> info. line and html menu which are the result of the SECOND function
> call. This is the wrong way around and, from the site's aesthetic point
> of view, unacceptable.
>
> I'm not really sure why this is happening, or how I stop it and get the
> PHP to display the html in the order which I want. Any help would be
> most welcome. Thanks to all you PHPers. Matthew.
Chances are this is not a PHP problem at all. Is an HTML bug in your
display.
I've done this so many times..incomplete table rows, odd format commands
that confuse the browser.
If you have firefox, set the error console on and load the page. Grosser
errors will show up in that, also 'view page source' will confirm if the
PHP is spitting them out in the correct order.
No magic fixes. Just tedious poring over output and tag matching..
Re: SQL table data appears after html but called earlier.
am 14.11.2007 17:21:57 von matthew
The Natural Philosopher emailed this:
> Matthew wrote:
>> Sorry if this is a newbie question I can't seem to find the answer
>> with web searches, prob. wrong search query but can't get it right.
>>
>> My PHP file does some database processing, of various kinds, and
>> displays some of the returned data in html. When the PHP file is at
>> the end of its processing two final functions are called, the FIRST
>> function called makes a SQL query and calls another function to
>> display the returned rows in an html table. The SECOND function called
>> just displays the copyright info. line and html menu that is always at
>> the bottom of the site's webpages. However when testing the file, I've
>> noticed that the html table created by the FIRST function call is
>> displayed below the info. line and html menu which are the result of
>> the SECOND function call. This is the wrong way around and, from the
>> site's aesthetic point of view, unacceptable.
>>
>> I'm not really sure why this is happening, or how I stop it and get
>> the PHP to display the html in the order which I want. Any help would
>> be most welcome. Thanks to all you PHPers. Matthew.
>
> Chances are this is not a PHP problem at all. Is an HTML bug in your
> display.
>
> I've done this so many times..incomplete table rows, odd format commands
> that confuse the browser.
>
> If you have firefox, set the error console on and load the page. Grosser
> errors will show up in that, also 'view page source' will confirm if the
> PHP is spitting them out in the correct order.
>
> No magic fixes. Just tedious poring over output and tag matching..
Many, many, thanks. You're absolutely right. Viewing the source shows the
html is in the correct order (quite why I didn't check this earlier is
beyond me), so there must be errors in my html. Predicted tedious time,
coming up...
Re: SQL table data appears after html but called earlier.
am 14.11.2007 17:30:55 von matthew
>> No magic fixes. Just tedious poring over output and tag matching..
>
> Many, many, thanks. You're absolutely right. Viewing the source shows
> the html is in the correct order (quite why I didn't check this earlier
> is beyond me), so there must be errors in my html. Predicted tedious
> time, coming up...
Not so tedious after all, I left the tag out. :)
What an idiot I am. Actually it went wrong when I re-did the php function
structure, it was in there, but when the functions were changed I forgot
to put the end table tag in it's new location and forgot all about it.
Fast-Fwd a few days and 'there's something wrong with php!'. Nubies, what
a bunch of idiots. ;-)
Re: SQL table data appears after html but called earlier.
am 14.11.2007 17:50:07 von Michael Fesser
..oO(Matthew)
>Not so tedious after all, I left the tag out. :)
Next time check your HTML with to easily spot
such errors. In the Opera browser all it takes is a hotkey to call the
validator, in other browsers you might have to pass a URL or the source
code.
Micha
Re: SQL table data appears after html but called earlier.
am 14.11.2007 18:49:28 von Jerry Stuckle
Matthew wrote:
>>> No magic fixes. Just tedious poring over output and tag matching..
>>
>> Many, many, thanks. You're absolutely right. Viewing the source shows
>> the html is in the correct order (quite why I didn't check this
>> earlier is beyond me), so there must be errors in my html. Predicted
>> tedious time, coming up...
>
> Not so tedious after all, I left the tag out. :)
>
> What an idiot I am. Actually it went wrong when I re-did the php
> function structure, it was in there, but when the functions were changed
> I forgot to put the end table tag in it's new location and forgot all
> about it. Fast-Fwd a few days and 'there's something wrong with php!'.
> Nubies, what a bunch of idiots. ;-)
>
:-) Don't know how many times I've done that myself.
The line I like the best is when a single '<' displays at the top of the
window...
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: SQL table data appears after html but called earlier.
am 14.11.2007 20:54:31 von matthew
Michael Fesser emailed this:
> .oO(Matthew)
>
>> Not so tedious after all, I left the tag out. :)
>
> Next time check your HTML with to easily spot
> such errors. In the Opera browser all it takes is a hotkey to call the
> validator, in other browsers you might have to pass a URL or the source
> code.
Thanks. I've used it quite a bit in the past actually. Cheers.