2nd Pair of eyes please

2nd Pair of eyes please

am 26.01.2011 23:34:34 von dbrooke

O.K., I give up.. I can't seem to find why this breaks the page to
a point where nothing gets displayed in the browser (no error reporting).

Sorry for any email line breaks:


-------start---------
if ($t_dataon) {
$query = "SELECT
s_sitename,s_logopath,s_headinfo,s_head_moreinfo,s_rightpic_ path FROM
site WHERE (s_id=31) LIMIT 1";

if ($a_r = @mysql_query($query)) {
while (list($tname, $tlogo, $thead, $tmorehead, $trpic) =
mysql_fetch_row($a_r)) {
$t_sitename = "$tname";
$t_logopath = "$tlogo";
$t_headinfo = "$thead";
$t_moreheadinfo = "$tmorehead";
$t_rpic = "$trpic";
}
} else {
// Problem with query
print = "";
}
}
--------end---------


If I take it out, the page renders. Any ideas?

TIA,
Donovan



--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: 2nd Pair of eyes please

am 26.01.2011 23:51:46 von Daevid Vincent

> -----Original Message-----
> From: Donovan Brooke [mailto:lists@euca.us]
> Sent: Wednesday, January 26, 2011 2:35 PM
> To: php-db@lists.php.net
> Subject: [PHP-DB] 2nd Pair of eyes please
>
> O.K., I give up.. I can't seem to find why this breaks the page to
> a point where nothing gets displayed in the browser (no error
> reporting).
>
> Sorry for any email line breaks:
>
>
> -------start---------
> if ($t_dataon) {
> $query = "SELECT
> s_sitename,s_logopath,s_headinfo,s_head_moreinfo,s_rightpic_ path FROM
> site WHERE (s_id=31) LIMIT 1";
>
> if ($a_r = @mysql_query($query)) {
> while (list($tname, $tlogo, $thead, $tmorehead, $trpic) =
> mysql_fetch_row($a_r)) {
> $t_sitename = "$tname";
> $t_logopath = "$tlogo";
> $t_headinfo = "$thead";
> $t_moreheadinfo = "$tmorehead";
> $t_rpic = "$trpic";
> }
> } else {
> // Problem with query
> print = "";
> }
> }
> --------end---------

I didn't see anything that jumps out as obvious enough to break your page
render, but...

What's with this stuff...

You already have a string don't put it in " again.

$t_sitename = "$tname";

It should just be:

$t_sitename = $tname;

But even that is silly since you JUST pulled it out in your list(). Cut to
the chase...

list($t_sitename, $t_logopath, $t_headinfo, $t_moreheadinfo,
$t_rpic)

Next, calling the mysql stuff directly like that is not going to scale and
you're asking for troubles down the line. Make a wrapper around the mysql_*
calls so you can do things like error handling on each query (since you
have to do it anyways), escaping the SQL, returning the results in an
array, etc. Search the archives -- I've posted mine a couple of times
already (db.inc.php).


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: 2nd Pair of eyes please

am 27.01.2011 00:52:19 von dbrooke

[snip]
> print = "";

^
Never mind, found it. :-/

Donovan


--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: 2nd Pair of eyes please

am 27.01.2011 11:00:12 von Richard Quadling

On 26 January 2011 23:52, Donovan Brooke wrote:
> [snip]
>>
>> print =3D "";
>
>        ^
> Never mind, found it. :-/
>
> Donovan
>
>
> --
> D Brooke
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Considering that the error is a parse error, I'm guessing you've
turned off all your error reporting.

If you are in development, then I'd turn on ALL the errors and warnings.

error_reporting=3D-1
display_startup_errors=3D1
display_errors=3D1

at least.

Look through php.ini-development to see what choices you have and
decide what would be useful.



--=20
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: 2nd Pair of eyes please

am 27.01.2011 11:04:35 von Karl DeSaulniers

On Jan 27, 2011, at 4:00 AM, Richard Quadling wrote:

> On 26 January 2011 23:52, Donovan Brooke wrote:
>> [snip]
>>>
>>> print = "";
>>
>> ^
>> Never mind, found it. :-/
>>
>> Donovan
>>
>>
>> --
>> D Brooke
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> Considering that the error is a parse error, I'm guessing you've
> turned off all your error reporting.
>
> If you are in development, then I'd turn on ALL the errors and
> warnings.
>
> error_reporting=-1
> display_startup_errors=1
> display_errors=1
>
> at least.
>
> Look through php.ini-development to see what choices you have and
> decide what would be useful.
>
>
>
> --
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


I think it actually was working, because he had printed a html
comment. nothing would show.


Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: 2nd Pair of eyes please

am 27.01.2011 18:10:55 von dbrooke

Hello,
to respond to some of the comments/questions..

No, it wasn't parsing anything... and yes, I put

ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);

at the top of the page.

(as well as there is a custom built PHP management app that
allows to turn on the display_errors.. which is apparently
done.)

Having said all that, this server config (of which I have very limited
access) does appear to shut down parsing
entirely more quickly than my dev machines that are set
as mentioned.

...usually not a problem (old hat in troubleshooting) and am nearing the
end of the this job... but yes, strange that small errors trigger
shutting down parsing entirely.

Daevid,

Lot's of misc. comments for not being able to spot my syntax issue and
not knowing the details of my project! ;-)

However, I will take a look some time at your wrapper for future reference.

Cheers,

Donovan (1 block of code at a time)


--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: 2nd Pair of eyes please

am 27.01.2011 23:03:09 von juju buddy

--20cf3054a2f7727ff3049adb1d64
Content-Type: text/plain; charset=ISO-8859-1

Good god, I'm just a beginning php programmer and my head already aches
reading everyone's problems! lol. Great to see there are people out there
who care and will help if need be!!

On 27 January 2011 17:10, Donovan Brooke wrote:

> Hello,
> to respond to some of the comments/questions..
>
> No, it wasn't parsing anything... and yes, I put
>
> ini_set('display_errors', 1);
> error_reporting(E_ALL | E_STRICT);
>
> at the top of the page.
>
> (as well as there is a custom built PHP management app that
> allows to turn on the display_errors.. which is apparently
> done.)
>
> Having said all that, this server config (of which I have very limited
> access) does appear to shut down parsing
> entirely more quickly than my dev machines that are set
> as mentioned.
>
> ..usually not a problem (old hat in troubleshooting) and am nearing the end
> of the this job... but yes, strange that small errors trigger shutting down
> parsing entirely.
>
> Daevid,
>
> Lot's of misc. comments for not being able to spot my syntax issue and not
> knowing the details of my project! ;-)
>
> However, I will take a look some time at your wrapper for future reference.
>
> Cheers,
>
> Donovan (1 block of code at a time)
>
>
> --
> D Brooke
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--20cf3054a2f7727ff3049adb1d64--