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

  • Home
  • SEARCH
  • 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 6221093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:04:27+00:00 2026-05-24T08:04:27+00:00

well, i wanna pull out some data from a mysql view, but the wuery

  • 0

well, i wanna pull out some data from a mysql view, but the wuery dos not seem to retrieve anything ( even though the view has data in it).

here is the code i’ve been “playing” with ( i’m using adodb for php)

$get_teachers=$db->Execute("select  * from lecturer ");

//$array=array();
//fill array with teacher for each lesson
for($j=0;$j<$get_teachers->fetchrow();++$j){
    /*$row2 = $get_lessons->fetchrow();
   $row3=$row2[0];
    $teach=array(array());
    //array_push($teach, $row3);
    $teach[$j]=mysql_fetch_array( $get_teachers, TYPE );
    //echo $row3;*/
    $row = $get_teachers->fetchrow();
    //$name=$row[0]+" "+$row[0]+"/n";
    //array_push($teach, $row1);
    echo $row[0]; echo " ";echo $row[1]." ";
    //$db->debug = true;

}

if i try something like “select name,surname from users”, the query partially works . By partially i mean , while there are 2 users in the database, the loop only prints the last user.

the original query i wanted to execute was this

$get_teachers=$db->Execute("select  surname,name from users,assigned_to,lessons 
where users.UID=assigned_to.UID and lessons.LID=assigned_to.LID and
lessons.term='".$_GET['term']."'");

but because it didnt seem to do anything i tried with a view ( when you execute this in the phpmyadmin it works fine(by replacing the GET part with a number from 1 to 7 )

the tables in case you wonder are: users,assigned_to and lessons. ( assigned_to is a table connecting each user to a lesson he teaches by containing UID=userid and LID=lessonid ). What i wanted to do here is get the name+surname of the users who teach a lesson. Imagine a list tha displays each lesson+who teaches it based on the term that lesson is available.

  • 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-24T08:04:28+00:00Added an answer on May 24, 2026 at 8:04 am

    Looking at http://adodb.sourceforge.net/ I can see an example on the first page on how to use the library:

    $rs = $DB->Execute("select * from table where key=123");
    while ($array = $rs->FetchRow()) {
        print_r($array);
    }
    

    So, you should use:

    while ($row = $get_teachers->fetchrow()) {
    

    instead of:

    for ($j = 0; $j < $get_teachers->fetchrow(); ++$j) {
    

    The idea with FetchRow() is that it returns the next row in the sequence. It does not return the number of the last row, so you shouldn’t use it as a condition in a for loop. You should call it every time you need the next row in the sequence, and, when there are no more rows, it will return false.

    Also, take a look at the documentation for FetchRow().

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

Sidebar

Related Questions

Well, I have a problem (ok, no real problem, but I wanna try out
Well i am currently trying to do a query in SQL, but i wanna
get this from my database: 252.587254564 Well i wanna remove the .587254564 and keep
Well. Hi everybody again. I have a trouble with some script that I wanna
Well the subject is the question basically. Are there any version control systems out
Well... simple question, right? But with no so simple answers. In firefox i use
Well, it seems simple enough, but I can't find a way to add a
Well it's not realy causing any errors. Anyways i'm sending ajax request and getting
Well, question maybe doesn't correct, but I give a shoot. My script: <a href=javascript:var%20u=location.href;window.open('http://localhost/url='+u);void(o)
I have create several canvas with transparent background and wanna make some move event

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.