Jump to content

variable not echoing


DontheCat

Recommended Posts

I have stored some texts in the database associated with a variable name in my database ... I intend to use this in my site as global text using the variable name ...

This is the code I've created in a php file, which I'm 'including' in my webpage .

<div style="display:none"> 
<?php
mysqli_select_db($xxx, $database_xxx);
$query_Recordset1 = "SELECT * FROM text_declares";
$Recordset1 = mysqli_query($xxx, $query_Recordset1) or die(mysqli_error());
$row_Recordset1 = mysqli_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysqli_num_rows($Recordset1);
 ?>
  <?php do { 
      echo '$' . $row_Recordset1['bd_variable'] . ' = "' . $row_Recordset1['bd_desc'] . '"<br>'; 
    } while ($row_Recordset1 = mysqli_fetch_assoc($Recordset1)); 
	echo 'Company Name  =' . $company_full_name   ;
	?>
</div>

When i execute the file, this is the ouput

Quote

$company_full_name = "Some Company Pvt. Ltd."
$company_small_name = "Some Company"
$company_short = "Some"
$total_placements = "30000"
$total_verticals = "35"
$total_emps = "350"
$total_offices = "7"
$total_countries_present = "4"

Notice: Undefined variable: company_full_name in global_text_declares.php on line 13
Company Name =

not able to figure out why the $company_full_name is not showing in the echo.

Many Thanks for the support .

Link to comment
Share on other sites

Many Thanks Barand... ?‍♂️

I had tried it with a regular bracket instead of the curly and got a syntax error. ?

But I still haven't figured out what you meant here... The 1st row outputs the $company_full_name and i was trying to echo that.

1 hour ago, ginerjm said:

Your first retrieved row is being output correctly while your second one (and later) is being output incorrectly.

Thanks again.... Cheers

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.