Jump to content

kpmedia

Members
  • Posts

    16
  • Joined

  • Last visited

kpmedia's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I don't usually post on "introduce yourself" type areas of forums. But I'm glad I found this place. It's nice to find a community not overrun by trolls and attitudes (ie, Stackoverflow). That's getting sadly rarer lately. I've been writing/editing PHP for the past 8+ years now, but I still find things I've never done before. Hey, we can't know it all! Before PHP, I mostly did ASP -- all the way back to my NT4 days. I see a lot of hosting-related questions around here -- one of my areas of expertise -- so I think I'll stick around to help others.
  2. Depending on the source server, something like this can be caused by security programs like mod_security. So keep that in mind. Glad you figured it out. (We all do stupid things! )
  3. I've never liked locahost solutions. It takes up too many system resources on the same system where you're trying to do the other work. What I do is use a dedicated server or VPS, and then alter my hosts file for localized DNS. The site has no remote DNS. (Sometimes it's a "live" site, and I want to test major changes first on the dev server.) This also works for shared hosting, though finding the server IP can be a bit harder to find depending on the host.
  4. I'm not sure that I understand what you're asking here... What exactly are you trying to install WordPress on -- a localhost, a blank VPS, a shared hosting account, etc?
  5. That redirect does not work because it's not an IIS redirect. You have two choices: 1. Buy Micronovae IIS Mod Rewrite for the server (dedicated or VPS only) which then allowed most htaccess to work on IIS. 2. Convert it to an IIS rewrite using the conversion tool in the IIS Manager (only available to the server admin). If not a server admin with "root" privileges, then you'll need to read some help docs online. Or ask here. But first, yoiu need to create a mod_rewrite rule, not a pure htaccess rule. Those don't work at all.
  6. I've never heard of anyone installing Putty on a CLI-only machine. That's .... odd. It's generally a desktop tool.
  7. This page is really helpful: http://corz.org/server/tricks/htaccess2.php?page=all I came across it some time back when I needed help with a specfic htaccess syntax.
  8. Never, ever, trust a host for backups. Pretend they don;t have one at all. You may need/want R1Soft. A good hosted solution that I use is from R1SoftLicenses.com -- self-hosting it isn't fun at all. And, as always, who is the host? We may be able to tell you if they're trustworthy or not. .
  9. Keep in mind that Webmin is just a server GUI, not a panel. Virtualmin is the panel, and you may need/want to use it for creating domains instead. Admin'ing a raw server is not for the faint of heart.
  10. Changing the URL is always a nuisance. What I prefer to do is put it on another server, then alter hosts. That's MUCH easier. I hate messing with localhost work.
  11. I'm not yet sure if his code will be helpful, but I will give it another look at some point. His suggestion to entirely remove the for loop is something I want to look into. The actual code is too complex right now and would break by simply removing it. I wanted to get it working first, then I can go back and look at ways to refine it. For example, replacing the deprecated code. This is one of those things I've had in my code library for several years now, having both taken snippets from other scripts online, as well as writing parts of it from scratch.
  12. No, I never have easy issues. It's was FOR WordPress, but not PART OF WordPress. WP is nice, but it has many limitations that can only be solved by exiting the loop and DIY in pure php. I often build stuff on top of WP, not in it. It was solved here: http://www.webhostingtalk.com/showthread.php?t=1438963 I was trying to run mysql_result before mysql_fetch_assoc. That solved the if/else issue. And I'd just never needed a non-simple mysql query that I can remember. (Sometimes it's hard to Google for something when you can't think of the exact jargon needed to do it! I'm too used to WP and vB, which use just basic 1,2,3,etc for multiples.) Stick a fork in this one. But thanks for trying to help. This is definitely a friendlier site than SO. .
  13. Here: I further simplified it. <?php mysql_connect(localhost, $db_username, $db_password); @mysql_select_db($db_database) or die("No connection"); $query = "Select * FROM table WHERE category in (1,2) ORDER BY id DESC LIMIT 10"; $query_result = mysql_query($query); $num_rows = mysql_num_rows($query_result); mysql_close(); ?> <?php for($i=0; $i< $num_rows; $i++){ //start a loop $row = mysql_fetch_assoc($query_result); if($row['category'] == '1') { $url = 'http://A/'; } elseif ($row['category'] == '2') { $url = 'http://B/'; } ?> - I selected everything (*) which is where the page name and the url come from. - When you run this code, the url (and ONLY the url) is offset by 1 from everything else that was queried and output. The problem here is that the database does not display the full FQDN, only the page itself. Each category has a certain url, so it's easy enough to put back. But when you query multiple categories, you need to if/else to separate it all back out. And that works fine -- except for that offset. I have no idea where it comes from. - page1 = page2 url - page2 = page3 url - page3 = ? The $i loop controls everything, not just the url. .
  14. No, it's not a search. That was just for illustration. It displays the most recent results for a row. In this example, I'm just showing the problem data: a page and it's URL. A query just queries data -- it doesn't process it. There's a loop -- like the WordPress loop. The database is part of a CMS, and can't be altered. This isn't a "from scratch" project. The main issue right now is that it pulls everything fine, but there's a -1 offset for the url. Everything else is fine -- but not the url. The query is probably fine, but the if/else statement has something wrong still. .
  15. I tried parent in (1,2) which is the same as the OR Problem is that the rows don't appear to line up with the data. It's off by 1. Trying to explain this easily is somewhat difficult. - the query is multiple columns -- WHERE, AND, AND, AND etc. For this example, I just showed 2: "stuff" and "parent" - "parent" can pull several types of data: 1,2,3,4,5,6,7. For this example, I just wanted to make it easy, ie 1,2 - "stuff" is exacted - there has to be a loop; it loops to the query limit (10) The database does not contain full URLs for the data being pulled. So a php statement has to create the URL. It's not actually Google/Bing, but more like; - google.com/folder1/subfolder1 - google.com/folder2 - google.com/folder3/subfolder3/subsubfolder3 I'm not showing the entire script as written -- it's too long and confusing. Everything works fine, except this. The loop is fine, the "stuff" var is fine.
×
×
  • 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.