Jump to content

scootstah

Staff Alumni
  • Posts

    3,858
  • Joined

  • Last visited

  • Days Won

    29

Everything posted by scootstah

  1. I don't see your code usage anywhere in that wall of text. What is the actual path you are trying to use?
  2. You set it to the physical location of the first directory of your application. So if your application resides in "/var/www/someapplication", then you set your $basedir to "/var/www/someapplication".
  3. What did you set $basedir to? What is your directory structure?
  4. It probably doesn't allow smilies inside code blocks. But it is weird that it still parses the syntax regardless.
  5. You can create multiple applications while sharing common resources with CodeIgniter. Basically, just make each "branch" its own directory in /application. You can create a "common" in /application in which to share things like Models or Libraries that you might need, so that you don't have to duplicate the same Library in multiple places. I actually did something similar for a project recently. It worked out pretty well, but I did have to modify the system/core/Loader.php file to make the Loader class check the "common" directory when loading resources.
  6. MySQL is not a spreadsheet. Trying to contort it into one is just going to end in a headache. But, if you feel that system is adequate, then by all means. The way your code is now, you'd have to run a conditional for each variable. So something like: if (!empty($category)) { echo $category . '| '; } You might consider using an array instead, that way you could loop over it or just implode it. $breadcrumbs = array($category, $subcategory, $sub_subcategory_1, ...); echo implode(' | ', $breadcrumbs);
  7. Given the information, I don't think there's a lot to say here. Pick your favorite flavor of framework and/or CMS, and start building it. Preferably pick something that already has some libraries for integrating Facebook and Twitter (and whatever else you want).
  8. You'll have to decide if you want it to work without refreshing the page. If you don't care, then a simple form pointing to the same page would be fine. Every page load you'd just check for the form data and then highlight/dim accordingly. If you don't want the page to refresh, now you'll need some AJAX to call the PHP script. You can then either highlight/dim the images with Javascript or just replace the entire HTML with something returned from PHP. The former would be a little faster, but either works. As for the database, I would probably have at least two tables. One for storing image data, then one for tags. Since each image can have multiple tags, it makes sense to have a one-to-many relationship in the database. That is, one "image" row can have multiple "tag" rows. The "tags" table could just be something simple like: id, image_id, tag_name - with image_id being a FOREIGN KEY reference back to the image's PRIMARY KEY column.
  9. Well, the obvious answer is to check if "sub_subcategory_X" is empty before you display it. But I have to point out that that is some awful database design. Please read this article, which shows a more logical way to work with hierarchical data. EDIT: Also, please use tags next time to display your code.
  10. foreach($a as $B) EDIT: Well, that's a stupid bug.
  11. You have a few issues with your code. The biggest of which is that you are trying to use $category as both an int and an array at the same time. For example, you do foreach ($category as $cat) {, and then if($category == 0) {. That logic should have taken place before the foreach - since if $category is not an array, you'll get an error trying to use it in a foreach. You have a typo on this line, possibly leading to your "in_array" error: $cateogry = is_array($category) ? $category : explode(',',$category); Your database query is wrong. When you want to insert multiple rows, you need multiple sets. That would look like: INSERT INTO table (column) VALUES (set1), (set2), (set3) Currently, yours would look like: INSERT INTO table (column) VALUES (set1,set2,set3). See the difference? To fix this you'd need to: Change $category[] = $cat; to category[] = "($cat)"; Change VALUES ('$category')", $connect); to VALUES $category", $connect);
  12. Click the little button in the very top left of the reply box and the "stupid editor" will turn off.
  13. I believe he only wanted to know about leap year so that he could determine if February had 28 or 29 days. However, several PHP functions already handle that logic, so it's sort of irrelevant.
  14. I'm having a hard time understanding your question. Typically you would define the base application directory. That way your paths and includes are always consistent. So instead of having random "../", "../../someotherdir/blah", etc spread out in your code, it would be more like $basedir/someotherdir/blah. $basedir would be the absolute path, not a relative one (../ is relative).
  15. crypt() uses "rounds" to hash. This means that instead of hashing once and done, like sha1() or md5() do, it will recursively hash N times. It also adds the salt to the end result. But, the big thing is that it supports the Blowfish algorithm, which is very strong and takes a long time to run. If you don't know what you're doing, use a third-party library from someone who does. One of the more reknowned ones is PHPass, but a few others exist as well.
  16. Maybe start on their website, which has all of the info that you need. http://developers.facebook.com/
  17. You shouldn't be using addslashes for escaping database queries. Use mysql_real_escape_string instead. Actually, you should be using the mysqli_* or PDO libraries. mysql_* is deprecated and oldschool.
  18. Perhaps cal_days_in_month is what you're looking for.
  19. Before we go any further, let's make sure this is a code problem and not a server problem. Create a new .php file and put only the following in to it: <?php if (mail("[email protected]", "This is a test", "This is a test")) { echo 'success'; } else { echo 'fail'; } Make sure the "[email protected]" is where you want the test to be sent. Run the script on your GoDaddy server. If you get "success", make sure the mail is delivered. If it was, then we know it is a problem in your code above. If not, then something on the server is not configured properly.
  20. Wow, that is some very outdated code. Do you have a working mail server installed?
  21. There is no such thing as a "PHP link". You can link to a PHP page, but you would still be using HTML markup. It sounds like all you need to do is make another .php file and then link to it with an anchor tag. So, for example, create "all_results.php", and then create a link with <a href="all_results.php">View All Results</a> But I can't be more specific without knowing more about your environment.
  22. Your post is a bit vague. You can iterate through multiple database results with a while loop. $mysqli = new mysqli('localhost', 'root', 'root', 'dbname'); $query = "SELECT * FROM table"; // execute query if ($result = $mysqli->query($query)) { // iterate through results while($row = $result->fetch_assoc()) { echo $row['column'] . '<br />'; } }
  23. COUNT() only returns one row, so that's why you can't LIMIT it. You could do a normal SELECT query and then use PHP to count the result set.
  24. Yes, that's right. This will turn the input into an array. It works a little bit funky for $_FILES, in that each index will be an array, rather than an array of indexes. So it will look something like: $_FILES['userfile'] = array( 'name' => array( 'name1.jpg', 'name2.jpg' ) )
  25. You're close. Check out the manual page for strings; http://php.net/manual/en/language.types.string.php Since you're using double quotes you can either enclose the variable with curly brackets, or you can concatenate. <?php echo do_shortcode('[latestbyauthor author=" ($user->screenname)" show="3"]'); ?> <?php echo do_shortcode('[latestbyauthor author=" " . $user->screenname . "" show="3"]'); ?> EDIT: Oops, I guess you are actually using single quotes. So you'd have to concatenate then: <?php echo do_shortcode('[latestbyauthor author=" ' . $user->screenname . '" show="3"]'); ?>
×
×
  • 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.