Web Analytics Made Easy -
StatCounter Scoured the Internet... Unable to jump to row MySQL result index - CodingForum

Announcement

Collapse
No announcement yet.

Scoured the Internet... Unable to jump to row MySQL result index

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scoured the Internet... Unable to jump to row MySQL result index

    I cannnot find a good answer for me on this subject. I'm looping through a dynamic sql query to get different results from the same two columns. Eventually I want to have dynamic text areas. This worked before I tried to do it dynamically.. I check dynamic checkboxes on one page, pass the values over to the next page, and then try to loop through to get the code, code descr from the db. The link to the site is..
    http://www.dataspiral.com/WholeDocPh...tNotesList.php

    The code on the page receiving the posted data is:

    <?php


    $count = 3;
    $i=0;
    while ($i < $count){
    echo $i;
    $Code= $_POST[$i];
    echo $Code;

    $dbconnection = mysql_connect(host, database, password) or die("Died!");
    echo "Connected to MySQL". '<br />';
    mysql_select_db("dbwholedoc",$dbconnection) or die("Died!");
    echo "Connected to Database". '<br />';


    if ($Code <>''){

    $sql = ("SELECT Code, CodeDescr FROM VisitCodes where Code = '".$Code."'");

    echo "Query: " . $sql;


    $result=mysql_query($sql);

    ${'code'.$i}=mysql_result($result,$i,"Code");
    ${'codeDescr'.$i}=mysql_result($result,$i,"CodeDescr");

    echo $code0;
    echo $codedescr0;
    }
    /*result not coming through query for code and codedescr... query not executing correctly*/

    $num=mysql_num_rows($result);
    echo $num;



    ?>


    <?php
    mysql_close();
    $i++;

    }
    ?>

    Thanks in advance!

  • #2
    Check out the link in my signature (the one about [php] tags)
    "Tango says double quotes with a single ( ' ) quote in the middle"
    '$Name says single quotes with a double ( " ) quote in the middle'
    "Tango says double quotes ( \" ) must escape a double quote"
    '$Name single quotes ( \' ) must escape a single quote'

    Comment


    • #3
      All the code posted above is PHP. It is a block straight off the page. thx.

      Comment

      Working...
      X