Jump to content

asgsoft

Members
  • Posts

    56
  • Joined

  • Last visited

Posts posted by asgsoft

  1. I cant edit it but I wanted to offer some sample data to help demonstrate:

     

    "program_name","merchant_id","code","description","url","start_date","end_date","region","Date_Added","exclusive"

     

    "Shop 1","1","CODE1","£20 off £90 spend","http://www.site1.com/ ","2013-07-04 00:00:00","2013-10-31 23:59:59","GB","2013-07-04 01:00:00","No"

     

    "Shop 2","2","CODE2","£10 off £60 spend","http://www.site1.com/ ","2013-07-04 00:00:00","2013-10-31 23:59:59","GB","2013-07-04 01:00:00","No"

     

    "Shop 3","3","CODE3","£5 off £35 spend","http://www.site1.com/","2013-07-04 00:00:00","2013-10-31 23:59:59","GB","2013-07-04 01:00:00","No"

  2. Hey guys,

     

    I haven't posted here in a while, so hello :)

     

    So I am confusing myself here and its really frustrating me! I am trying to parse some CSV content thats posted through a textarea input to further manipulate and insert into a database one row at a time.

     

    However, my current problem is that there seems to a rolling mismatch which means the output is always one more than the one it should be :S

     

    For example:

     

    Header 1 - Val1

    Header 2 - Val2

    Header 3 - Val3

    header 4 - Val4 Val1

    LINE BREAK

    Header 1 - Val2

    Header 2 - Val3

    Header 3 - Val4

    Header 4 - Val1 Val2

    LINE BREAK

     

     

    I've never experianced this problem before with a foreach loop so I was wondering if someone can tell me where it's going wrong:

    <?php
    
    $csvNumColumns = 10;
    $csvDelim = ",";
    $csvData = $_POST["text"]; 
    $data = array_chunk(str_getcsv($csvData, $csvDelim), $csvNumColumns); 
    
    foreach($data as $csvLine){
    echo "Header 1: $csvLine[0] <br />"; 
    echo "Header 2: $csvLine[1] <br />";
    echo "Header 3: $csvLine[2] <br />";
    echo "Header 4 - $csvLine[3] <br />";
    echo "Header 5: $csvLine[4] <br />";
    echo "Header 6: $csvLine[5] <br />";
    echo "Header 7: $csvLine[6] <br />";
    echo "Header 8: $csvLine[7] <br />";
    echo "Header 9: $csvLine[8] <br />";
    echo "Header 10:  $csvLine[9] <br />";
    echo "<hr />";
    }
    ?>
    

    Any idea what might be causing this?

     

    Thanks :)

  3. Hey everyone

     

    I am struggling to add tags and an Excerpt to my remotely published posts. The script is working fine, except it doesn't add these. Does anyone have any suggestions?

     

    Here is my code so far:

     

    <?php
    $user = "root";
    $pass = "";
    $host = "localhost";
    $dbname = "dbname";
    mysql_connect("$host", "$user", "$pass") or die(mysql_error()); 
    mysql_select_db("$dbname") or die(mysql_error());
    $query = "SELECT * FROM table where id='1'";
    $result = mysql_query($query) or die(mysql_error());
    
    $rpcurl = "http://localhost/wp/xmlrpc.php";
    
    while($get = mysql_fetch_array($result)){
    $title = $get['name'];
    $body = $get['article'];
    $excerpt = $get['summary'];
    $tags = $get['keywords'];
    $username = "username";
    $password = "pass";
    $categories = "4";
    
    $XML = "<title>$title</title>".
    "<category>$categories</category>".
    "<mt_excerpt>$excerpt</mt_excerpt>".
    "<mt_keywords>$tags</mt_keywords>".
    $body;
    
    $params = array('','',$username,$password,$XML,1);
    $request = xmlrpc_encode_request('blogger.newPost',$params);
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
    curl_setopt($ch, CURLOPT_URL, $rpcurl);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 1);
    curl_exec($ch);
    curl_close($ch);
    }
    ?>

     

    Cheers

  4. Hey everyone!

     

    This problem has been baffling me all day today.

     

    I am trying to compare dates which are in the British format to see if they are bigger and/or smaller than todays date.

     

    This is what I am using:

     

    if($start <= date("d/m/Y") && $end >= date("d/m/Y")){
    bla;
    }
    

     

    What this should do is compare and see if todays date falls between the $start and $end

     

    Where am I going wrong?

  5. I am trying to get variables from URLs, rewritten by htaccess and which are passed on using GET.

     

    At the moment I have:

     

    Options +FollowSymLinks
    RewriteEngine On
    
    RewriteRule ^eating-out.php?sort=(.+)&page=(.*)$ dev1.php?cat=1&sort=$1&page=$2

     

    Which is getting me a 404 error page when I access eating-out.php.. meaning the page isn't found.

     

    However, if I use this:

     

    Options +FollowSymLinks
    RewriteEngine On
    
    RewriteRule ^eating-out.php dev1.php?cat=1

     

    And try and access eating-out.php?page=2 it won't work.. the value of $_GET['page'] is still nothing.

     

    Any ideas?

  6. Hey Everyone!

     

    I am trying to figure out this problem and I can't seem to find much in terms of resources online!

     

    So I have set up a pagination system which produces URL's like this:

     

    http://www.sitename.com/index.php?cat=cat_name&sort=sort_by&page=page_number

     

    However, I want them to look like this:

     

    http://www.sitename.com/browse/cat_name/sort_by/page_number

     

    Is there a way I can do that via the .htaccess?

     

    At the moment, for each category, I am using something like this:

     

    RewriteRule ^browse/eating-out/9/(.+)/(.*)/$ browse_coupons.php?cat=9&sort=$1&page=$2

     

    That way, I have the category name in the URL, but also the id which I use to look stuff up with in the table.

     

    This is working OK so far, however.. what if it's something like: http://www.site.com/browse/eating-out/10/id/1 or http://www.site.com/browse/eating-out/10/id that just causes a 404...

     

    Is there anyway to make it such that the variables are not compulsory??

     

  7. hey evryone!

     

    I am a bit stuck here!

     

    I have a cPanel backup of a databse which I am trying to restore.

     

    Does anyone know what's the best way to do it? it's a tar.gz file.

     

    I tried extracting it but it has .MYD and .MYI and .FRM files.

     

    Any ideas on how I can get the data back in sql?

     

    Thanks

  8. Hey everyone!

     

    I really hope this is the right place to post this problem. I have have been struggling with this for over 3 months now.

     

    Have a look at the following screenshot:

    63815426ma1.jpg

     

    It just happened one day without me doing anything.

     

    And if I try and do anything I get an error message along the lines of:

    #1017 - Can't find file: 'ads' (errno: 2)

     

    However, when I tried to upgrade wordpress, this also happened: 20694910cf8.jpg

     

    I also get an error message saying:

    #1033 - Table './asgsoft_domainleft/wp_posts' was created with a different version of MySQL and cannot be read .
    This isn't true as I was only trying to upgrade WP and it was all done on the same server

     

    Can you help me fix this?

     

    Can my databse content be retrieved?

     

     

    Please help!!

     

    Thanks

     

  9. What I am trying to do is a template version of my site that is easier to edit. So I thought that if I have all the pages as a database entery it would work. However it doesn't seem that way.

     

    What do you suggest I try now?

     

    use a .tpl with databases to call the specific files?

     

    Any advice would be great.

     

    Thanks

  10. Hi

     

    I need help with the eval() function.

     

    I have code (mixture of PHP and MySQL) stored in a database as shown below.

     

    s_shot.jpg

     

    I am trying to use eval() like this:

     

    eval("\$get_tool_info['top']");
    echo $tool_top;
    

    to get the code to be processed.

     

    What do you advice me to do becuase at the moment it doesn't do that. It just prints the writing.

  11. Hi

     

    I would like to get some help with this.

     

    In my database I have two fields, one contains HTML and the other PHP code.

     

    How can I output the code so that the HTML is shown and also PHP is processed?

     

    Any Ideas?

     

    Thanks

  12. Hi

     

    Does anyone know where I can find a tool that will generate thumbnails automatically from its URL.

     

     

    Basically what I mean is:

     

    tool.com/gen.php?site=http://www.google.com/

     

     

    Would generate a 400x300 thumbnail automatically

     

    And also it would be easy to change the URL.

     

    Or is there a class/tutorial/code that I can use for myself that would generate the picture automatically straight away?

     

    Any Ideas?

  13. Hi everyone

     

    I've been searching the internet for tutorials that teach how to make an Ajax file uploader and all I can find are demos and ready made scripts

     

    Can anyone write me a tutorial or suggest one?

     

    Thanks

×
×
  • 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.