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 7586307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:23:43+00:00 2026-05-30T19:23:43+00:00

Code: <?php if (isset($_REQUEST[‘g’])) { if ($_REQUEST[‘g’] == Set) { $g = strtolower($_REQUEST[‘g’])._title; }else{

  • 0

Code:

<?php 
if (isset($_REQUEST['g'])) {
    if ($_REQUEST['g'] == "Set") {
        $g = strtolower($_REQUEST['g'])."_title";
    }else{
        $g = strtolower($_REQUEST['g']);
    }
    $result1 = mysql_query("SELECT LEFT($g, 1) FROM cards GROUP BY $g ORDER BY $g ASC");
    while ($row = mysql_fetch_array($result1)) { 
?> 
<a href="./index.php?route=<?php echo $var[0]."/".$var[1]."&g=".$_REQUEST['g']; ?>&sort=<?php echo substr($row[$g], 0, 1); ?>"><?php echo substr($row[$g], 0, 1); ?></a>&nbsp;     
<?php 
    } 
}
?>

Error Message:

Notice: Undefined index: set_title in E:\xampp\htdocs\zipdown\include\sort.php on line 11

What am i missing?

  • 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-05-30T19:23:45+00:00Added an answer on May 30, 2026 at 7:23 pm

    Don’t forget to escape the value of $g if it isn’t known to be Set.

    $g = mysql_real_escape_string($g);
    

    Alias the column created by LEFT() as $g, enclosed in backticks:

    $result1 = mysql_query("SELECT LEFT(`$g`, 1) AS `$g` FROM cards GROUP BY `$g` ORDER BY `$g` ASC");
    //----------------------------------------^^^^^^^
    

    Otherwise, the column name returned by your mysql_fetch_array() call is something like:

    $row['LEFT(set_title,1)']
    

    Note on security:

    Given that your database must have a finite set of column names, it is advisable to use a whitelist against which you check the value of $g:

    // Assuming your columns are named title, author, etc...
    if (in_array($g, array('title','author','set_title','publisher','whatever'))) {
       // do the rest of your work
    }
    else {
       // Invalid value to $_REQUEST['g']
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code <?php session_start(); if (isset($_GET[cmd])) $cmd = $_GET[cmd]; else die(You should
My php code looks like that if (isset($_REQUEST['term'])) { $term = trim(strip_tags($_REQUEST['term']));//retrieve the search
I have the following PHP code: <?php if(isset($_GET['article'])) { echo <b>success</b>; } ?> And
I am using this PHP code: if (isset($_GET['c'])) { $pages = array(home, upload, signup);
Take this code: <?php if (isset($_POST['action']) && !empty($_POST['action'])) { $action = $_POST['action']; } if
I have code like this: <?php if(isset($global_info_results)): ?> <?php echo count($global_info_results) ?> <span>Mali Oglasi:
I got some legacy code that has this: <?PHP if(isset($_GET['pagina'])==homepage) { ?> HtmlCode1 <?php
here is the code <?php session_start(); if(!isset($_SESSION['user_name'])) { header('Location: login.php'); } $conn = mysql_connect(localhost,
I have written a simple code in page test_cookie.php to work with cookies. if(isset($_GET['data']))
When I execute this following code for example: cart.php?p=1&action=add <?php session_start(); if (isset($_GET['p']) &&

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.