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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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