Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7956291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:56:54+00:00 2026-06-04T03:56:54+00:00

This snippet is causing the file to throw a 500 erorr, and I cannot

  • 0

This snippet is causing the file to throw a 500 erorr, and I cannot see why.

<head>    
<?php

        $link = mysql_connect('****', '***', '*****');
        $db_selected = mysql_select_db('***', $link);
        if (!$db_selected) {
            echo 'error';
        }
        $adchan = $_COOKIE['adtail'];
        $adarray = json_decode($adchan);
        if($adarray->{'subcat'} != 'main'){
                $sql = "SELECT term_id FROM wp_terms WHERE slug='$adarray->{'subcat'}'";
                $result = mysql_query($sql);
                    while($row = mysql_fetch_array($result))
                  {
                    $id = $row['term_id'];
                    $sql2 = "SELECT option_value FROM wp_10_options WHERE option_name='$id'";
                    $result2 = mysql_query($sql2);
                        while($row2 = mysql_fetch_array($result2))
                      {
                          echo "<meta http-equiv='Refresh' content='".$row2['option_value']."'>";
                      }

                }
        }
        else{


                $sql = "SELECT term_id FROM wp_terms WHERE slug='$adarray->{'cat'}'";
                $result = mysql_query($sql);
                    while($row = mysql_fetch_array($result))
                  {
                    $id = $row['term_id'];
                    $sql2 = "SELECT option_value FROM wp_options WHERE option_name='$id'";
                    $result2 = mysql_query($sql2);
                        while($row2 = mysql_fetch_array($result2))
                      {
                          echo "<meta http-equiv='Refresh' content='".$row2['option_value']."'>";
                      }

                }
        }
    ?>
</head>

Can anyone see why?

UPDATE

<?php
error_reporting(-1);

        $adchan = $_COOKIE['adtail'];
        $adarray = json_decode($adchan);
        var_dump($adarray);
        print $adarray['cat'];
        ?>

It runs fine until the the print, which is when I get the 500 error. the output is:

object(stdClass)#1 (4) { ["cat"]=> string(9) "lifestyle" ["subcat"]=> string(12) "arts-culture" ["page"]=> string(4) "main" ["zone"]=> string(22) "lifestyle/arts-culture" }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:56:56+00:00Added an answer on June 4, 2026 at 3:56 am

    I’m not sure. But, it may because mysql_fetch_array cascade. You put mysql_fetch_array inside another mysql_fetch_array.

    And assume it works, but it will give you bad performance.

    This may be better for you. (In the inside of if part)

                    $sql = "SELECT a.term_id,b.option_value FROM wp_terms a LEFT JOIN option_value b ON b.option_name=a.term_id WHERE a.slug='{$adarray->subcat}'";
                    $result = mysql_query($sql);
                    while($row = mysql_fetch_array($result))
                    {
                        $id = $row['term_id'];
                        if(isset($row['option_value']))
                            echo "<meta http-equiv='Refresh' content='".$row['option_value']."'>";
    
                    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In this snippet: find( sub { print found . $File::Find::name . \n; }, (.));
The following snippet is causing me a QA headache. <div id=links-container> <ul> <li class=resource-link
Here is the snippet of my code which is causing this error: for (a=0;
This snippet of code always parses the date into the current timezone, and not
This snippet throws an NullPointerException due to the fact that its unboxed to a
This snippet from official website works as expected: $treeObject = Doctrine::getTable('Category')->getTree(); $rootColumnName = $treeObject->getAttribute('rootColumnName');
Consider this snippet: globalVar = 25 def myfunc(paramVar): localVar = 30 print Vars: {globalVar},
Consider this snippet of code: public static class MatchCollectionExtensions { public static IEnumerable<T> AsEnumerable<T>(this
I ran across this snippet in an internal web site, but I'm having trouble
Edit: I put this snippet of code in jsbin: http://jsbin.com/eneru I am trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.