Jump to content

PHP MySql Recordset . . . setting variables


kuyaRomeo

Recommended Posts

Two part question:

 

1)

 

I have a MySql table called "lang_key", which will store all of the common text for a site, which will allow easy site modifications from the "non tech" admin.  Now, I am creating a recordest that will pull the information from the table, and create a basic list of variables in php.

 

For example:

 

I connect to the database, and do a wildcard select.  I can figure out how to set a basic php variable like the example below:

$query1 = "SELECT * FROM lang_key";
$result = mysql_query($query1);	

while($row = mysql_fetch_array($result))
	{

		$template = $row['common_text'];



	}

 

There are three fields in my lang_key table (unique_id, string_id, and common_text')

 

What I want to do is take it a step further from the example and I want $template to be the value of "common_text" Where string_id = "curr_template"

 

I hope this makes sense?  I really just want to create my recordset and then populate the website with the recordset info.

 

 

Part II

 

Do you recommend that I use a lang_key database, or would it be simpler and more efficient to just create a lang page with static variables, and use the php file write option to update the page?

 

 

Thanks!!!

 

Link to comment
https://forums.phpfreaks.com/topic/215644-php-mysql-recordset-setting-variables/
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.