Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Debugging Column Logic


In a table displaying data on products in a given category I am trying to print table columns only if that column will be needed. However not all products in the category will have data for every cell, so for each product I want to display a table cell with data if it exists, otherwise display an empty cell. PHP Code:




View Complete Forum Thread with Replies

Related Forum Messages:
How To Query From One Column Then Sort Using Another Column
I am trying to get the last 100 albums I entered into my database using the album_id (Highest being the latest entry) then sort them alphabetically using the album_title column.

I can get the latest 100 easily but cannot figure out how to also sort the results by the album_title before I display them.

This is what I have so far which gets what I want but not in alphabetical order.

<?php
$sqlquery = mysql_query("SELECT * FROM albums ORDER BY album_id desc limit 100", $db);

while ($result = mysql_fetch_row($sqlquery))
{
echo "<a href='music_info.php?album_id=$result[0]'><span style='text-decoration: none'>$result[1]</span><br></a>";
}
?>

I have been trying to add a second ORDER BY to the query like so.

$sqlquery = mysql_query("SELECT * FROM albums ORDER BY album_id desc limit 100 ORDER BY album_title", $db);

but this obviously isn't the way I should be doing it.

View Replies !
Paging And Sorting Column By Column Name?
I am using below code to paging my data. I want to sort my data by Column time. Not getting where i do changes. Code:

View Replies !
Debugging PHP
My boss and I are fairly new to PHP and would love to hear suggestions on how to debug PHP with ease and efficiency. Thank you for your time and consideration.

View Replies !
PHP Debugging
I have been programming in php for few years but have never used anything but free hosting to run php. My programming requirements have evolved and now I am in need of a debugger to understand how code is functioning (so I want to be able to step through the lines of code, watch variable values and object contents etc.)Code:

View Replies !
Debugging In Php
What is the best way to debug in php? What is the best way to see the value of your variables? I'm coming from the Flash MX world, and in there, you can do a trace() and it traces out the value of your variables to the message window. PHP has print and echo but that seems to mess up the page layouts too much. Is there a way to print variables to a log file?

View Replies !
Debugging PHP In OS X
if there are any other mac users out there who have managed to get a debugger up and running in OS X. Im not finding any decent tutorials that let you use a stand alone debugger (i.e. not integrated with zend studio or komodo). I generally use textmate for
editing and would like to find something i can use along with that.

View Replies !
Debugging
how to set the error handling in the ini file to E_ALL, E_ERROR, E_WARNING etc.

We had everything setup and working then we had to restart the server and it for some reason, reset the ini file back to the way it was. SO we went back to the ini file and set it back up but now it does not work.

We even set it to just E_ALL. And nothing. We just get a white page. Code:

View Replies !
Help Debugging Query
I was wondering if anyone can help me here? The following code sends out an email alert to members of my site when a matching result is found....

View Replies !
Debugging Query
I can't for the life of me work out why I keep getting this error:

ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE username='billybob')' at line 76 PHP Code:

View Replies !
Installation Debugging
1)I get startup error messages:
"Unable to load dynamic library c:phpphp_curl.dll - the specified
file cannot be found"
although the file is very much there at exactly that location
Not only for this file but for many extension files like php_mysql.dll,
php_oracle.dll, php_mssql.dll, php_exif.dll etc.

2)the extensions_dir setting is "c:php" without an ending backslash.

3)The php.ini file is residing at c:php

4)The php.ini file in c:windows has all extensions disabled so it does
not look as though that php.ini file is the source of the messages

5)There is a extension entry for php_win32api.dll which also gives a
not found error.
Is it the older version of php_win32std.dll, php_win32service.dll and
php_win32scheduler.dll files which are present but
their names are not there by default in the php.ini ?

************************************************** ************************************************
6)How do I debug PHP like you can debug Java in Eclipse or NetBeans and
C/C++ in MS Visual Studio - with breakpoints and stepping?
************************************************** ************************************************

7)database access through odbc works.

8)How do I install PHP as both a CGI extension under Apache 2.0.5x and
as a module (php5apache2.dll with a LoadModule in httpd.conf) - Apd
which is a part of PEAR requires that php be installed as a CGI binary
- is apd good for interactive debugging?

View Replies !
Debugging In Komodo
Does anyone use Komodo from activestate to write their PHP? If so, have you used the debugger? I'm new to debugging with an actual debugger (I'm kinda old school and have always relied on echo and print...). When I'm running it, the debugger stops at EVERY SINGLE line of PHP code... I'm debugging a pretty long script and it just takes WAY too long. Is there a way to tell the debugger to just execute the code up to a certain point?

View Replies !
XOOPS Debugging
I am working with this XOOPS CMS and started having problems. Everything was working fine all pages, modules displayed, then it just went blank.

Now I tried doing some trouble shooting following the advice on their site about what to do if I am ending up with blank pages. The thing is I cannot even get to the admin login page to set the debugging options from there. Anyway I changed the debugging options via the database and still no errors are being displayed.. just the blank page.

I look at the error logs form the server and went through each module folder and looked to see if there was any error logs. 2 of the error logs state that that there was an unexpected $ in one the XOOPS common.php file and it pointed out the line number.

I have looked there and see nothing and I know that the error does have to occoured there it's just where the script halted. My question is that the error could have orignated from any module.. How can I get some errors to show on screen so i ca do a trace. I here it could be possible via .htaccess.

View Replies !
Debugging PHP4 With Dbg, Gdb, And Ddd
I want to create a debugging environment for PHP. I running Debian
Woody and installed PHP4 from Debian's packaging system.

I downloaded precompiled DBG from the webside and placed dbg.so in the
same directory as mysql.so, Since MySQL works under PHP, I'm assuming
I've got the right directory. I've updated php.ini per the DBG website.

phpinfo() reports:

1. --disable-debug was part of the ./configure command.
2. ZEND_DEBUG=disabled, but the report does indicate that dbg is part
of the Zend engine setup.
3. In the section on dbg, it reports dbg version 2.11.23, linked as a
shared library; profiler compiled,enabled; debugger.enabled=on; etc.

If I want to debug with dbg and gdb, do I have any options other than to
recompile PHP omitting the "--disable-debug" switch?

Once I do (or don't do) that, how does one hook gdb into dbg?

How do most PHP developers who don't own a commercial IDE debug their
programs?

View Replies !
Debugging FPDF
Does it have a debugging mode? I keep getting "... data already sent".

View Replies !
PHP Error Debugging
I have been working with PHP for a while, but never gone through getting a good debugger - or debugging methodology.

Can someone send me links to suggestions and possibly good (free) software?

I am not hosting the website, so I cannot tell it to report all errors directly from the installation.

I tried error_reporting(E_ALL ^ E_NOTICE); on top of the page, but that does nothing. So it always takes a while for me to fix the errors.

View Replies !
Debugging My Functions
I wrote this code to validate a few fields on a form which will be submitted when a customer wants a refill of their prescription medication.

The first problem is none of the functions actually work properly. Both of the functions that validate names should throw an error if a name has less than 2 characters inputted in the field. Yet, it doesn't throw any errors if I insert only one letter in the field.

The next function should verify a phone number. I can put a phone number with 6 numbers in it and it won't throw an error even though it is to short based on my regular expressions requirements which says it needs 7 to 14.

The last function doesn't throw an error if I put <a href="bob"> in the comment box and it should throw an error if it finds a <a> tag. Code:

View Replies !
Debugging Error
I'm getting this error message after submitting a form in PHP:

Fatal error: Call to undefined function sql_errno() in /home/jplane/
certcent/phpweb/phpnuke/html/admin/modules/quiz.php on line 542

It's suppose to write information to some sql tables. I'd like to
further debug this message, maybe in mysql?

View Replies !
Installation, Debugging
(I am posting from a web interface- google groups, yet the message is
not appearing on the group, so am posting again, if you get two of the
same kindly ignore one)

1)I get startup error messages:

"cannot load c:phpphp_curl.dll - the specified file cannot be found"
although the file is very much there at exactly that location
Not only for this file but for many extension files like php_mysql.dll,
php_oracle.dll, php_mssql.dll, php_exif.dll etc. Code:

View Replies !
Debugging Charset
We've been building a pretty big web app here for internal use. SMS text messages come in from an aggregator and are stored in a MySQL 4 db. Our operators then deal with them using a web interface. The db is queried using PHP4 and the results output as XML which is then transformed using XSLT into XHTML.

Now, in our testing environment everything works just fine. However, when we try and run it with actual live data, any incoming SMS message that contains a non-ASCII character breaks the system at the Sablotron stage (invalid token). Now the aggregating service is sending us the incoming messages UTF-8 encoded. The XML and XSL is all set up to be UTF-8.

However, somewhere along the lines something is getting screwed up so that Sablotron barfs (typical examples are pound signs or euro signs). I'm having a hard time debugging this because as far as I can tell everything is set to be using UTF-8 by default. Clearly something isn't (MySQL possibly). I'd really appreciate some pointers for things to check.

View Replies !
Debugging Advice
syntax highlighting what methods or programs do people on here use to debug their php? I'm using linux so foss programs that run on both win and linux.

View Replies !
Debugging Rapidly
is there any program which shows all variable assignments during the running of a php script. im getting sick and tired of using echo $myvar to debug.

View Replies !
Logic Help
Here's the deal:

I have a page the lists "patterns". In this page is a link that opens up a window that displays ALL the "threads" available in the database.


"Threads" need to be related to "patterns". What I mean by this is that I need the ability to select (with a checkbox) the thread listing for when I process the form, the patternID and the threadID are saved in a table.

In addition to.. I need to be able to select ( from a checkbox) whether or not this thread is available for direct ordering or not.

Here's some code:

View Replies !
And/Or Logic
I am having trouble with some and/or logic. I am using PHP to connect to a MSSQL server. I have the following in a select statement:

where TT.fkBranchid=@BranchID
and TT.DateCreated >= '{$begdate}' and TT.DateCreated < '{$enddate}'
and (Left(d.instorecode,3)=ò•' or d.id=âÊ')
and (P.code not in (?', ?'))

In the third line of the where statement, I have that "or" section. I want all of the logic to run, except for the "Left(d.instore,3)=ò•'" and the "d.id=âÊ'" logic. It does not seem to work the way I have it coded right now. Would somebody be able to tell me what I am doing wrong? And, what the preferred method would be?

View Replies !
Another Logic
I am using the folloiwng code in order to delete a user and then delete data from another table which is related by the username field. PHP Code:

<?php
$q = "select Username from `table` where UserID = '$_POST['userid'];
$result = mysql_query($q) or die(mysql_error());
if(mysql_num_rows($result)){
$row = mysql_fetch_array($result);
$q2 = "Delete from `table2` WHERE Username = {$row['username']}";
$result2 = mysql_query($q2) or die(mysql_error());
?>

But then I get the the following error where jess is an actual username. Anyi deas why this is happening?

View Replies !
Php Logic
I don't have a question about php coding, just about php logic. I want to create a registration page that self processes itself. if ( submit. blah bla blah) else (show form) Problem is I want to have error reporting? How can I use this structure to check for any errors and if there is an error, it shows the form and the error?

View Replies !
Debugging Scripts The Easy Way.
i found some ways to debug scripts like useing the error_reporting( E_ALL );
which will display any small bugs in your script and give you a warning about them.

but the most common of them is ones like this:

Warning: Use of undefined constant _jobdepartment - assumed '_jobdepartment' in c:foxservwww\_roguemodulesphprofessionadminindex.php on line 82
Warning: Use of undefined constant _joblisting - assumed '_joblisting' in c:foxservwww\_roguemodulesphprofessionadminindex.php on line 82

the line to fix is this: PHP Code:

View Replies !
Does Anyone Know Any Good Debugging Techniques.
Does anyone know any good debugging techniques. Especially for mysql
queries, and global variables. My php IDE's (Glimmer, and Bluefish)
supposedly have debugging functions but I cant figure out how they work.
So any help would be excellent.

View Replies !
Debugging Blank PHP Page.
How can I debug a blank PHP page? I've turned on all logging in my
php.ini, bu the page just turns blank.

View Replies !
Outputing Headers For Debugging
I am wondering if there is a way that I can output all of the information of which gets sent to a header within php?

As I have got a problem where I can not set a cookie due to information being sent to the header and I have worked out where about in the script this is happening and have disabled all major coding (apart from when I am starting a new function) but I am still getting this problem. So I need to output all header information to see if I can work out what I am missing.

View Replies !
PHPEclipse And Remote Debugging
I'm trying to get remote debugging working with phpeclipse. I think i've
installed
everything correctly, and the debugger in eclipse starts, but breakpoints
are ignored
and nothing seems to happen :(

Is there some way to simply check if the debug plugin for php is correctly
installed
(can I use dbglistener.exe to check if something happens when a php script
is executed?)

In the PHP Debug log i get a PHPLaunchingPlugin.InternalErrorOccured with
the following
stacktrace:

java.net.SocketException: Software caused connection abort: socket write
error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at
net.sourceforge.phpdt.internal.debug.core.PHPDBGPa cket.sendPacket(PHPDBGPacket.java:40)
at
net.sourceforge.phpdt.internal.debug.core.PHPDBGIn terface.continueExecution(PHPDBGInterface.java:184 )
at
net.sourceforge.phpdt.internal.debug.core.PHPDBGPr oxy$PHPLoop.run(PHPDBGProxy.java:384)

Is there something i can do to fix this? It could be that this is why it
doesn't work.

My files are all on the server, I open them from there with eclipse (so no
local copy's).
Webroot on server is c:/inetpub/wwwroot
Share to this path on client is called Y:

My debug configuration:
environment > remote debug set to on
working directory set to: Y:kernel_3site
remote sourcepath set to c:/inetpub/wwwroot/kernel_3/site

My setup:
client (ip 192.168.1.200)
eclipse 3.0.1
phpeclipse 1.1.3
DbgListener.exe (from dbg-2.11.32-cli-w32 package) is running

server (ip 192.168.1.100)
apache 1.3.29 (installed via nusphere tech platform 3.2)
php 4.3.4
dbg v2.11.32 (shows in php_info(), so it should be installed correctly)

View Replies !
Debugging SOAP Web-Service In Php.
I am trying to debug a client/server combination using NUSOAP,
but I am not able to find a way to do that!

I have spent days playing with Zend, but I haven't found a way to debug
it without a start page.

How can I do this?
(Know there are some other environments, but it takes a long time to
figure them out, while keeping what I have).

Also, is there some simple way to VIEW and ANALYZE what goes throug the
http-port?
Tried Ethereal, but it doesn't work locally with XP.

Can use both IIS and Apache, PHP 4* and 5*

View Replies !
Formal Debugging, Why Do You Think It Doesn't Exist?
First of all, I feel that the debate between ASP and PHP is irrelevent, I think they are different enough that there is no comparrison or need for comparrison. However, what the article did bring up about debugging made me wonder why PHP doesn't have any. Why do you think the Zend Engine doesn't spit back more information for debugging?

I have never really found a need for more debugging options in PHP, good old "echo" and trial and error work for me, but I can imagine that it would be nice for those who are new to the language etc... Besides, would it take that much more time to include some kind of decent debugging? Just wanted to see what the community had to say about it.

View Replies !
Debugging - Conditional Expression
I have a conditional expression that looks like this:

if (($mtf->nntp_id || $mtf->mlist_id) && !$mtf->mlist_msg_id) {


I want to get it to output the values of $mtf->nntp_id and $id variables.....

View Replies !
Debugging DomDocument Objects
What is the best way to view the contents of a DomDocument Object? print_r() and var_dump() just give me empty objects. Here is my code, if you're curious:

$dom = new DOMDocument();
$dom->loadHTML("<html><body><p>Hello World</p></body></html>");
print_r($dom);

View Replies !
Debugging Slow Sites?
In my new job I have inherited quite a large and complex (an in a few places badly written) PHP & MySQL website. It also handles a lot more traffic than I have been used to in my other jobs.

The problem I have now is chasing down performance bottlenecks and slow queries, and other glitches that cause the site to hang, be unavailable or have weird load average / memory usage spikes on the webservers and the mysql servers

I was wondering what other people use for sniffing out these problems, I was thinking about Zend platform, but that is looking like it might be too expensive (we are mostly advertisement funded, so margins are low despite high traffic).

View Replies !
Debugging / Logging Library
I could use some direction / suggestions on where to begin a debug / logging library. Basically instead of

mysql_query($sql) or die('query failed '.mysql_error());

and anywhere else where mistakes can happen I want that event logged (in detail) to disk return 0 to the calling function and let the application deal with what it wants to tell the user / how to crash. Specifically any articles, tutorials or libraries that already do this type of thing.

View Replies !
Debugging Message Script
I'm working on a gmail like private messaging script is anyone interested in testing it with me and giving me feedback?

View Replies !
Debugging - See A List Of All My Variables (without Specifying Them All By Name).
I have windows. I do all my coding on my local PC. I upload my files using FTP onto my Linux host. From there, I call my page and see if it worked, what changes to make, etc. I make changes on my PC, upload them again, etc.

Right now, I would just like to see a list of all my variables (without specifying them all by name). How can I do that? I don't understand how the debuggers work and I'd be willing to learn, but it seems as though they have to be installed on the host. Code:

View Replies !
Need Third-party Debugging Tools
PHP has some pretty funky error messages:

"parse error, unexpected T_IF";
"Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING";

Humans often see these - shouldn't they be more human readable and why are there no stack backtraces? When a problem arises, I am often interested in knowing where the problem code was called from.

It seems as though - with PHP - I need third-party debugging tools.

View Replies !
Class With Some Debugging Functions
I'm writing a class with some debugging functions, but it doesn't work. This is a simplified version, but the error is still showing up:

Fatal error: Using $this when not in object context in * on line 20

<?

class A {

var $debug = array();

function setDebug ($var) {
$this->debug[microtime()] = $var;
}

function getDebug () {
return $this->debug;
}.

View Replies !
Debugging This Spell Checker
I know I can do more with it, but that's all I want right now. For some reason it thinks every word is misspelled. Eventually I'll want to highlight mispelled words and next to the word have a drop down box with all the possibilites in it. PHP Code:

class spell_checker {

        var $personal_path = "/speller/";
        var $skip_len      = 3;
        var $mode = PSPELL_NORMAL;

        var $pspell_handle;
        var $pspell_cfg_handle;
        var $personal = false;
...

View Replies !
Date Logic
I have two unix timestamps which I test as follows:
if ($currentdt > $targettime){
some action
}if ($currentdt > $targettime){
other action}

The problem is they test true even though I echo values to the screen and they are different.

View Replies !
Math Logic
I'm writing a script to do some calculations on gambling odds. I don't have a direct PHP question, but a math question related to my script. There are some smart people around here so I thought I'd ask. If someone can answer my question and explain the logic that would be great.

The house edge is 1.41% and a winning bet pays 2:1. However, for every $1 lost on the game, the player only has to pay $.55. Given these circumstances, what is the modified house edge?

View Replies !
Cookie Logic
Since cookies are stored on the client side, I was wondering how a php script (which runs on a serverside) could ever execute a script like below:
_____________________________
if (isset($_COOKIE["jtotwname"]))
{
$value = $_COOKIE["jtotwname"];
}
_____________________________
Basically, how can the server side know, while running the script above, if the client has a specific cookie ?, asumming information in the cookie file arent's transferred over the internet.

View Replies !
Readdir Logic..
I want to use readdir to get all the filenames from a particular directory.  more importantly, the number of files because I have created the files and know their naming convention.  I have the create function separate from what I am working on now which is why I do not just use the information I already have.  Inside my create function I return the directory name I created instead of, for instance an array of the filenames. 

(now that I think of it... i could create an array with the name of the directory and the rest of the array the filenames...) Anyways, continuing on with my original thoughts. If I have the following pseudo code:

while (readdir($dir))
{
  $files[$count] = readdir($dir)  // readdir would actually be the 2nd file now since I already advanced it in the if statement, no?
}

So I said ok i'll create a flag instead and set it to false once readdir returns false but I still can't capture the response from readdir without losing the file name.  Should I have a while loop once to increment a counter to determine how many files are in the directory and then have a for loop incrementing up until the counter to use readdir to capture the file names?

View Replies !
Logic Issues
I'm trying to add a search function to my website, and I'm not real sure how to go about it. I have a loaded database on my site with the following fields:

id //(primary key)
title //(image title)
page //(name of the page the image is on)
thumb //(name of the thumbnail image)
kywords //(keywords that describe the image)

The kywords field has many keywords separated by commas. I used commas to prevent the end of one word and the beginning of the next from accidentally giving a false match. Code:

View Replies !
Logic Error
When I run this code it works

if('a'=='b'){run some code}

but as soon as I add an or operator it runs the code every time whether there is a match or not.

if('a'=='b'||'c'){run some code}

The code now runs for all values of a.The actual code that I am using is this

if($_GET['monthBefore']=='september_2007' || 'august_2007'){echo "<script> js</script>";}

Get does contain a string and the right one. I have spent hours on this and am really puzzled.

View Replies !
Another Logic Problem
I am currently displaying data from a database as follows, however I would like to be able to add another column to the table which displays  a button so a user can download a file that is related to that record,

however there is not always a file available which is indicated in the database as either yes or no. If it is yes i would like the download link to be displayed in the new column as a button or left blank if no file has been uploaded. Code:

View Replies !
Logic Problem
I am currently displaying data from a database as follows, however I would like to be able to add another column to the table which displays a button so a user can download a file that is related to that record,

however there is not always a file available which is indicated in the database as either yes or no. If it is yes i would like the download link to be displayed in the new column as a button or left blank if no file has been uploaded. Code:

View Replies !
Logic For This Coding
suggest me the logic for the following :

Now, I have the number stored in variable 'x' , 'y' and 'z' which is to be matched with the four set of numbers say four arrays. I want to match this 'x' , y and 'z' with each array and print the output for each number matched. note : no numbers or array will be of two digit. also the array set is different for each variable 'x' and 'x' is ranging from 1 to 9.

i.e if x=1; the array set will be
a1={2,3,} a2={9,8} a3={4,7,6} a4={5}

the x and y can be anything ranging from 1 to 9.
now suppose if y=6 and z=2 then a1 and a3 should selected and the output should be the message which is written in number six and number 2. and i f x is different the array set will be different. can you suggest me simpler logic to do this.

View Replies !
Logic Problem....
However, the javascript menus I am using are placed on the page based on thier absolute values, in pixels, from the top left of the brower. These are passed into the header in javascript.

So I need to write a php program to write this javascript. IT needs to query the database, and then based on where the image falls in the grid, assign a top and left value for it Code:

View Replies !
Web Forms - Logic For What Happens After
The area of php that i just cant seem to grasp conceptually at this point is capturing user input with webforms.

I understand the webforms themselves and how each field captures values and sets them to variables. I also understand form validation Where i lose it is when a user hits the submit button.

1) Please view my attached jpeg, i put a clear mini sample diagram of whats going on with my site.

If i wanted to create a very simple webform that just added one element into my single dimension array ($ar_price) what would the code be for that.

Also, on my diagram, is it possible to avoid the multi pages and just have one dynamic page that could accomplish this, if so what route would you recommend.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved