drummer101 Posted December 31, 2007 Share Posted December 31, 2007 uname=mysql_result($result,$i,"username"); needs to be $uname=mysql_result($result,$i,"username"); Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted December 31, 2007 Share Posted December 31, 2007 uname=mysql_result($result,$i,"username"); needs to be $uname=mysql_result($result,$i,"username"); That line exists where? Edit: So i see, its in the original code. I assumed we were now working with rajiv's code? Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 31, 2007 Share Posted December 31, 2007 try this out <?php require('db_connect.php'); // database connect script. ?> <html> <head> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- saved from url=(0014)about:internet --> <?php $langg = $_GET['langg']; include_once($_SERVER['DOCUMENT_ROOT'].'/scripts/incgetvars.php'); switch ($langg) { case "FR": echo"<title>Le Pré De Barre. Zone du personnel, maintenez l'utilisateur.</title>" ; break; default: echo "<title>Le Pré De Barre. Staff zone, maintain user.</title>" ; } ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="../css/style1.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="header"> <div id="sitebranding"> <?php include_once($_SERVER['DOCUMENT_ROOT'].'/scripts/incsitebrand.php'); ?> </div> <!-- End of site branding div --> <div id="tagline"> <?php include_once($_SERVER['DOCUMENT_ROOT'].'/scripts/inctagline.php'); ?> </div> <!-- End of tagline div --> </div> <!-- end of header div --> <div id="navigation"> <?php $noshow =40; include_once($_SERVER['DOCUMENT_ROOT'].'/scripts/incgetnav.php'); ?> </div> <!-- end of navigation div --> <div id="bodycontentstaff"> <?php if (!isset($_POST['submit'])) { // If form has not been submitted this must be step 1 $stepno = 1; switch ($stepno) { case 1: // Start step 1. Ask which user to maintain. $query = "SELECT username FROM users" ; $result=mysql_query($query); $num=mysql_num_rows($result); ?> <h4>User maintenance - select user.</h4> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table align="center" border="1" cellspacing="0" cellpadding="3"> <tr> <td>User name?</td> <td><select name="uname"> <?php while ($row = mysql_fetch_assoc($result)) { echo "<option value='{$row['username']}' >{$row['username']}</option>"; } ?> </select> </td> </tr> <tr> <td colspan="2" align="right"> <input type="submit" name="submit" value="<?php echo $buttontext; ?>"> </td> </tr> </table> </form> <?php break; case 2: // Start step 2. User details maintenance. break; case 3: // Start step 3. Changed details are saved or abandoned. break; } } ?> </div> <!-- end of bodycontentstaff --> </body> </html> Quote Link to comment Share on other sites More sharing options...
drummer101 Posted December 31, 2007 Share Posted December 31, 2007 uname=mysql_result($result,$i,"username"); needs to be $uname=mysql_result($result,$i,"username"); That line exists where? Edit: So i see, its in the original code. I assumed we were now working with rajiv's code? We are, I'm just *zzzz* My fault Quote Link to comment Share on other sites More sharing options...
Johnain Posted December 31, 2007 Author Share Posted December 31, 2007 Yippee. I have solved it. The data was coming in, but my drop down box was a mess. If it is any help to anybody else, here is my solution !!! It was frustrating, but now I will remember it. $query = "SELECT username FROM users" ; $result=mysql_query($query); $num=mysql_num_rows($result); ?> <p>Number of users : <? echo($num); ?></p> <p><? echo(mysql_result($result,0)); ?></p> <form method="post"> <table align="center" border="1" cellspacing="0" cellpadding="3"> <tr> <td>User name?</td> <td><select name="uname"> <?php $i=0; while ($i < $num) { $linetext = "<option value= ' ".mysql_result($result,$i)." ' >".mysql_result($result,$i)."</option>"; echo( $linetext); $i++; } ?> </select> </td> </tr> <tr> <td colspan="2" align="right"> <input type="submit" name="submit" value="Select"> </td> </tr> </table> </form> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.