double loop in php

2012-07-28  Source: Original Site  Category:PHP  Views:0 

Advertisement

i have the following code

<?php
$id = $_SESSION["user_session"];
$get = mysql_query("SELECT * FROM table WHERE id='$id'");
$total_found = mysql_num_rows($get);
if($total_found==0){
my code goes here
}else{
while($g = mysql_fetch_array($get)){
$id_2 = $g["id"];
$query = mysql_query("SELECT * FROM table WHERE id != '$id' AND id!='$id_2'");
while($z = mysql_fetch_array($query)){
mycode goes here
}
}

?>

but it is not working.........!! please let me know..........how can i implent double loop............becuse the above code is fetching only on id from first loop...........!! how can i do that.........!!

Related articles
  • double loop in php 2012-07-28

    i have the following code <?php$id = $_SESSION["user_session"];$get = mysql_query("SELECT * FROM table WHERE id='$id'");$total_found = mysql_num_rows($get);if($total_found==0){my code goes here}else{while($g = mysql_fetch_array($get)){$id_2 = $g["

  • Double combo in PHP/Javascript search form, data from MySQL 2012-04-09

    I try to make a double combobox in php/javascript. I already have a working version of this that uses PHP+Templates, but I do not want to use Templates. What I have today: This Script in <Head> section: <script language="Javascript"> var

  • Check box While loop in php 2012-11-20

    How can I get the values in Check box while loop in php. Pls give me some tips to get the values from the below php code. $sql=mysql_query("select * from tree"); while ($result = mysql_fetch_array($sql)) { echo "<br>"; echo "<label> <i

  • Ubuntu Passing queries with double quotes in PHP mySQL 2013-07-21

    How can I deal with users sending varibles with double quotes (") in PHP variables that will be used to build mySQL I would like to allow users to store double quotes in the database, but how do I do that? In the example below, if someone puts a doub

  • double loop in stored procedure 2013-10-05

    I’m working on a stored procedure that meant to mail out users some of their action items daily. The procedure has a double loop, first the user ids and user email addresses are selected into a table, then the outer loop cycles through the user ids a

  • 'Double Loop' in MS Access Report? 2014-07-02

    I need to write an MS Access Report which, for a given supplier record, first lists all invoice records for that supplier and then lists all branch records for that supplier. (Note that although invoice records and branch records are both related to

  • Unecessary Double Loops but Can't Find other Way 2015-01-24

    I am using a loop, inside the loop I do have a comparison. I do have a value that I want to write once, but since the value inside the loop can be one or more, I can't find a way to write the value inside the loop. The only thing I can do, adding a c

  • reading double encoded by php pack() error 2012-01-18

    Hi, ive been working on porting some php code to c# and have hit an error.... the number two when encoded by the php pack() funditon to a double doesnt get read correctly by c# or im doing it wrong. eg. the number 1 gets packed and has the byte repre

  • Problem with loop in php 2012-01-31

    Hi, I am working on a PHP page where I have 5 rate, 5 qty and 5 amount fields. When I am define all the fields manually, i.e. defining each field with a separate filed name, field id then it is working. But when I have used a loop to do that for me I

  • Domain API Loop in PHP 2012-12-05

    How can I perform the following with this API? Form is setup in PHP for registered user to enter domain name On submit.. Check if domain is available > - If NO > output to XML > run the loop again in 5 minutes - If YES > output to XML

  • mysql join and loop via php 2013-07-21

    i was wonderinig if there is a way to loop two tables in php. let me explain how it would need to work. i have tried a thousand time to get it to work but i cant. The script is part of my friends system that i made. when the user sends a friend reque

  • Running while loop inside PHP Mailer body 2013-07-22

    I am getting an error when I try to run a WHILE LOOP inside my PHPMAILER body. The error is: Parse error: syntax error, unexpected T_WHILE in C:\Web\MySite\adm\admInvoices.php on line 335 Here is the Mail code. Any help appreciated!: <?php if ($PO

  • WHILE & LOOP in PHP/MySQL script to show news not working correctly. 2013-07-24

    When I use the code below in a file to publish news on my website, it goes all weird. Basically, the latest newsid post is displayed at the top as it should be. However, underneath that, instead of more newsposts being displayed, the entire page is r

  • can we loop through 2 arrays in a single for loop in php 2013-11-06

    I have two arrays, Forms and formsShared. <?php foreach ($Forms as $r): ?> $("#shareform<?=$r['Form']['id'];?>").hide(); $(".Share<?=$r['Form']['id'];?>").click(function(){ $("#shareform<?=$r['Form']['id'];?>").toggle("show");

  • Database GROUP BY and Loops in PHP 2013-12-23

    Here is my situation: I have a database of files that can be downloaded. Each file has a corresponding product, and each product has a category. Kind of like this: [-]CATEGORY | [-]PRODUCT | [-]FILES | [-]FILES | [-]FILES | [-]PRODUCT | [-]FILES | [-

  • While loop in PHP 2014-05-21

    Im currently trying to get PHP to look through a webpage and pick out a picture of choice. Basically I have coded for the search to look for the keyword, and if 'alt=' is within 40 characters of the key word that picture will be selected. So in theor

  • TOTALLY lost: event looping with PHP? 2014-10-29

    I am wondering if anyone can give me any information/advice on PHP with event looping. ****** BACKGROUND INFO ****** I've actually been messing around with a Jabber PHP class (class_Jabber.php, gotten from http://code.blitzaffe.com/pages/phpclasses/f

  • Loop through PHP and js ?? 2015-01-01

    Is there some way I can loop through this code? using Ajax? Thanks for any recommendations. <?php$paintingBack=$paintingNumber-1;$paintingNext=$paintingNumber+1;if ($paintingBack < 1) {$paintingBack = $paintingBack + 1;} ?> <a href="" id=

  • how to cover while loop in php template 2015-05-22

    i am working on creating php templates for an application, but i am not understanding how to cover while loop in templates, my code is as follow, that is not right and of course not working at all, it is being posted just for example. Please any body

  • Puzzling result w/ simultaneous double loops (Very simple program) 2012-01-29

    Something that puzzles me in the following simple program: #include <iostream>using namespace std; int main(){int row;cout << "enter row: ";cin >> row; int K[row], m[row][5]; cout << "Enter all the " << row << " K