Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. Unknown column 'uname' in 'field list' That's in your insert query - and it means that cokumn doesn't exist in your database structure. Are you sure you have a 'uname' and not 'uName' or 'username' or something like that?
  2. http://php.meetup.com/42/ That's mine Overall calendar : http://php.net/cal.php
  3. echo $result[0][$current]; Should be: echo $current;
  4. Yeah, I'm the same way. The help/general discussion on HTML-Kit is laid out horribly in my opinion. I hate newsgroups/message boards like that! I guess I'm just a forum guy
  5. Both - although I feel I'm too much of a perfectionist, and instead of getting decent code out there, I keep making minor adjustments... thus it's never really complete (typically my own sites). However, when deadlines loom around, I can get it done within the time frame. xlyex - I just started meeting with some local programmers myself, and I must agree it helps a lot. I have to ask though, have you/do you attend any PHP meetings around? There is a group where I'm at, but I'm a bit hesitant about going for some reason
  6. Oops! Had a typo, fixed version below: <?php error_reporting(E_ALL); // create a test string: $string = "Blah blah hello world =) [code]Code for you? skip a few ahah testing hehe one line "; // a new function, with 1 parameter that is required // note, i did change this so the string was required unlike the original function countLines($String) { // setup a new array, dont put anything in it yet $lines = array(); // if it successful in finding code tags in the string if( preg_match_all('#\ [code\]([^]]+)\[/code\]#i', $String, $Matches, PREG_SET_ORDER)){ // get line count $lineCount = count($Matches); // setup an array $returnArray = array(); // loop through each match for($i=0; $i<$lineCount; $i++) { // create a temporary array, for each line of the code tag // (when there are multiple lines inside ) $test = explode("\r\n", $Matches[$i][0]); // if the first line is just , we should get rid of it if($test[0] == '[code]') { array_shift($test); // (shifts array, so it'll ignore the [code] } // if the last line is , we need to "pop" it off the array if($test[count($test)-1] == '[/code]') { array_pop($test); // pretty much deletes the array item ([/code] } // count how many array items (or lines) are in the array still $returnArray[$i]['num'] = count($test); // and give the data back: $returnArray[$i]['data'] = preg_replace(array('~\ [code\]~','~\[/code\]~'), '',$test); } } // return the array of the line counts for each block return $returnArray; } // show an example of what it looks like and what values to call echo '<pre>'; print_r(countLines($string)); echo '</pre>'; ?>[/code] (missing an 'e' in '$Matches', line 34)
  7. Here we go: <?php error_reporting(E_ALL); // create a test string: $string = "Blah blah hello world =) [code]Code for you? skip a few ahah testing hehe one line "; // a new function, with 1 parameter that is required // note, i did change this so the string was required unlike the original function countLines($String) { // setup a new array, dont put anything in it yet $lines = array(); // if it successful in finding code tags in the string if( preg_match_all('#\ [code\]([^]]+)\[/code\]#i', $String, $Matches, PREG_SET_ORDER)){ // get line count $lineCount = count($Matches); // setup an array $returnArray = array(); // loop through each match for($i=0; $i<$lineCount; $i++) { // create a temporary array, for each line of the code tag // (when there are multiple lines inside ) $test = explode("\r\n", $Matchs[$i][0]); // if the first line is just , we should get rid of it if($test[0] == '[code]') { array_shift($test); // (shifts array, so it'll ignore the [code] } // if the last line is , we need to "pop" it off the array if($test[count($test)-1] == '[/code]') { array_pop($test); // pretty much deletes the array item ([/code] } // count how many array items (or lines) are in the array still $returnArray[$i]['num'] = count($test); // and give the data back: $returnArray[$i]['data'] = preg_replace(array('~\ [code\]~','~\[/code\]~'), '',$test); } } // return the array of the line counts for each block return $returnArray; } // show an example of what it looks like and what values to call echo '<pre>'; print_r(countLines($string)); echo '</pre>'; ?>[/code] That'll show: Array ( [0] => Array ( [num] => 5 [data] => Array ( [0] => Code for you? [1] => [2] => skip a few [3] => ahah [4] => testing ) ) [1] => Array ( [num] => 1 [data] => Array ( [0] => hehe one line ) )
  8. Just call $Matchs[0], $Matchs[1] etc.... it'll still show the though.
  9. I typically don't use it - I prefer using full syntax with braces. However, this application is a bit smaller than what I'm used to working on, so I don't think it will matter too much
  10. Oops, my bad, change foreach($row as $k => $v) { to foreach($array as $k => $v) {
  11. while ($row = mysql_fetch_array($query)) { $username = $row['username']; $email = $row['email']; $count++ ; } if($numrows > 1){ $return = "results";} else{ $return = "result"; } print "<p>Your search for $search returned $numrows $return.</p>"; print "$email<br>$username"; That loop will only set the last row found. You need to either create an array, each array item being an array of the results, or print directly from the loop. $array = array(); while($row = mysql_fetch_array($query) $array[] = $row; $return = (($numrows>1) ? "results":"result"); // if there should be an s or not print "<p>Your search for $search returned $numrows $return.</p>"; // show string foreach($row as $k => $v) { // run loop through each array element echo 'Email: ',$v['email']; echo 'Name: ',$v['username'],"\n"; }
  12. is incorrect syntax (I believe) Changing $query = mysql_query($sql); to $query = mysql_query($sql) or die(mysql_error()); would have helped
  13. I haven't used it, but I'll honestly say I think it's a waste of money. If done properly, typically a majority of your code can be re-used from other projects. Also, there are tons of open-source stuff that does the same thing (and more!) and they are 100% FREE! Which would save you what, $400-600!?
  14. Oops, sorry I should be in bed sleeping instead of surfin' the web
  15. /* build selection list for the year */ $today = time(); $startYr = date("Y", $today); //get the year from $today echo "<select name='syear'>\n"; $endYr = $startYr-90; // get the date you want to end up at for ($syear=$startYr;$syear<=$endYr;$syear--) { echo " <option value=$syear"; if ($startYr == $syear ) { echo " selected"; } echo "> $syear\n"; } echo "</select>\n";
  16. <?php // create a test string: $string = "Blah blah hello world =) [code]Code for you? skip a few ahah testing hehe one line "; // a new function, with 1 parameter that is required // note, i did change this so the string was required unlike the original function countLines($String) { // setup a new array, dont put anything in it yet $lines = array(); // if it successful in finding code tags in the string if( preg_match_all('#\ [code\]([^]]+)\[/code\]#i', $String, $Matchs, PREG_SET_ORDER)){ // loop through each match foreach($Matchs AS $Match) { // create a temporary array, for each line of the code tag // (when there are multiple lines inside ) $test = explode("\r\n", $Match[0]); // if the first line is just , we should get rid of it if($test[0] == '[code]') { array_shift($test); // (shifts array, so it'll ignore the [code] } // if the last line is , we need to "pop" it off the array if($test[count($test)-1] == '[/code]') { array_pop($test); // pretty much deletes the array item ([/code] } // count how many array items (or lines) are in the array still $lines[] = count($test); } } // return the array of the line counts for each block return $lines; } // show an example of what it looks like and what values to call var_dump(countLines($string)); ?>[/code] Does that help? --oops, looks like it didnt like it in code tags, we'll have to use
  17. Also, are magic quotes on and you are using addslashes( ) That would put like: Then stripslashes only takes one set away:
  18. As thorpe said, you need to sanitize your input.... But the query problem lies here: `city2` = '{$_POST['city2']}, (You're missing a ' ) `city2` = '{$_POST['city2']}',
  19. Im glad you think so
  20. Would if a number is between 1 and 4 automatically knock the other 2 qualifications out? If the number is 0, its not between 1 and 4, and if the number is 3, 3 isn't greater than 750, lol By the way, if you check if that number is between 1 and 4, including 1 and 4: if($var >= 1 && $var <=4)
  21. You deleted it from the wrong location. Note: _dl, not _cats
  22. while($row_rs_multi_dl = mysql_fetch_assoc($rs_multi_dl)); } That } afterwards is not needed. Proper indenting would help
  23. Look at this line with a syntax highlighter: echo "<div class='catdetail_header'><h1 class="style1">'.ucwords($row_rs_multi_dl['category']).'</h1>" ; echo '<div class="catdetail_header"><h1 class="style1">'.ucwords($row_rs_multi_dl['category']).'</h1>' ; See the difference?
  24. http://locusmeus.com/html-css/centerexample3.html
  25. As CV suggested - just use an array and cut out the middleman while($app_info = $database->database_fetch_assoc($app)) { $app_array[] = $app_info; } You'd have to change your query a little bit (select exactly what you want) $app_query = "SELECT `user_id`,`app_info1`,`item_id`,`profile`,`name`,height`,`width`+10 as width FROM se_apps WHERE user_id='".$this->user_info[user_id]."' AND app_info2=1 AND profile=1 ORDER BY order_id ASC LIMIT 0,30";
×
×
  • 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.