Jump to content

asgsoft

Members
  • Posts

    56
  • Joined

  • Last visited

Everything posted by asgsoft

  1. That was my exact source! It felt like something that would fit the bill just right. Now how would I encorprate your code within what I've done?
  2. 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"
  3. 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
  4. 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
  5. 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?
  6. 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?
  7. What do you mean? So something like this: RewriteRule ^browse/eating-out/10/(.+)$/(.*)$/$ browse_coupons1.php?cat_id=10&sort=$1&page=$2
  8. 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??
  9. That's great! Thanks a lot! it works just fine thanks again
  10. there is! But doing so gives a HUGE error message which doesn't make sense
  11. 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
  12. Where can I find this temp folder? Will I find it in cPanel? Thanks
  13. 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: 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: However, when I tried to upgrade wordpress, this also happened: I also get an error message saying: 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
  14. Where is the best place to start learning about objects? also whats your view on using tpl files as mentioned in my previous post?
  15. 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
  16. but what if the actual database entry has variables? because doing what you said is still not working
  17. anyone can offer me help?
  18. Hi I need help with the eval() function. I have code (mixture of PHP and MySQL) stored in a database as shown below. 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.
  19. Can you explain how I can use it with a variable like this: $string = "<?php ob_start(); ob_implicit_flush(); ?>"; and then use it? Any help would be great
  20. 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
  21. 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?
  22. OK I can do this for a goods but when it comes to subscription payments then I am stuffed Any Ideas how to do it with that?
  23. Hi I am about to start a membership website where you have to subscribe to gain access. I have a user registration system in place but how do I encoperate Paypal IPN Subscription and recurring payments in it? Any Ideas or samples or tutorials out there? Thanks
  24. I can do the first part of building a PHP upload script Where can I find tutorials for the second part though?
  25. 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.