Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
Can be shortened to: $str = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."; $chars = 20; if(strlen($str) > $chars) echo current(explode("\n", wordwrap($str, $chars))) . '... <a href="#">Read more</a>';
-
What was the boot order set to? What errors (if any) do you get if you try to install from a CD? Have you gotten that CD to work elsewhere?
-
Give them to me for free? I know, right?
-
I typically aim for local businesses whenever the market allows so (when you dont have 50 other web devs going after the same client.) You could always do the developer auction sites - I've heard some good things about http://www.getafreelancer.com/, but never used them myself. I'm kinda curious what others suggest too
-
I'm still waiting for my account to be activated
-
You'd actually be surprised on how many hits qualified people get in the freelancing section. I know of one that got a full time job from it, and a few that have gotten a lot of smaller jobs (but they were recurring clients)
-
Right click - End Process Tree... then load up msconfig and look for the service that launches that on every startup.
-
[SOLVED] Copying MySQL Table Data To Another Server
Philip replied to Monadoxin's topic in PHP Coding Help
If it's running through a bunch of scripts, why not push an single point to access the MySQL server, like an API.... where the other scripts call this single (set of) script(s) that update/insert where needed. Then create a separate MySQL user with limited permissions (such as just update/insert) on the single script's IP. That way even if that user got compromised, the least amount of damage could be done. -
[SOLVED] Copying MySQL Table Data To Another Server
Philip replied to Monadoxin's topic in PHP Coding Help
Is this a one time action? -
I would say I'm agnostic. I lean more towards atheist, because I see a lot of the same ideas/principles of the scientific side... but show me solid proof (not the bullshit like "but theres the bible" or "the ten commandments") and I'd probably jump over to being a believer. I can see this thread turning into a long heated argument
-
Here's a function I came up with real quick: <?php $totalPages = 30; // total pages $currPage = 17; // current page, from GET or whatever $maxDisplay = 14; // how many to show at once function Paginate($totalPages, $currPage, $maxDisplay = 10) { // Check to see if the current page var is OK if($currPage>$totalPages) { $currPage = $totalPages; } if($currPage<=0) { $currPage = 1; } // Just to have an even number on either side... if($maxDisplay%2!=0) { $maxDisplay--; } // Are there more pages than we would display? if($totalPages < $maxDisplay) { return range(1,$totalPages); } // Would the first element be a negative number or page #0? if($currPage-($maxDisplay/2) <= 0) { $range = range(1,$currPage); $range = array_merge($range, range($currPage+1, $currPage+$maxDisplay-count($range)+1)); return $range; } // Would the last element be past the total number of pages? if($currPage+($maxDisplay/2) > $totalPages) { $range = range($totalPages, $currPage); $range = array_merge($range, range($currPage-1, $currPage-$maxDisplay+count($range)-1)); return array_reverse($range); } // Otherwise, just add half the max display on either side return range($currPage-($maxDisplay/2), $currPage+($maxDisplay/2)); } /* // Testing: print_r(Paginate(30, -15, 10)); print_r(Paginate(30, 18, 10)); print_r(Paginate(30, 27, 10)); */ // Run through the results: foreach(Paginate($totalPages, $currPage, $maxDisplay) as $pageNumber) { if($pageNumber == $currPage) { // just show what page we're on: echo '<u>'.$currPage.'</u>'; } else { // normally show a link or whatever... but for simplicity we'll just show the number echo $pageNumber; } // add a space between the numbers echo ' '; } ?> By placing it in a function it allows you to reuse the code with different styles, etc. The function above returns an array of the page numbers, and you choose what to do with them. Is there a shorter way? Probably. Oh and a quick look at CV's tutorial, I think it covers it in a different way: http://www.phpfreaks.com/tutorial/basic-pagination
-
[SOLVED] IP tracking via comment (To deal with spammers)
Philip replied to MySQL_Narb's topic in PHP Coding Help
thorpe gave you the answer in his post -
OOPS - LOOKS LIKE SOMEONE LEFT THEIR CAPS ON..... or they are like 12 years old and trying to show that they have their panties in a wad by not appreciating the help they are getting (and yes you are getting help, they are posting links to good tutorials/articles.) Why don't you look at the tutorials, and try the example code the tutorials provide, and when you have a specific question about why this is better/why this works/etc, then post that.
-
@Dorky - Oops, sorry I was thinking of something else. @Bman900 - ignore the conversation that Dorky & I are having
-
You're correct, but it's a good habit to get into, because if you try to do: $list['someIndex'] = 'foo'; you'll get a warning.
-
<?php $result = mysql_query("SELECT email FROM newsletter ORDER BY id"); $list = array(); // start the array while($row = mysql_fetch_assoc( $result )) { $list[] = $row['email']; // put it into the list echo "".$row['email'].", "; } // list the array foreach($list as $email) { echo $email.'<br>'; } ?>
-
[SOLVED] Is There A Different Way To Fetch MySQL Data
Philip replied to NoSalt's topic in PHP Coding Help
I'd save the value to a variable, and reuse it that way. Also, there's no need to call for mysql_fetch_array, if you're not going to use the numeric indexes... try running mysql_fetch_assoc instead, it'll cut the array size in half -
Show all posts since last visit.
Philip replied to salathe's topic in PHPFreaks.com Website Feedback
Well technically - SMF has this, but it isn't per-topic basis (like we'd all like). I can "watch" a topic, For topics and boards I've requested notification on, notify me of: Replies and moderation, Moderation only if I started the topic, Only replies, Nothing at all. I'd say that pretty well fits your guidelines. -
I'm going to take a stab and say that the quotes in: {parse expression="intval( $items['pmData']['mt_replies'] )"} are causing the problem. You either need to escape them (if you don't want to run intval() by doing \" or you need to concat them by using a period, =".intval(...)."}
-
Okay, removing one of the ` from the SQL query would not have caused a PHP error. When you have an unexpected string, it almost always means you're missing a " or a '. Now, if you would have posted the MySQL error instead of just "SQL" in your trigger error, you'd have seen the problem. <?php include '/home/content/d/h/e/dherren/html/scripts/config.php'; include '/home/content/d/h/e/dherren/html/scripts/opendb.php'; include '/home/content/d/h/e/dherren/html/scripts/values.php'; $sql="INSERT INTO`dtherren`.`auto`( `name`, `last`, `mi`, `add`, `add2`, `city`, `state`, `zip`, `email`, `hp`, `cp`, `work`, `password`, `make`, `model`, `color`, `plate`, `make2`, `model2`, `color2`, `plate2`, `make3`, `model3`, `color3`, `plate3` ) VALUES ( '{$name}' '{$last}' '{$mi}' '{$add}' '{$add2}' '{$city}' '{$state}' '{$zip}' '{$email}' '{$hp}' '{$cp}' '{$work}' '{$password}' '{$make}' '{$model}' '{$color}' '($plate)' '{$make2}' '{$model2}' '{$color2}' '($plate2)' '{$make3}' '{$model3}' '{$color3}' '($plate3)' )"; $sql = "SELECT `ID`,`name`,`last`,`mi`,`add`,`add2`,`city`,`state`,`zip`,`email`,`hp`,`cp`,`work`,`password`,`make`,`model`,`color`,`plate`,`make2`,`model2`,`color2`,`plate2`,`make3`,`model3`,`color3`,`plate3` FROM `dtherren`.`auto`"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { printf( mysql_insert_id()); } mysql_free_result($result); $res=mysql_query($sql)or die(mysql_error()); ?> Also, I will note that using ` around the column names will tie your code to mysql. It is best to not use them, and name your columns words that are not reserved keywords.
-
[SOLVED] Updating a quantity by checking the product_model
Philip replied to Colton.Wagner's topic in PHP Coding Help
Toon is right, <?php session_start(); $_SESSION['parts'] = array(); error_reporting(E_ALL); ?> ... html here.... <?php mysql_connect(''); mysql_select_db('products'); $parser = xml_parser_create(); // The following are causing problems: $quantity = ($_SESSION['parts']['QTY']); $part = ($_SESSION['parts']['PART']); -
...`color`,``plate`,`make2`,... Notice something wrong with the backticks?
-
You're missing a closing " on your sql statement: $sql="INSERT INTO`dtherren`.`auto`( `name`, `last`, `mi`, `add`, `add2`, `city`, `state`, `zip`, `email`, `hp`, `cp`, `work`, `password`, `make`, `model`, `color`, `plate`, `make2`, `model2`, `color2`, `plate2`, `make3`, `model3`, `color3`, `plate3` ) VALUES ( '{$name}' '{$last}' '{$mi}' '{$add}' '{$add2}' '{$city}' '{$state}' '{$zip}' '{$email}' '{$hp}' '{$cp}' '{$work}' '{$password}' '{$make}' '{$model}' '{$color}' '($plate)' '{$make2}' '{$model2}' '{$color2}' '($plate2)' '{$make3}' '{$model3}' '{$color3}' '($plate3)' ); // The line above $sql = "SELECT `ID`,`name`,`last`,`mi`,`hp`,`cp`,`work`,`email`,`add`,`add2`,`city`,`state`,`zip`,`password`...