Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    Regular Coder grumpy's Avatar
    Join Date
    Oct 2006
    Location
    Visible light spectrum
    Posts
    121
    Thanks
    5
    Thanked 6 Times in 6 Posts

    No freakin' output...

    Hi,

    In my php script that calculates numbers from letters the issue is that no output occurs even though there are plenty of echo calls. The sql query might be incorrect (the UNION bit) or some other stuff. Let's first tackle the sql part:

    The query:

    Code:
    $query = "SELECT `SubscriberID`, `EmailAddress`, `FirstName`, 
    `LastName` FROM `InfResp_subscribers`  WHERE `SubscriberID` = $id AND 
    `EmailAddress` = '$email' UNION ALL SELECT `email_attached`, `reason`, 
    `income`, `interest` FROM `InfResp_customfields`WHERE `email_attached`
     = '$email' AND `fieldID` = $id";
    The tables:





    I can also provide the complete code for inspection

    Thank you so much for the help.

    Bo

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    try this:
    PHP Code:
    $query "SELECT `SubscriberID`, `EmailAddress`, `FirstName`, 
    `LastName` FROM `InfResp_subscribers`  WHERE `SubscriberID` = $id AND 
    `EmailAddress` = '"
    .$email."' UNION ALL SELECT `email_attached`, `reason`, 
    `income`, `interest` FROM `InfResp_customfields`WHERE `email_attached`
     = '"
    .$email."' AND `fieldID` = $id"
    and post code,

    regards

  • #3
    Regular Coder grumpy's Avatar
    Join Date
    Oct 2006
    Location
    Visible light spectrum
    Posts
    121
    Thanks
    5
    Thanked 6 Times in 6 Posts
    The problem persists even with that query fix.

    I've set set_time_limit(0); for testing and the script just keeps on running and running until wamp starts to freeze - unlimited loop?

    Here's the code.

    Thanks.
    Last edited by grumpy; 08-07-2008 at 10:27 AM.

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by grumpy View Post
    The problem persists even with that query fix.

    I've set set_time_limit(0); for testing and the script just keeps on running and running until wamp starts to freeze - unlimited loop?

    Here's the code:

    http://scoliosissolution.com/code.txt

    Thanks.
    this kind?
    PHP Code:
    $life_path = ($day_out $month_out $year_out);
            while (
    $life_path 9)
            {
                
    $life_path_out array_sum(preg_split('//'$life_path, -1PREG_SPLIT_NO_EMPTY));
            }
            echo 
    $life_path_out
    output is $life_path_out and in condition is $life_path. $life_path is not change or I miss something.

    same thing $name_num and $name_num_1, $full_name_num and $full_name_num_1 and few others.

    regards

  • Users who have thanked oesxyl for this post:

    grumpy (08-07-2008)

  • #5
    Regular Coder grumpy's Avatar
    Join Date
    Oct 2006
    Location
    Visible light spectrum
    Posts
    121
    Thanks
    5
    Thanked 6 Times in 6 Posts

    Yes

    Thank you! At least it's giving some output now (even though it's wrong) and I have no errors or warnings. Fixing the calculations now...

  • #6
    Regular Coder grumpy's Avatar
    Join Date
    Oct 2006
    Location
    Visible light spectrum
    Posts
    121
    Thanks
    5
    Thanked 6 Times in 6 Posts
    Did all your recommendations and it outputs:

    1email@yahoo.comTestTestemail@yahoo.com12091985

    So it actually reads ok from the db. Now,the problem that I see from the output is that it outputs the email twice even though it's echoed only once. Is UNION ALL the right thing to include here or would some other call be better?

  • #7
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by grumpy View Post
    Did all your recommendations and it outputs:

    1email@yahoo.comTestTestemail@yahoo.com12091985

    So it actually reads ok from the db. Now,the problem that I see from the output is that it outputs the email twice even though it's echoed only once. Is UNION ALL the right thing to include here or would some other call be better?
    I never used union,

    InfResp_subscribers is one-to-many with InfResp_customfields ?
    I mean, this query work?
    Code:
    select a.SubscriberID, a.EmailAddress, a.FirstName, a.LastName,
     b.email_attached, b.reason, b.income, b.interest
        from InfResp_subscribers as a, InfResp_customfields as b
        where a.SubscriberID = $id and a.EmailAddress = $email and
                 b.email_attached = $email and b.fieldID = $id
    regards

  • Users who have thanked oesxyl for this post:

    grumpy (08-07-2008)

  • #8
    Regular Coder grumpy's Avatar
    Join Date
    Oct 2006
    Location
    Visible light spectrum
    Posts
    121
    Thanks
    5
    Thanked 6 Times in 6 Posts
    THAT is a very neat trick. Just like doing it directly through mysql not php with the dots but assigning a value. Who needs JOINs and UNIONs

    It worked - the email now only outputs once. The calculations are still wrong and I am correcting these. Will let you know...

  • #9
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by grumpy View Post
    THAT is a very neat trick. Just like doing it directly through mysql not php with the dots but assigning a value. Who needs JOINs and UNIONs

    It worked - the email now only outputs once. The calculations are still wrong and I am correcting these. Will let you know...
    you still need to quote $email, but probably you already know,

    PHP Code:
    $query "select a.SubscriberID, a.EmailAddress, a.FirstName, a.LastName,
     b.email_attached, b.reason, b.income, b.interest
        from InfResp_subscribers as a, InfResp_customfields as b
        where a.SubscriberID = $id and a.EmailAddress = '"
    .$email."' and
                 b.email_attached = '"
    .$email."' and b.fieldID = $id 
    regards

  • #10
    Regular Coder grumpy's Avatar
    Join Date
    Oct 2006
    Location
    Visible light spectrum
    Posts
    121
    Thanks
    5
    Thanked 6 Times in 6 Posts
    Yes I did quote it

    Now, am I passing values to the NumTable function OK? For the three calculations that use this function it outputs just zeroes. I guess I am doing it wrong:

    Code:
    $name_out = ($fname_out . $lname_out);
    		$name_out_array = preg_split('//', $name_out, -1, PREG_SPLIT_NO_EMPTY);
    		$name_out_array = $letter;
    		for ($i=0; $i <= sizeof($letter); $i++)
    		{
    			NumTable ($letter, $i);
    		}
    		$name_num = array_sum(array ($letter));
    Should I use foreach instead and forget about the $i?

    How would I do that?

  • #11
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    I guess that something is wrong with error reporting, try this:

    PHP Code:
    ini_set('display_errors'1);
    error_reporting(E_ALL);
    # include the db logon file
    require 'qetu1369/datbz.php';
    #require 'qetu1369/text.php';

    # set the limit execution time to unlimited
    set_time_limit(0);
    // error_reporting (E_ALL & ~E_NOTICE); # show all errors except notices 
    Quote Originally Posted by grumpy View Post
    Yes I did quote it

    Now, am I passing values to the NumTable function OK? For the three calculations that use this function it outputs just zeroes. I guess I am doing it wrong:

    Code:
    $name_out = ($fname_out . $lname_out);
    		$name_out_array = preg_split('//', $name_out, -1, PREG_SPLIT_NO_EMPTY);
    		$name_out_array = $letter;
    		for ($i=0; $i <= sizeof($letter); $i++)
    		{
    			NumTable ($letter, $i);
    		}
    		$name_num = array_sum(array ($letter));
    Should I use foreach instead and forget about the $i?

    How would I do that?
    1. add a 'return $letter;' to the end of NumTable function
    2. change the part you posted to this:

    PHP Code:
    $name_out = ($fname_out $lname_out);
    $name_out_array preg_split('//'$name_out, -1PREG_SPLIT_NO_EMPTY);
    //$name_out_array = $letter;
    $letter $name_out_array;
    //for ($i=0; $i <= sizeof($letter); $i++)
    foreach($letter as $i => $v){
        
    NumTable ($letter$i);
    }
    $name_num array_sum(array ($letter)); 
    BUT I have no idea if it do what must do because I don't understand what must do. Could you give me a clue?

    regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •