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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:17:37+00:00 2026-05-27T19:17:37+00:00

I am trying to do the following PHP / MySQL query, and it works

  • 0

I am trying to do the following PHP / MySQL query, and it works fine for the first two groups, but for everyone else I am getting a MySQL error, is this written correctly?

$user =& JFactory::getUser();
$N = $user->get('name'); 
$username = $user->get('username');
$groups = $user->get('groups');

foreach($groups as $groupName=>$groupId)
{
}

$G=$groupName;

if ($G=="Management Staff")
    $result = mysql_query("SELECT * FROM hqfjt_chronoforms_data_addupdatelead");
elseif ($G=="Website Developers")
    $result = mysql_query("SELECT * FROM hqfjt_chronoforms_data_addupdatelead");
else
    $result = mysql_query("SELECT * FROM hqfjt_chronoforms_data_addupdatelead WHERE createdby=$N");

When I login as anyone else I get :

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\server2go\server2go\htdocs\chandlers\components\com_jumi\views\application\view.html.php(38) : eval()'d code on line 87

Warning: mysql_free_result() expects parameter 1 to be resource, boolean given in C:\server2go\server2go\htdocs\chandlers\components\com_jumi\views\application\view.html.php(38) : eval()'d code on line 132

  • 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-27T19:17:37+00:00Added an answer on May 27, 2026 at 7:17 pm
    $result = mysql_query("SELECT * FROM hqfjt_chronoforms_data_addupdatelead WHERE createdby=$N");
    

    is fishy, should be

    $result = mysql_query("SELECT * FROM hqfjt_chronoforms_data_addupdatelead WHERE createdby='$N'");
    

    make sure, $N has nothing evil in it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to teach myself MySQL/PHP from the very beginning. The following code
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I'm trying to use the following query syntax from a php file: $sql =
Current function to run mysql query in PHP and displays error on screen when
I am trying to connect to MySQL via PHP through the following code <?php
I am trying to run the following. <?php $db = mysqli_connect(localhost,user,pw) or die(Database error);
I am trying the following code: <?php $link = mysql_connect('localhost', 'root', 'geheim'); if (!$link)
I'm trying the following command in PHP 5.2.12 : print (date('Y-m-d', strtotime('2009-12 last day')));
Trying to run the following command in php to run powershell command... the following
I am new to PHP and trying to get the following code to work:

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.