Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. All it means is that MYSQL doesn't know from which table `userID` you're referring to. You can fix it by referencing the table name before the column name, or by using an alias of the table name to keep it cleaner: SELECT u.* FROM usergroups ug JOIN users u ON ug.contactID = u.userID WHERE ug.groupID = 123
  2. Yeah: SELECT users.* FROM usergroups JOIN users ON contactID = userID WHERE groupID = 123
  3. $('#username').val(''); Edit: you may also want to add focus back to the input, which you can with: $('#username').val('').focus();
  4. I'm not sure. What are you trying to do? ord(whatever) and 203 would be be compared at bit-level by the Xor operator.
  5. "^" is a bitwise operator called Xor (exclusive or), that basically checks the bits between the given arguments, and sets all the bits to 1 where they're only set to 1 in one of the arguments. As a quick example: 1001 ^ 1000 = 0001 .. Because the first bit is set in both arguments, but the last bit is only set in the first.
  6. Take a look at how to set-up 'unique constraints' on a column or across several: http://dev.mysql.com/doc/refman/5.0/en/constraint-primary-key.html
  7. select @var_name; will return null even when the variable doesn't exist (as well as if it were actually null). Can you show the whole code and how it's contained?
  8. You can use the setInterval() method to periodically call your AJAX function. What have you tried so far?
  9. Using JavaScript to generate a menu is an awful idea. How will crawlers navigate your site?
  10. I couldn't really care less about all this banter about who's emotional, but phpdeveloper82, I wouldn't rely on "mastering" any one particular CMS for a steady supply of work. To be honest I wouldn't rely on any CMS knowledge. From what I've seen, experience with a particular CMS a company uses is considered a plus - not essential. If you have strong programming abilities then you'll pick up a CMS as you go along.
  11. Ah. Turns out you can't get the element by it's ID, you have to reference it's name: window.iframe_name.location.href="uploadprogress.php?id=test"; Which makes sense I guess. document.getElementById() returns a DOM element object, where-as the iframe's part of the window object.
  12. Fair enough. Is an error returned, or is the affected rows just 0?
  13. If you're returning multiple values from the string then you're best off using explode, as opposed to more complex string functions. You can also use list to easily extract the values into variables: list($module, $type) = explode('.', $str);
  14. If it's just up to the first period then you can use substr with strpos: echo substr($str, 0, strpos($str, '.'));
  15. You need to treat the iframe object like a window object. I.e. you don't update the HTML attribute, but the window's .location.href property: document.getElementById('uploadprogress').location.href="uploadprogress.php?id=test";
  16. You have magic quotes enabled, a deprecated feature of PHP. The manual explains how to disable it.
  17. Can you elaborate on "fails"?
  18. $editor_data = $_POST[ 'editor1' ]; $a = htmlentities($editor_data); $b = html_entity_decode($a); The problem is that you're encoding the encoded data (so it's encoded twice), then decoding it back to the once encoded data. You have to remember that $_POST['editor1'] has already been encoded, you just need to decode it: <?php // get the encoded data $editor_data = $_POST[ 'editor1' ]; // decode it $editor_data = html_entity_decode($editor_data); // set filename $fileurl = "index2.php"; // write to file file_put_contents($fileurl, $editor_data); ?>
  19. Why are you actually updating this table in the first place? You should store the user's ID in a table like that, not data that could possibly change in the future.
  20. You just quite literally echo it between the tags. In-case there's a closing </textarea> within the source however, you need to escape the data to entities with htmlentities: <textarea><?php echo htmlentities($str); ?></textarea> The mark-up will still appear the same within the textarea, however if you look at the source you'll notice - for example - a <p> tag looks like <p>. This means when the user saves, you need to decode the data before you write it back to the file with html_entity_decode.
  21. Wordpress it too overwhelming for a beginner, really? All you do is upload the files and follow the instructions. I think what he means is how to display a sub string of the article. You can use the PHP function substr for that (there's also a MySQL substring() function you could use) , but you're likely to end up with words cut off mid-way. You're best off using regex to match x amount of whole words, using <space> as a delimiter: preg_match('/^(\S+\s+){0,100}/', $str, $matches); echo $matches[0];
  22. You need to read the contents of the file in via a function such as file_get_contents, display it within a textarea, and then overwrite it again using a function such as file_put_contents. You'd need to consider how you'd securely implement it, so they're not able to access each others files. You can integrate TinyMCE if you wish, but that's handled/attached client-side (i.e. by JavaScript), the PHP process wouldn't change. Your best bet is to approach it one step a time. First get the source in a textarea. Then write it back to the file. Then implement the security. Then look into TinyMCE.
  23. Define 'very long'? MySQL can cope perfectly fine with millions of rows, provided you index it correctly. There's no need to make querying and maintaining the tables more complex than it needs to be. Also you loose out on being able to produce and stats or reports over multiple users.
  24. "Edit it on the page itself" - what do you mean by this exactly, in-place of each piece of content, or the whole source code is just presented for editing? Generally I think people ask how to do something on a support forum because they want to implement it themselves.
  25. The Linux/Windows machines will have different levels of error_reporting. All the notice means is that you're trying to use an index within an array that doesn't exist. i.e. $fields['user_name'] doesn't exist. To rectify you need to either explicitly set a value (even if it's an empty string) for $fields['username'] earlier within the code, or check that the index exists before you try to echo it: <input type="text" name="user_name" value="<?php if (isset($fields['user_name'])) echo $fields['user_name']; ?>" />
×
×
  • 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.