Jump to content

Zane

Administrators
  • Posts

    4,362
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Zane

  1. Here ya go. http://www.sitepoint.com/forums/showthread.php?530093-Regex-Help&p=3713338#post3713338
  2. Well first off, where is this $row variable created? Not to mention $result[0]... You ask for help with debugging yet you do not provide all the relevant code. That's like taking out your car's alternator.. bringing it to the mechanic and saying "My car just won't start.. why not?"
  3. It is possible, but doing so would require the editing of operating system files. You would have to append something to the OS functions for file traversing/copying/deleting/etc... that triggers a php script to execute as a command in the background. I myself have no idea where to even begin doing such a thing, but editing the OS files is definitely where you would sniff around.... and that could have hazardous effects if you do not know what you are doing. Surely there is some software out there that can keep up with your file modification actions so that you don't have to risk your OS.
  4. You can't just expect us to look at this and figure out what your problem is. You've made it apparent that you want to show a captcha after 3 failed login attempts, but it would make things move smoother for everyone if you pointed out what is or is not doing correctly?
  5. PHP's DOMDocument class is the most effective method for scraping... unless of course you just LOOOVE regex that much... I would imagine not. Something like this should get you started $doc = new DOMDocument(); libxml_use_internal_errors(true); $doc->load('http://somewebsitepage.wtf'); $xpath = new DOMXPath($doc); $nodes = $xpath->query("//div[@class='ProductPageNav'/a"); foreach ($nodes as $node) { echo $node->nodeValue(); }
  6. A screenshot would be helpful.. or a link to the actual site of this problem. Otherwise, we will have to create our own HTML to go along with your CSS.. and that could take quite some time.
  7. $query ["SELECT * FROM shoe WHERE itemcode LIKE '%".$itemcode."%' "] or die(mysql_error()) You are missing the equals sign. Also, why do you have this in square brackets? This part while ($i < $num) { $itemcode=mysql_result($result,$i,"itemcode"); $itemdesc=mysql_result($result,$i,"itemdesc"); $color=mysql_result($result,$i,"color"); $size=mysql_result($result,$i,"size"); $price=mysql_result($result,$i,"price"); $qty=mysql_result($result,$i,"qty"); $i++; } ....is better off like this while ($r = mysql_fetch_assoc($result)) { $itemcode=$r['itemcode']; ... ... ... ... } And finally,. your code will only display ONE result, which will be the very last one in your $result. The displaying HTML needs to be within the while loop
  8. Could you elaborate a bit more? AKA, put more effort into your question?
  9. Yea, you would need a better condition than ready()... like txtbox1.change() or something
  10. What exactly do you mean by storing those items in a table? If you are talking about a database table then that is just outright illogical. You would need to be authenticated in the first place to access that table. To answer your second question, Yes. Pretty much any server-side language will be able to store session data as well as create cookies. PHP offers $_SERVER variables as a means to get the information of the user. Data such as the user's IP, browser name, referring page, operating system, etcetera are all available in the $_SERVER superglobal. While this variable is not readonly, it is useless to store data in since each page refresh will, AFAIK, generate a rebooted array of values. PHP is a very very well documented language, it is even safe to say that it is the BEST documented language. Take a look through it if you haven't already.
  11. Cisz, you have failed to even mention the exact problem you are having. You pretty much just regurgitated your code out to us and said "It doesn't work." As you can see by the number of replies you surprisingly have already, this community wants to help you, but they cannot do so effectively if you do not ask your question effectively. Are you positive that your file uploaded correctly? If you are not sure, then check through FTP or whatever means you use to view your files.... if it is there, then you're problem may be that you are giving the wrong path. We need to know things like, your directory structure and whether or not the upload actually works....etcetera... details.
  12. you are MUCH MUCH better off using PHP's DOMDocument class. Scraping information like that is sooo much easier and it is also easier to fix whenever that site changes something in their code. Google DOMDocument and you should receive everything you need.
  13. The real solution to your question is the syntax of the mysql_result function. Sure, I agree that you should not nest mysql functions, but your code should still work regardless and I'm not gonng preach to you about "ideal coding practices". The number one step in figuring anything out in PHP is to look at it's very elaborately awesome manual. You are currently using this code mysql_result(mysql_query($query), 0, 0); If you were to look at the manual for mysql_result you would realize you should be using this syntax. mysql_result(mysql_query($query), 0); Why? because your query only selects ONE field. There is no point in specifying the third argument when you only have one field. It is optional If you did want to specify the third argument, it would be easier to use the fieldname mysql_result(mysql_query($query), 0, "thefieldname"); Theoretically, your use of the function should work, which says "mysql_result, first row, first column". I don't have an answer for why that isn't working as expected but I know that using the fieldname will fix it.
  14. I am participating in this question mainly because I too am interested. I like the idea of having a XML/JSON file created. What I wonder though, what would be the method with the most integrity, etcetera. My idea is that you could create a new JSON file per session. If the user uses the search bar more than one, the JSON file is just overwritten since the file would be named using their session_id(). Then, somehow I would need to delete all of these files systematically. It seems a chrontab could do this the best?. I am moving this to Application Design btw.
  15. A better idea would be to add the extra view in your SQL update query UPDATE videos SET views = views + 1 WHERE ..... ...NOTE.. and yes, there is no $view variable in that query. All that query will do is increment the views field by one.
  16. Yes you do. Except for the last part. You do not have to end the session. Sessions end when the browser is shut down.
  17. directory does not come from a file-input field. It should be $_POST['directory']
  18. Sign up for Google Analytics, it provides WAY more information that you could imagine.
  19. The question has been answered yet the OP has been offended.. there's no point in keeping this thread open. Although I will agree with Jessica in the pointing out of whining. This is the internet, please try not to take people too seriously and as for the others... watch your words when you know damn well it could set someone off and destroy a thread.
  20. Something like this should do the trick. <ul> <li><a<?php echo isset($_GET['id'] && $_GET['id'] == 1) ? " class='active'" : "";?> href="page.php?id=1">Lorem Ipsum</a></li> <li><a<?php echo isset($_GET['id'] && $_GET['id'] == 2) ? " class='active'" : "";?> href="page.php?id=2">Lorem Ipsum</a></li> <li><a<?php echo isset($_GET['id'] && $_GET['id'] == 3) ? " class='active'" : "";?> href="page.php?id=3">Lorem Ipsum</a></li> <li><a<?php echo isset($_GET['id'] && $_GET['id'] == 4) ? " class='active'" : "";?> href="page.php?id=4">Lorem Ipsum</a></li> </ul>
  21. Maybe I'm just reading your question wrong or maybe it is just too early in the morning, but I cannot seem to grasp the logic of what you want to accomplish. From what I understand, the letter a would represent 10? The number 36 would be represented by z? Afterthat I get completely lost? What exactly would 3A represent? or 1A, 1G, etc.. It would help if you could elaborate more on what certain numbers would be represented by.
×
×
  • 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.