php mysql parameter load

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
camc
Forum Newbie
Posts: 1
Joined: Sat Jul 26, 2008 3:30 am

php mysql parameter load

Post by camc »

hi sry my english

//* params field value:
param1=page
param2=menu
param3=content
*/
mysql_connect('localhost', 'root', 'root');
mysql_select_db('testparams');

$qry = "SELECT params FROM params";
$act = mysql_query($qry);

$row = mysql_fetch_array($act);

$params = $row['params'];
$salga = explode("\n", $params);
$char = '$';
$var = $char.$salga['0'];

if($var=='page') {
echo 'ok'; // not work :d
}
cavemaneca
Forum Commoner
Posts: 59
Joined: Sat Dec 13, 2008 2:16 am

Re: php mysql parameter load

Post by cavemaneca »

I'm not sure exactly what you want, but I'm guessing it just doesn't work, so I'll fix what I can tell is wrong.

Code: Select all

//* params field value:
param1=page
param2=menu
param3=content
*/
mysql_connect('localhost', 'root', 'root');
mysql_select_db('testparams');
 
$qry = "SELECT * FROM params";
$act = mysql_query($qry);
 
while($row = mysql_fetch_array($act);){
$params = $row;
$salga = explode("\n", $params);
$char = '$';
$var = $char.$salga['0'];
echo $var; // shows what is output
if($var=='page') {
   echo 'ok';
}
}
else {
echo 'not working';
This should at least get you started.

If this doesn't help, please explain what you are trying to do, and what is wrong. And do this every time you post a problem. If your English isn't good enough, use an online translator and post that here. At least you'll have all the words you need to express your problems.
Post Reply