Page 1 of 1

php mysql parameter load

Posted: Mon Dec 15, 2008 10:51 am
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
}

Re: php mysql parameter load

Posted: Mon Dec 15, 2008 3:39 pm
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.