Thread: PHP + MySql

Results 1 to 2 of 2
  1. #1
    tenkan's Avatar
    Join Date
    Apr 2011
    Gender
    male
    Posts
    836
    Reputation
    10
    Thanks
    45
    My Mood
    Amused

    Angry PHP + MySql

    I need some help here.
    Some background info: I'm using a mysql database.
    In this example I'll call the database test9000
    My goal is to be able to check the following columns in the db:
    post_modified && ID against a backup the same db.
    Here will be the sql query to retrieve info:
    SELECT wp_posts.post_modified, wp_post***** FROM test9000.wp_posts.

    The ultimate goal is once a check it done, to see which db has the latest posts_modified, and replace the old post with a new.

    For instance, I write page A, you write page B and then we sync. If we try to jam the two backups together our ids will clash.

    This has to be done in PHP. I'm just stumped at how to open up my db back up file and select only the relevant table and then compare.

    Here is my code so far:
    Code:
    <?php
    if (!file_exists(CREATE_SCRIPT)) {
    	$error = 'Cannot find file "' . CREATE_SCRIPT . '".';
    } else {
    	$sql = file_get_contents(CREATE_SCRIPT);
    	if(!$sql)
    		$error = 'Unable to read file "' . CREATE_SCRIPT . '".';
    }
    if (!$error) {
    	$con = mysql_connect(SQL_HOST,ADMIN_USER,ADMIN_PASSWORD);
    	if (!$con)
    		$error = 'Could not connect: ' . mysql_error();
    }
    
    $old_post = mysql_query("SELECT wp_posts.post_modified, wp_post***** FROM test9000.wp_posts", $con);
    
    // Go into the db dump file and select the contents for the table "wp_posts" only
    
    $new_post = null;
    // Compare the contents of the columns "posts_modified and ID" to $old_post
    if() {
    	
    	// if the old stuff is newer, do nothing
    }
    else {
    	
    	// if the contents of the dump is newer, drop the old content for $old_post
    	// and replace it with the content from $new_post
    }
    
    
    
    ?>
    Any help would be greatly appreciated. If this isn't the right place to post, just let me know.
    Last edited by tenkan; 10-08-2011 at 05:09 PM. Reason: What the fuck, got censored O_o

  2. #2
    tenkan's Avatar
    Join Date
    Apr 2011
    Gender
    male
    Posts
    836
    Reputation
    10
    Thanks
    45
    My Mood
    Amused
    I hate the new website template. Can't figure out how to edit my first post.
    Anyway, I have another issue:
    I'm trying to dump one specific table from a database into a file.
    Code:
    Code:
    select * from `TableName` into outfile 'c:\\outputfile.txt'
    Still using mysql.
    Issue with that command is it only dumps the data inside the table. No create table/insert into procedures at all. Any commands do a custom dump like that?

Similar Threads

  1. Need PHP/MySQL/Html/CSS scripters
    By VernK in forum PHP Programming
    Replies: 6
    Last Post: 02-20-2013, 06:33 AM
  2. HTML,PHP,MYSQL Introduction
    By GG2GG in forum PHP Programming
    Replies: 1
    Last Post: 01-30-2010, 06:01 PM
  3. PHP, MySQL, Perl, CGI, Ruby.
    By Hellen351 in forum General Game Hacking
    Replies: 0
    Last Post: 10-19-2008, 04:20 AM
  4. Selling Phising files [Php & Mysql]
    By niek123 in forum Trade Accounts/Keys/Items
    Replies: 7
    Last Post: 03-27-2008, 11:27 AM
  5. Process_promocode.php[code]
    By ferrar1000 in forum WarRock - International Hacks
    Replies: 22
    Last Post: 10-02-2007, 06:55 PM