Jump to content

scoot

New Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by scoot

  1. All that hair pulling, and it all came down to forgetting the 'i' in mysqli_fetch_array. It's working now, of course. Thank you greatly, Benanamen. Regarding your suggestion to use PDO, where do you learn about that? I'm obviously a newb and I've been studying this book titled 'PHP and MySQL for Dynamic Web Sites' by Larry Ulman. Oddly, I don't see that he has an example to populate a drop down. Besides that, I've had mixed feeling about the book from the content itself to the presentation of the ebook. Are you aware of a book or source for a somewhat-beginner to get up to speed on PHP and mysql, like one that actually talks about PDO instead of mysqli?
  2. Here is that dump in .sql format but with the extension changed to .txt. rackspot.txt
  3. Hi Ben, Your requested page is up: http://www.isomgalaxy.com/bookproj/rackspot/for_benanamen.php I've also attached the page in question and the DB dump. I had to attach the DB dump as a PHP array because the site wouldn't allow .sql or .csv files to be attached. Thank you greatly for the assistance. Scott regslot_1.php rackspot.php
  4. Hi Ben, That latest code doesn't seem to be giving us anything. You can click the link below to see what the web page is showing. The current php code with your suggestion is below that. http://www.isomgalaxy.com/bookproj/rackspot/regslot_1.php Again, thanks for your help. Scott <?php // Connect to the DB require ('../../../mysqli_connect_rackspot.php'); // Set up query to build company menu drop down $q2 = "select compid, comp_name from company"; $r2 = mysqli_query($dbc,$q2); $row2 = mysql_fetch_array($r2, MYSQLI_ASSOC); echo "<pre>"; print_r($row2); echo "</pre>"; die; //echo "<pre>"; //print_r($r2); //echo "</pre>"; //die; $num2 = mysqli_num_rows($r2); echo '<p>Number of rows found in company query ='. $num2 . '</p>'; // echo $r2[0]; // build the company select menu using PHP echo '<p>Please select the name of the company: '; echo '<select name="company">'; while ($row2 = mysql_fetch_array($r2, MYSQLI_ASSOC)) { echo '<option value="'. $row2['compid'] . '">' . $row2['comp_name'] . '</option>'; } echo '</select></p>'; mysqli_close($dbc); // clost the DB connection ?>
  5. Hello AGain, Ben. I tweaked it further. I think I'm getting what you wanted to see, which is this: mysqli_result Object( [current_field] => 0 [field_count] => 2 [lengths] => [num_rows] => 2 [type] => 0) See full page: http://www.isomgalaxy.com/bookproj/rackspot/regslot_1.php
  6. Hi Ben, Thanks for your help. I added that code in the suggested location. There is no output. Also, the select box now does not show up. Below is the link but since php is involved it won't show much. http://www.isomgalaxy.com/bookproj/rackspot/regslot_1.php My mind is blown. I'm picking this back up tomorrow. Thanks again. Scott
  7. Are you referring to the " while ($row2 = mysql_fetch_array($r2, MYSQLI_ASSOC)) "? The below code works for me when building a table from a DB. Based on this, shouldn't the $row2 reference be working? while($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) { echo '<tr><td align="left">' . $row['name'] . '</td><td aling="left">' . $row['dr'] . '<td></tr>'; } I never saw an error message for using '@'. I took it out. Didn't seem to help.
  8. Hi All, I'm having a problem populating a Select/drop down menu using data from a MySQL table. Below is the code. It will build the select drop down but nothing is in it (won't drop down). In the code below, you'll see that I put in a test to ensure the query is actually pulling back rows. It's finding the two rows in the table, which is expected. The name of the fields in the DB are 'compid' and 'comp_name'. To see the issue, click the below link and scroll down to where it says "Please select the name of the company...". http://www.isomgalaxy.com/bookproj/rackspot/regslot_1.php Anybody have any ideas? Thanks in advance. Scott <p><?php // Connect to the DB require ('../../../mysqli_connect_rackspot.php'); // Set up query to build company menu drop down $q2 = "select compid, comp_name from company"; $r2 = @mysqli_query($dbc,$q2); $num2 = mysqli_num_rows($r2); echo '<p>Number of rows found in company query ='. $num2 . '</p>'; // echo $r2[0]; // build the company select menu using PHP echo '<p>Please select the name of the company: '; echo '<select name="company">'; while ($row2 = mysql_fetch_array($r2, MYSQLI_ASSOC)) { echo '<option value="'. $row2['compid'] . '">' . $row2['comp_name'] . '</option>'; } echo '</select></p>'; mysqli_close($dbc); // clost the DB connection ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.