zbrahead Posted May 18, 2006 Share Posted May 18, 2006 [code=php:0]<?phpFunction detectpagecalled($page){if($page == home){callpagedatahome();}elseif($page == about){callpagedataabout();}elseif($page == contact){callpagedatacontact();}elseif($page == NULL){header("location:index.php?page=home");exit();}elseif($page != NULL){header("location:index.php?page=home");exit();}}function callpagedatahome() { $conn = mysql_connect("localhost","******","*******") or die("ERR:CONN"); $rs = mysql_select_db("pages",$conn) or die("ERR:DB"); $sqlhead1 = 'SELECT * FROM `home` WHERE `variable` like `head1` '; $sqlmsg1 = 'SELECT * FROM `home` WHERE `variable` like `msg1` '; $sqlhead2 = 'SELECT * FROM `home` WHERE `variable` like `head2` '; $sqlmsg2 = 'SELECT * FROM `home` WHERE `variable` like `msg2` '; $rs = mysql_query($sqlhead1,$conn) ; $head1 = Mysql_fetch_array($rs); $rs = mysql_query($sqlmsg1,$conn) ; $msg1 = Mysql_fetch_array($rs); $rs = mysql_query($sqlhead2,$conn) ; $head2 = Mysql_fetch_array($rs); $rs = mysql_query($sqlmsg2,$conn) ; $msg2 = Mysql_fetch_array($rs); }function callpagedataabout() { $conn = mysql_connect("localhost","******","*******") or die("ERR:CONN"); $rs = mysql_select_db("pages",$conn) or die("ERR:DB"); $sqlhead1 = 'SELECT * FROM `about` WHERE `variable` like `head1` '; $sqlmsg1 = 'SELECT * FROM `about` WHERE `variable` like `msg1` '; $sqlhead2 = 'SELECT * FROM `about` WHERE `variable` like `head2` '; $sqlmsg2 = 'SELECT * FROM `about` WHERE `variable` like `msg2` '; $rs = mysql_query($sqlhead1,$conn) ; $head1 = Mysql_fetch_array($rs); $rs = mysql_query($sqlmsg1,$conn) ; $msg1 = Mysql_fetch_array($rs); $rs = mysql_query($sqlhead2,$conn) ; $head2 = Mysql_fetch_array($rs); $rs = mysql_query($sqlmsg2,$conn) ; $msg2 = Mysql_fetch_array($rs); }function callpagedatacontact() { $conn = mysql_connect("localhost","******","*******") or die("ERR:CONN"); $rs = mysql_select_db("pages",$conn) or die("ERR:DB"); $sqlhead1 = 'SELECT * FROM `contact` WHERE `variable` like `head1` '; $sqlmsg1 = 'SELECT * FROM `contact` WHERE `variable` like `msg1` '; $sqlhead2 = 'SELECT * FROM `contact` WHERE `variable` like `head2` '; $sqlmsg2 = 'SELECT * FROM `contact` WHERE `variable` like `msg2` '; $rs = mysql_query($sqlhead1,$conn) ; $head1 = Mysql_fetch_array($rs); $rs = mysql_query($sqlmsg1,$conn) ; $msg1 = Mysql_fetch_array($rs); $rs = mysql_query($sqlhead2,$conn) ; $head2 = Mysql_fetch_array($rs); $rs = mysql_query($sqlmsg2,$conn) ; $msg2 = Mysql_fetch_array($rs); }#Testing to see if it works without include $page = $_GET['page']; detectpagecalled($page); Echo($head1); echo($head1['content']);[/code]The test at the end was designed to see if the script works, the script is to be included into my index.php file Any help would be GREATLY appreciated, i bhave debugged etc. and everything is fine 'n' dandy so i am at a loss to see what is wrong.The content of my mysql table at the moment is as follows:my column titles are:COLUMNS->variable,contentand as records i have:RECORD->head1,Testing head textRECORD->msg1,testing msg text Quote Link to comment https://forums.phpfreaks.com/topic/9954-mysql-content-selector-help/ Share on other sites More sharing options...
alpine Posted May 18, 2006 Share Posted May 18, 2006 You don't tell anything about what your exact problem is (errormsg)First off you need to quote[code]// if($page == home)if($page == "home")[/code]should get u one step further Quote Link to comment https://forums.phpfreaks.com/topic/9954-mysql-content-selector-help/#findComment-37011 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.