Echo in Echo

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi there,

First of thank you for reading.
I have the following issue.

I'm filling a select list dynamically with mysql and want the names
that are retrieved from de database to be changed by a DEFINE that
stated in other php file..
The first part works the names al get in the list but the DEFINE isn't
happening which is logic cause you have only one echo which is the
name from the database.
But putting an echo around that one doesn't work, does any of you have
a idea how to solve my issue.


   <select id="objectTypeSelect" tabindex="2">
do {
  <option value=" <?php echo $row_getObjectTypes['id']?>"><?php echo
$row_getObjectTypes["shortname"] ?></option>
} while ($row_getObjectTypes = mysql_fetch_assoc($getObjectTypes));
  $rows = mysql_num_rows($getObjectTypes);
  if($rows > 0) {
      mysql_data_seek($getObjectTypes, 0);
      $row_getObjectTypes = mysql_fetch_assoc($getObjectTypes);

Thank you



Re: Echo in Echo wrote:
Quoted text here. Click to load it

Shouldn't you be using a "while " loop rather than a "do
while" loop? You appear to be using $row_getObjectTypes in the echo
before assigning it with mysql_fetch_assoc. Unless you've already done
the mysql_fetch_assoc outside the code shown.

Also, why are you then doing a check if there are any rows in the result
afterwards? Surely, you need to check beforehand so you can prevent an
empty select input?


Re: Echo in Echo

Quoted text here. Click to load it

Solved it : )

If anyone is interested in the solution the echo needed to be like

<?php echo constant ($row_getObjectTypes["shortname"]) ?>



Re: Echo in Echo

ph34rl3ss escribió:
Quoted text here. Click to load it

 From the solution, I presume the question needed to be like this:

"How can I get the value of a PHP constant from a variable that contains
its name?"


-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor al baño María:

Site Timeline