Jump to content

Kingy

Members
  • Posts

    188
  • Joined

  • Last visited

Everything posted by Kingy

  1. Putting ` characters around unlock should get it to work: `unlock`. Either that or change the column name to not use a reserved word.
  2. Well to point you in the right direction.. start looking at how php and html forms interact. Learn how PHP uses POST and GET variables. From there you can create a simple form which allows the user to fill out the form and then using the file form element you can upload files to your server. Without getting into databases you could then learn how to list directories with php and then display images in order of created/modified date to achieve what you would like.
  3. I don't want to put you off and I really do encourage you to continue out learning web design/development BUT - and it's a huge but - trying to create the next ebay/craigslist will be near impossible. It would still be extremely hard if you had a lot of money to sink into it. Doing it will little to no money and hoping to 'make it big' will result in not much.
  4. Try and hardcode the path: include('/home/user/path/to/website/ConnectDB.php'); // or C:\path\to\website\ConnectDB.php if windows Also are you getting any errors?
  5. As Rifts said you can use GET variables with the search form <form method="GET" action="..."> <input type="text" name="searchterm"> <input type="submit" name="submit" value="Search"> </form> and that way when the end user hits search the url will look like: yourdomain.com/?searchterm=eminem You could then easily use mod_rewrite to turn those urls into yourdomain.com/search/eminem or something similar.
  6. Are your session variables getting set? If you hardcode a username (./uploads/user/) does it work?
  7. if you echo out the session variable can you see that it is getting set to spanish?
  8. You should try using jQuery and making using of the .html() function. Give the text area an ID and then do: var text = "Line 1\nLine2\nLine3"; $('#textareaID').html(text);
  9. I may be wrong but I think you need to pass through all input values for it to work. There are a couple of hidden inputs that I can see in the code. I usually use Developer Tools in Chrome to debug exactly what post variables/cookies are used and go from there.
  10. I don't really understand what exactly you're asking. So you're wanting a new page for every single thing that is uploaded? Would it not be easier to possibly store the filename/filetype in a database and then retrieve it when the time comes? That way you would only need a couple of pages max. 1 to upload and 1 to display. Actually you might not even need a database. You could pass through the filename as a GET or POST variable and grab it that way. Take for example: http://www.examplesi...?file=image.jpg and then on the display page: <?php $filename = $_GET['file']; ?> <img src="images/<?php echo $filename; ?>" />
  11. First of all I would stop using $row over and over as you will end up overwriting the previous results data. $row = "Number 1" $row = "Number 2" // Number 1 no longer exists So instead use things like $authorRow, $userRow, $galleryRow. This should solve your problem because in the last query you can use $authorRow['author_id'].
  12. try and escape the $ sign to stop it being used as a variable.
  13. As mentioned above DOMDocument and Xpath is the easiest way to go about it. <?php $dom = new DOMDocument(); $dom->loadHTML($content); // $content is the HTML code $xpath = new DOMXPath($dom); $value = $xpath->query("//path/to/tr/td[3]/text()")->item(0)->nodeValue; // change this path to suit ?>
  14. That'll do the trick. Thanks very much
  15. Have you tried it with 2 params (email, name)? In the code you pasted it shows as: $mail->AddAddress("email address to send to", "Name"); So try: $mail->AddAddress("test@email.com", "First Last"); If that works then try your $POST variables with email and fullname
  16. So I currently have two mysql tables. One called company and the other is for locations Company: id, name Location: id, companyid, city Within the location table one company can have multiple cities. ie id, companyid, location 1, 1, City1 2, 1, City2 3, 1, City3 4, 2, City2 5, 3, City1 6, 3, City3 Now what I'd like to do is when I run a search on 2 cities I would like to find the companies that have offices in both locations. For example: I do a search for City1 and City2. The result would be companyid 1 Another example: I do a search for City1 and City3. The result would be companyid 1 and 3 At the moment I'm doing the following query (I'll do the join to company table once I figure this out): SELECT companyid FROM location WHERE city = 'City1' and city = 'City2' However, this is returning 0 results. Even thought I'm expecting companyID 1 to return. Am I doing something so obviously wrong and I'm not seeing it or is my data structure so messed up that it won't allow this sort of query? Cheers
  17. I have some code that allows me to place quotes in the comments section on my site. But I can't seem to make it work for multiple quotes in the same post. For example: [quote=Kingy][quote=Person]This is the first quote[/quote]This is the second quote[/quote] I am posting this comment with a quote within a quote and it doesn't display properly The code i'm using is... <?php $pattern[] = "/\[quote=(.+?)\][\r\n]*(.+?)\[\/quote\][\r\n]*/is"; $replacement[] = '<div class="quote"><div class="quoteheader">\\1: </div>\\2</div><br />'; ?> Within that pattern I could match quote=(.+?) one or more times. Would that work? If so how would I then get it to replace it with the div code one or more times? Or should I be doing it another way?
  18. Ok i've managed to make the first one work. Still having confusion issues with the seond. For anyone that needs to know.. Before: if (eregi('^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)*[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?$',$domain) != 1){ After: if (preg_match("/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)*[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?$/i", $domain) != 1){
  19. you'll need a seperate switch statement for $ha...
  20. well using ?one= ?two= or whatever you'll need to use the $_GET method to retrieve all the info page.php?wow=hireus $str = $_GET['wow']; str will equal hireus.
  21. <?php $page = (isset($_GET['page'])) ? $_GET['page'] : ''; switch($page) { case 'news': include('news.php'); default: include('main.php'); } ?> Just add more cases to it, then point your browser to the page index.php?page=news etc. When you don't specify a page= or it the one you do specify doesn't exist then it'll auto revert to main.php
  22. I'm creating a domain lookup script from a php class I found online. Only problem with it is the fact that it uses the eregi function which I no is going out of fashion. Now i've never really used either eregi or preg_match so I have no idea how to convert one into the other. if (eregi('^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)*[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?$',$domain) != 1){ if(eregi($this->ext['.'.$domain_domain][1], $f_result)){ I've had a play with both of them and usually end up getting an error about using backslashes or something. I no it means that I need to escape the characters, but its just really confusing me. Can anybody help me out. Thanks in advance.
  23. I'm making a basic forum for the site i'm doing and one of the functions I want for the admins is to set the order in which the categories appear; ie. The current order might be (PC Games - XBOX Games - PS GAMES - MISC Games). However, when an admin adds the category WII Games he may want it to appear between XBOX and PS categories. What I was thinking is just put a categoryOrder field in the database and give it a value (1,2,3,4 etc etc) and just ORDER BY categoryOrder when the select statement is run. Now ok that makes some sense but if I give WII the categoryOrder row a value of '3' to put it in the third position, PS already has that value which leaves me in a pickle. Is there an easy way to then loop through the database and change each individual row to add one to each value, PS becomes 4 - MISC becomes 5 and so on and so forth? Or would you suggest I use some other technique of doing this. Thanks in advance
  24. Thanks I think you're on to it. I'll give it a go. Thanks
  25. See that was what I was thinking, and that would be great for replies to the base comment, but what about a reply to a reply lol.
×
×
  • 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.