Jump to content

cags

Staff Alumni
  • Posts

    3,217
  • Joined

  • Last visited

Everything posted by cags

  1. Thanks for the info nrg_alpha, I'll try to keep that in mind. I only started learning Regular Expressions at the start of the week, it took my a while to work out I needed the s at the end as the darn string had a newline char in it. I must admit I did pretty much assume that there would only be one instance of <![CDATA, and nearly suggested simply using substr to grab everything but the start and end tag. With that in mind I think I got the regex to do what I wanted it to do, which is a minor miracle in itself.
  2. Just a quick question, since joining the forums a few days ago I've seen alot of code like... FROM image m1 I've never seen this before, is that some sort of short hand to allow you to use m1 in-place of the table name for the rest of the query? Or something else I've missed?
  3. If you considered your code to be running perfectly before, then good news it's still running just as perfectly. By default XAMPP has error messaging set to E_ALL & ~E_NOTICE, which means show all error messages but not notices. I imagine that the default setting in WAMP must be set to E_ALL. Meaning show me everything. Generally speaking you get undefined constant if you have a line like $EntityID = $_GET[EntityID] ; Because the key isn't enclosed in quotation marks it assumes its a constant not a sting, upon realising it's not a constant it uses a string with the value of the constant name. Obviously in your situation your getting when you do have the string. I can only assume this is something todo with the @ sign which surpresses errors. Normally on the line of code you have you'd expect to see... Notice: Undifined index Anyway, you can either ignore the notices as that's what you were doing before, or you can go through sorting them out, it's up to you. EDIT: Never read your code carefully enough, it's the code further down throwing that error, ignore the stuff about the @ sign.
  4. No you shouldn't have to. If you have PHPMyAdmin, can you just paste SHOW COLUMNS FROM `events` in the SQL box and check/show us the output. If your certain that id has auto increment set, then it sound like one of the other fields is also set to be a key of some kind.
  5. Glad I took the time to have a look at your code, learnt a new function, never seen extract before. Anyway, the reason your code isn't working.... The extract function creates a variable of each item in the $_POST array using the key of the item as the name of the variables. In your code you check if $submit. But the name of the submit element on the form is $SubmitForm. Since the if has no else statement attached to it, the mail function is skipped altogether and nothing is ouput. So to solve that problem... <?php // just replace if($submit) // with if($SubmitForm) // near the bottom of your code. ?> I don't know if thats your only problem I didn't look in detail, but it's certainly the first your encountering.
  6. Assuming I understood your intension correctly. You could do it with regular expressions like so... preg_match("/^<!\[CDATA\[(.*)\]\]>$/s", $src, $out); $output = $out[1];
  7. I'm sorry but in what way does what your saying about boolean logic apply to my previous suggestion? The only parentheses used are to surround the inbedded SELECT statements. SELECT * FROM `wp_posts` WHERE `post_id` IN (SELECT `post_id` FROM `wp_postmeta` WHERE `meta_key`='state_value' AND `meta_value`='Suffolk') AND `post_id` IN (SELECT `post_id` FROM `wp_postmeta` WHERE `meta_key`='price_value' AND `meta_value`>='100000') AND `post_id` IN (SELECT `post_id` FROM `wp_postmeta` WHERE `meta_key`='beds_value' AND `meta_value`='2') If you (or anyone) say this doesn't return the correct results, I'm perfectly willing to accept that may be true. But stevebluck says it returned no results, all I'm saying is that surprised me since I created dummy tables with his example data and it successfully returned that row and no others. Granted the JOIN method is probably better, I don't know, I didn't realise you could join the same table multiple times hence the fact I gave up on the approach earlier.
  8. I believe meta_key and meta_value are in the table wp_postmeta. Forgive me if I'm wrong but does your code not assume it's in wp_posts? I'm quite surprised stevebluck said my previous attempt didn't work, I tested it on a mock up of what I believe his table structure to be.
  9. if(isset($_FILES['upload1'])) { if(move_uploaded_file($_FILES['upload']['tmp_name'], $target) && move_uploaded_file($_FILES['upload1']['tmp_name'], $target2)) { } } Was an example of what was wrong, but yes that inner iff statement says if 'upload' successfully moved and 'upload1' successfully moved. else { echo "Sorry, there was a problem uploading your file."; } The error message tells you the problem unexpected ELSE, basically the only valid place for the ELSE statement is... if($something) { // do summit } HERE Before somebody points out, I don't mean exacly there, it can be on the line below, the point is there can't be anything else between the closing bracket of an if statment and the word else.
  10. I saw this too the other day... http://news.bbc.co.uk/1/hi/health/7937926.stm Scientist have worked out how an image is stored in the brain. They think they will be able to use this knowledge to read minds...
  11. mysql_query returns a resource object, in order to extract a row from the resource object you use mysql_fetch_assoc or mysql_fetch_array. This array can then be accessed like a normal array/associative array. <?php while($row = mysql_fetch_assoc($result)) { echo $row['id']; echo $row['field_1']; echo $row['field_2']; // etc } ?>
  12. Yes as it's a block on only want to happen if it's true, then you have to surrounded it in the squiggly brackets to make it a code block. if you do... if(isset($_FILES['upload1'])) { if(move_uploaded_file($_FILES['upload']['tmp_name'], $target) && move_uploaded_file($_FILES['upload1']['tmp_name'], $target2)) { } } Then neither file will get moved if upload1 doesn't exist. With regards to inserting it into the database you will need to set up some kind of system so that if the file doesn't exist your query will still work only insert a blank string rather than the filename.
  13. You need it everywhere you access that $variable. Just from your first post I can see at least one other place you need it if(move_uploaded_file($_FILES['upload']['tmp_name'], $target) && move_uploaded_file($_FILES['upload1']['tmp_name'], $target2))
  14. Theres a 'solved' button to click in the bottom left corner of your screen.
  15. Wheras I am a beetle cyborg. I find it much easier to comunicate online, in the 'real world' people try to stamp on me.
  16. Off the top of my head try... date("F, j, Y", strtotime($speaker['date']));
  17. If the second file is optional, before running any line of code to-do with it you would use something like... <?php if(isset($_FILES['upload1'])) { // the code to perform on the file here } ?>
  18. Sounds ok to me. Trying to think of something else to say... Hmm... Seen plenty of sites that seem to be working on a similar premis.
  19. Ooops, I didn't even check the validity of the HTML, I just saw the PHP was wrong and fixed it.
  20. Any chance we can see the output of ... SHOW COLUMNS FROM `events`
  21. Try this... echo '<strong><a href="', $post['href'], '</strong>">', '<em>', $post['subject'], '</a></em>'; Your open <em> tag was not in speach marks to signify it as a string, it was also not concatenated with the . or seperated with a comma.
  22. Actually not wishing to confuse the OP, but... echo '<a href="', $post['href'], '">', $post['subject'], '</a>'; ...is a perfectly valid way of outputing data. Some argue it's actually better than.... echo '<a href="' . $post['href'] . '">' . $post['subject'] . '</a>'; It is not concatinating the strings together, it is using echo's ability to accept multiple parameters to output the data. As to tarleton, what error are you getting?
  23. You are certain that there is a valid result for those search queries?
  24. Checked out your site, theres nothing wrong with the PHP structure at a glance so it's not that. It's still that your site isn't parsing the PHP. Can I just confirm the .htaccess file is in the same directory as the index.html. It being hosted on windows shouldn't really matter, I use .htaccess files on my localhost, which is running on Windows XP. It's possible your host doesn't allow .htaccess files, they can be disabled in the configuration. Btw, I use Notepadd++ to work with .htaccess files (and many other files), it allows you to save directly as .htaccess and it's free. That would obviously work, but any links to http://www.ppltt.com/index.html would no longer work. Since it is the root index file it could be worse as most links probably point to just the domain, but still you could potential lose links. Obviously you could always use .htaccess files to redirect index.html to index.php.... oh wait, we might as well just get php working in html if we can get .htaccess working, lol
  25. Ooops, sorry, your right, I obviously forgot what I was doing half way through, lol. Let me try that again, I've never used the IN command, but assuming I'm grasping it correctly how does this sound? SELECT * FROM `wp_posts` WHERE `post_id` IN (SELECT `post_id` FROM `wp_postmeta` WHERE `meta_key`='state_value' AND `meta_value`='Suffolk') AND `post_id` IN (SELECT `post_id` FROM `wp_postmeta` WHERE `meta_key`='price_value' AND `meta_value`>='100000') AND `post_id` IN (SELECT `post_id` FROM `wp_postmeta` WHERE `meta_key`='beds_value' AND `meta_value`='2') Not sure if it will work, even if it will there may be a better way. I would have tested it, but without your table structure it's a bit difficult so I just through I'd throw it out as a suggestion.
×
×
  • 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.