|
|
Due to the volume of spam happening on our forums, posting is now restricted to verified members only. If you're not verified, drop us a note with your username.
|
|
Home > FlexCMS Support Forum > Recent Messages
FlexCMS Support Forum
Recent Messages
| |
|
|
|
|
| December 17, 2008 @ 9:09pm | I don't think I have enough to go on there. What's the error message and/or problem you're having with it in a page? Can I see it somewhere in action in a FlexCMS page?
One thing that stands out is the form actions, those would definitely need to be changed for it to work within a FlexCMS page. If it's just a straight page with nothing else in the query string, you can replace
Code
<form action="dropmenus.php" method="post"> |
| with
Code
<form action="'.$MainURL.$QSData.'" method="post"> |
|
You'll also need to adjust the JavaScript source URLs, because the FlexCMS query string with slashes will confuse it for folders and those will fail. So this
Code
<script language="javascript" src="js/chainedselects.js"> |
| could be changed to
Code
<script language="javascript" src="'.$BaseURL.'/js/chainedselects.js"> |
| if the "js" folder is at the same level as the FlexCMS installation.
If that doesn't solve it for you I'm going to need more information.
David |
|
|
|
| |
|
|
|
|
Spot on | December 17, 2008 @ 7:04pm | Excellent it was the mysql_close causing that problem.
Nows heres the dooosy how to get it showing again? what is wrong with this please as it works quite well out of flex?
i.e. this what it should do www.doorstep.co.uk/phpscripts/php/dropmenus.php
this is the script less the start and close <? ?> and the mysql_connect command.
//this script veiws the stored values on database
$regions = 'regions'; $clubs = 'clubs'; $sport_id = '1';
$query = "SELECT DISTINCT(region) FROM {$regions} ORDER BY region_order ASC"; // query. $query_result = mysql_query ($query); $num_records = @mysql_num_rows ($query_result);
if (isset($_POST['submit'])) { // Handle the form.
$st = $_POST['st']; if ($_POST['region'] != "") { if ($_POST['county'] != "") { $co = $_POST['county']; $MD_error_co_txt = ""; } else { $co = FALSE; $MD_error_county = "*"; $MD_error_co_txt = "Select a county<br>"; } } else { $co = FALSE; $MD_error_county = "*"; $MD_error_co_txt = "Select a county<br>"; } } // END SUBMIT FORM
?> <script language="javascript" src="js/chainedselects.js">
</script> <script type="text/javascript"> //var hide_empty_list=true; //uncomment this line to hide empty selection lists
var disable_empty_list=true; //uncomment this line to disable empty selection lists
addListGroup("place", "place-region");
addOption("place-region", "Select a region", "", "", 1); //Empty starter option <?php while ($row = mysql_fetch_array($query_result, MYSQL_NUM)) { echo "addList(\"place-region\", \"{$row[0]}\", \"{$row[0]}\", \"{$row[0]}\"); ";
echo "addOption(\"{$row[0]}\", \"Select county\", \"\", 1); "; //Empty option
$query = "SELECT region_id, county FROM {$regions} WHERE region='$row[0]'"; // query. $query_results = mysql_query ($query); $num_county = @mysql_num_rows ($query_results);
if ($num_county == "0") { } else { while ($county = mysql_fetch_array($query_results, MYSQL_NUM)) { echo "addOption(\"{$row[0]}\", \"{$county[1]}\", \"{$county[0]}\"); "; } } } ?> </script>
<body onload="initListGroup('place', document.forms[0].region, document.forms[0].county, 'cs')">
<form action="dropmenus.php" method="post">
<table><tr> <td>Select area: </td> <td><select name="region" style="width:160px;"></select></td> <td><select name="county" style="width:160px;"></select></td> <td><input type="button" value="Reset" onclick="resetListGroup('place')">
</tr></table> <input type="submit" name="submit" value="Clubs in County"> </form>
<?php
$query = "SELECT club_id, name FROM {$clubs} WHERE region_id='$co' AND sport_id='$sport_id' ORDER BY name ASC"; // query. $query_result = mysql_query ($query); $countid="1";
?><script language="JavaScript">
<!-- hide contents from old browsers
var Cost;
function tally() { Cost = 0; <?php while ($club = mysql_fetch_array($query_result, MYSQL_NUM)) { echo "if (document.form.count{$countid}.checked) { Cost = Cost + 1; } "; $countid++; } ?>
document.form.Total.value = "" + Cost; document.form.Total2.value = "" + Cost;
}
//-->
</script> <form action="dropmenus.php" method="post" name="form"> <?php if (isset($MD_error)) echo $MD_error;
$query = "SELECT club_id, name FROM {$clubs} WHERE region_id='$co' AND sport_id='$sport_id' ORDER BY name ASC"; //query. $query_results = mysql_query ($query); $num_clubs = @mysql_num_rows ($query_results);
$query = "SELECT county FROM {$regions} WHERE region_id='$co'"; $result = @mysql_query ($query); // Run the query. $regiontxt = mysql_fetch_array($result, MYSQL_NUM);
if ($num_clubs == "0") { echo "There are no clubs listed in the database for this region.<p>"; } else { $countid="1"; $numsplit = ceil($num_clubs / 3); $numsplit2 = $numsplit * 2; echo "<b>{$num_clubs} clubs listed within the {$regiontxt[0]} region.</b><p> Total <INPUT TYPE=\"text\" id=\"Total\" value=\"0\" size=\"2\"><p> <TABLE cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" border=\"0\"><tr><td align=\"left\" vAlign=\"top\">"; while ($clubs = mysql_fetch_array($query_results, MYSQL_NUM)) { echo "<input name=\"club[]\" type=\"radio\" id=\"count{$countid}\" value=\"{$clubs[0]}\" onClick=\"tally()\">{$clubs[1]}<br>"; if ($countid == $numsplit OR $countid == $numsplit2) { echo "</td><td align=\"left\" vAlign=\"top\">"; } $countid++; } echo "</td></tr></table><br>Total <INPUT TYPE=\"text\" id=\"Total2\" value=\"0\" size=\"2\"><p><input type=\"submit\" name=\"submit\" value=\"Select and go to Club\"> </form> "; } ~~~~~~~~~~~ All I can say is many many thanks and if you get this one to work well Happy xmas may all your pressies be big 'uns Cheers R |
|
|
|
| |
|
|
|
|
| December 17, 2008 @ 3:58pm | I think your problem there might be the mysql_close function you're calling at the end. FlexCMS still needs that connection it started for the rest of the processing that happens after the page, so that would be my best guess, especially if you say the data is making it into the desired table from your query.
Regarding the pages, there's no actual folder, it's all processed through the index.php file. If you do a search for "core-Pages" you'll see the part where if the first argument in the query string is "pages", it goes and looks in the core-Pages table for one called whatever the next part is.
David |
|
|
|
| |
|
|
|
|
Still no luck | December 17, 2008 @ 1:16pm | This is coming up:
Access denied for user 'apache'@'localhost' (using password: NO) and this is the script I put in the flex pages and ticked the php box;
If (isset($_POST['submit'])) { //handle the form
//this script veiws the stored values on database
$query = "INSERT INTO clubs (club_id, name, region_id, memb_id, sport_id, date_added) VALUES (0, '{$_POST['name']}','{$_POST['region_id']}','{$_POST['memb_id']}','{$_POST['sport_id']}', NOW())"; if (@mysql_query ($query)) { print 'The Club has been added';
} else {
print 'Could not add the data because:<br /> ' .mysql_error()." The query was $query."; } mysql_close(); }
print ' <form action="add_club.php" method="post"> Club Name: <input type="text" name="name" size="40" maxsize="70" /> <input type="hidden" name="region_id" value="23" /> <input type="hidden" name="memb_id" value="1" /> <input type="hidden" name="sport_id" value="1" /> <input type="submit" name="submit" value="Add Club" /> </form>'; ~~~~~
The "clubs" table shows in mysql along with Flex's core-users , core-settings etc etc The club info is added to the database but Flex disappears and a white page with the above "Access denied etc" showing. Any ideas? What am I missing? ~~~~ Is there any way of showing the hidden folders in ftp that the pages scripts go to? i.e. The "index.php(now renamed md thanks to htacess)/pages" folders? |
|
|
|
| |
|
|
|
|
| December 16, 2008 @ 11:49am | If you're inside of FlexCMS already (ie PHP enabled block or page), you don't need to do anything to connect. It's already connected to that database to access the needed parts for Flex, so just go ahead and run your query.
David |
|
|
|
| |
|
|
|
|
MySql connecting? | December 16, 2008 @ 11:17am | Sorry to say I'm back with another ?
Using flex I can not connect to my data in the database even though in mysql admin all the tables are in with all the flex files (i.e your tables: core-blocks, core-countries, core-users etc with mine: clubs, regions etc) my script works perfect outside of flex using the mysql_connect.php but my script will not work outside of flex with your settings.php ( require_once('settings.php'); ). and vice versa in flex my script will not work even with a " require_once('mysql_connect.php'); " statement placed in the flex page. And if I use the text from mysql_connect.php and replace your settings text with it, even though the info contained within, use the same (user, pass, server and database) words then Flex dont work. again vice versa your settings text in my mysql_connect wont work my script.
mysql_connect.php <? ini_set ('display_errors', 1); // lets me learn wher mistakes are error_reporting (E_ALL & ~E_NOTICE); // dont show notices if ($dbc = @mysql_connect ('localhost', 'myusername', 'mypassword')) { if (!@mysql_select_db ('databasename')) { die ('<p>Could not connect to Database because: <b>' . mysql_error() .'</b></p>'); } } else { die ('<p>Could not connect to MYSQL because: <b>' . mysql_error() .'</b></p>'); } ?>
settings.php <? $DBUser = 'myusername'; $DBPass = 'mypassword'; $DBServer = 'localhost'; $DBDatabase = 'databasename'; $DBPrefix = ''; ?> Has the missing $DBPrefix in mine have anything to do with it?
Basically my question is; what is needed for my data to work within flex (remembering they are in the same mysql database) please? Many thanks R |
|
|
|
| |
|
|
|
|
| December 8, 2008 @ 10:01pm | No changes that I'm aware of. I'll check with one other person that has done some customizing on our site to find out.
Richard |
|
|
|
| |
|
|
|
|
| December 8, 2008 @ 12:13pm | Did you make any changes to any source files on the site? Perhaps any code added to blocks on the site? I'm not aware of any problems like that with FlexCMS.
David |
|
|
|
| |
|
|
|
|
| December 7, 2008 @ 11:57pm | David,
My mistake then. I didn't mean to reply to the custom code that you specified to the other user writing in. I was asking my own question that I'm experiencing. I added nothing to any code. I'm just having troubles viewing articles when they're clicked so I thought this was the place to write my message. |
|
|
|
|
|
|
| MEMBERS
|
|
|