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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:43:13+00:00 2026-06-12T11:43:13+00:00

So basicly this is my code: echo <SELECT>; foreach($arr_res as $op) { $q3 =

  • 0

So basicly this is my code:

echo "<SELECT>";
foreach($arr_res as $op) {
   $q3 = mysql_query(mysql_fetch_array("SELECT SL_TIME FROM SLOTS WHERE SL_ID='$op'"));
   echo "<OPTION value=".$op.">".$q3."</OPTION>";
}
echo "</SELECT>";

$arr_res is the resulting array of an array_diff. It has only numerical values which are the SL_ID from my timeslots.. I want to show SL_TIME but the result I get is the $q3 producing empty result.. Why isn’t this working?

  • 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-12T11:43:14+00:00Added an answer on June 12, 2026 at 11:43 am

    You don’t query mysql_fetch_array. Mysql_query gives an result on wich you use mysql_fetch_array. So the correct code would be:

    echo "<SELECT>";
    foreach($arr_res as $op){
    $result = mysql_query("SELECT SL_TIME FROM SLOTS WHERE SL_ID='$op'");
    $q3=mysql_fetch_array($result);
    echo "<OPTION value=".$op.">".$q3."</OPTION>";
    }
    echo "</SELECT>";
    

    However, $q3 will be an array, which is probably not what you want. In addition it would be a lot better if use an abstraction such as PDO (http://www.php.net/manual/en/class.pdo.php). This will maximize performance and increase the security.

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

Sidebar

Related Questions

I wondering is there an equivalent of this feature from play framework http://www.playframework.org/documentation/2.0/JavaAsync Basicly
Having a confusing issue with jQuery, basicly this code is added to 2 elements,
here's my code : $('#retouche_a_faire').click(function() { $(#retouche_a_faire_alert).toggle(this.checked); }); It's working great. Basicly, it's a
http://img683.imageshack.us/img683/645/weatherscreenmockupoutl.png I am asking myself whats the best way to code this layout. Basicly
here is the simple code: http://jsfiddle.net/YAFuW/1/ basicly i tried to use like this: <iframe
I cant figure out why this is not working. Basicly the following code-snippet workes
i am creating rss reader application with php.it is basicly getting rss url's from
I have defined a ConfigurationProperty class, which is basicly a key-value pair (with key
This is a peice of code for creating a cool effect of FAQs using
Basicly I'm making an image gallery that downloads from the web. So - when

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.