Jump to content

danielgrieve

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by danielgrieve

  1. I'm sorry but you seem to be contradicting yourself. Does the page work when you view it manually or not?
  2. Try using 'GROUP BY' in your MySQL statement, which I'm guessing will be something like so: list($client_newsRecords, $client_newsMetaData) = getRecords(array( 'tableName' => 'news', 'orderBy' => 'client ASC', 'groupBy' => 'client' )); Hopefully your getRecords() function is set up to handle 'groupBy' as the actual MySQL syntax is 'GROUP BY'.
  3. I can't tell whether your AJAX will work or not, but your PHP page won't do what you want. Remember to test your PHP pages themselves before calling them with AJAX, so that you can debug them easier. For example, you could easily go to http://localhost/p.php?action=add&name=Dan That would make sure that the script is going to work, which I bet it doesn't. The reason? You seem to have echo statements dotted around everywhere. You only use echo if you want to output something, you have it on your first line where it isn't needed (you're also missing a semi-colon at the end of this line). Change your code to this and see whether it works: <?php $action = $_GET['action']; switch ($action) { case 'add': add(); default: } function add() { $link = mysql_connect('locahost','root','root'); mysql_select_db('test'); $sql = " INSERT INTO 'user'(name) VALUES('". $_GET['name'] ."') "; mysql_query($sql, $link); echo '1'; } ?> Remember: check the page on its own first rather than calling it via AJAX, that way you will get any errors that PHP produces.
  4. It shouldn't be inside the if() statement that's for sure, so put it after this line: } else ob_end_clean(); I find it a bit odd that the documentation says to move the define() as then the if() statement you're moving it from does nothing (because it will be empty). Your new code should look like so: */ if (@ini_get('register_globals')) foreach ( $_REQUEST as $name => $value ) unset($$name); if (!defined('txpath')) { } define("txpinterface", "admin"); $thisversion = '4.2.0'; $txp_using_svn = false; // set false for releases ob_start(NULL, 2048); if (!isset($txpcfg['table_prefix']) && !@include './config.php' ) { ob_end_clean(); header('HTTP/1.1 503 Service Unavailable'); exit('config.php is missing or corrupt. To install Textpattern, visit <a href="./setup/">setup</a>.'); } else ob_end_clean(); define("txpath", $txpcfg['txpath']);
×
×
  • 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.