Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to query a previous query

how to query a previous query

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelptutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    piano0011
    wrote on last edited by
    #1

    Hey guys! I have the following code and I can't seem to find a way to query my previous query because $row['name']; is not working... Here is part of my code:

    \n";
    echo "

    \n";
    echo "Form Sub Category\n";

          	   $sql2 = "SELECT \* FROM forum\_cats WHERE admin < ?;";
               
              
          	   if(!mysqli\_stmt\_prepare($stmt, $sql2)) {
    	           echo "SQL error";
    	        } else {
    	          mysqli\_stmt\_bind\_param($stmt, "i", $admin\_user\_level);
    	          mysqli\_stmt\_execute($stmt);
    	          $result2 = mysqli\_stmt\_get\_result($stmt);
    	          while ($row = mysqli\_fetch\_assoc($result2)) {
                   $row = $row\['id'\];
                  
    	          	$sql3 = "SELECT \* FROM forum\_sub\_cats WHERE cid = ?;";
                      	
                     if(!mysqli\_stmt\_prepare($stmt, $sql3)) {
    	                echo "SQL error";
    	            } else {
    	                mysqli\_stmt\_bind\_param($stmt, "i", $row);
    	                mysqli\_stmt\_execute($stmt);
    	                $result3 = mysqli\_stmt\_get\_result($stmt);
    	                
    	                  echo "".$row\['name'\]."\\n";
    	               	   while ($row2 = mysqli\_fetch\_assoc($result3)) {
    	               	   	  $selected = ($row2\['id'\] == $id) ? "SELECTED": "";
    	               	   	 
    		               	   echo "     ".$row2\['name'\]
    
    V 1 Reply Last reply
    0
    • P piano0011

      Hey guys! I have the following code and I can't seem to find a way to query my previous query because $row['name']; is not working... Here is part of my code:

      \n";
      echo "

      \n";
      echo "Form Sub Category\n";

            	   $sql2 = "SELECT \* FROM forum\_cats WHERE admin < ?;";
                 
                
            	   if(!mysqli\_stmt\_prepare($stmt, $sql2)) {
      	           echo "SQL error";
      	        } else {
      	          mysqli\_stmt\_bind\_param($stmt, "i", $admin\_user\_level);
      	          mysqli\_stmt\_execute($stmt);
      	          $result2 = mysqli\_stmt\_get\_result($stmt);
      	          while ($row = mysqli\_fetch\_assoc($result2)) {
                     $row = $row\['id'\];
                    
      	          	$sql3 = "SELECT \* FROM forum\_sub\_cats WHERE cid = ?;";
                        	
                       if(!mysqli\_stmt\_prepare($stmt, $sql3)) {
      	                echo "SQL error";
      	            } else {
      	                mysqli\_stmt\_bind\_param($stmt, "i", $row);
      	                mysqli\_stmt\_execute($stmt);
      	                $result3 = mysqli\_stmt\_get\_result($stmt);
      	                
      	                  echo "".$row\['name'\]."\\n";
      	               	   while ($row2 = mysqli\_fetch\_assoc($result3)) {
      	               	   	  $selected = ($row2\['id'\] == $id) ? "SELECTED": "";
      	               	   	 
      		               	   echo "     ".$row2\['name'\]
      
      V Offline
      V Offline
      Victor Nijegorodov
      wrote on last edited by
      #2

      unfortunately your code nothing to do with C/C++/MFC... Maybe you will try to ask to some more appropriate forum?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups