premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
ob_start and ob_end_clean Output buffering and by doing the end_clean it removes it the prints/echos from the buffer.
-
Post more code. You are setting $content to be equal to nothing somewhere in your code that is either in the loop or after the loop. Without the code I cannot tell you which or where.
-
SELECT (`budget`+`balance`) as BudgBal FROM table_name WHERE condition = somecondition Or an update: UPDATE table_name SET `balance` = (`balance`+`budget`) WHERE condition = somecondition Or from a variable: UPDATE table_name SET `balance` = (`balance`+ $budget) WHERE condition = somecondition
-
You have a lot of INDEXES on that table. When you do an update, especially on a table with 520,018 where all but 1 key is indexed. It takes time to update the indexes. Simple as that. The select does not actively update the index, so it pulls nice and fast, the update does update the indexes.
-
You are not using the code I specified. If you want it in one statement you have to do it like this: $content .= "<img src='http://www.site.com/images/". $info['photo'] ."' " . imageResize($resized[0], $resized[1], 100) ."> <br>" . "<b>Website:</b> ".$info['link_website_title'] . "<br> " . "<b>Description:</b> ".$info['link_website_description'] . " <br>" . "<b>URL:</b> ".$info['link_website_url'] . " <hr>";
-
[SOLVED] Upgrade to php5 makes some functions in phpBB2 not work
premiso replied to HaLo2FrEeEk's topic in PHP Coding Help
Really. I must not know what I am talking about. I mean, it is not like my guess was un-educated. I looked at your code and the error and saw that no data was being passed to the SQL. Which must mean, the data is not being retrieved in the first place. Check your php.ini file. My bet is the item Is set to off. Turn that to On and it should allow for $HTTP_POST_VARS to work again. As for why phpBB does not allow for $_POST, is beyond me. As they are requiring members to use depreciated code ($HTTP_POST_VARS has been depreciated since PHP 4.1). -
Wait for Windows 7. It will be well worth the wait. The RC1 of Windows 7 is released, and it works wonderfully. Even on a low end machine, it works great. Don't waste your money on Vista.
-
$content .= "<img src='http://www.site.com/images/". $info['photo'] ."' " . imageResize($resized[0], $resized[1], 100) ."> <br>"; $content .= "<b>Website:</b> ".$info['link_website_title'] . "<br> "; $content .= "<b>Description:</b> ".$info['link_website_description'] . " <br>"; $content .= "<b>URL:</b> ".$info['link_website_url'] . " <hr>"; Should take care of it.
-
http://www.tizag.com/phpT/examples/formex.php
-
[SOLVED] Upgrade to php5 makes some functions in phpBB2 not work
premiso replied to HaLo2FrEeEk's topic in PHP Coding Help
$HTTP_POST_VARS has long been depreciated. $_POST['deletebefore'] Is what it should be. Use $_POST; $_GET; $_COOKIE; $_SESSIONS now instead of the $HTTP_XX_VARS -
I do not think it is possible, but you might be able to accomplish it with a "view", but I am not sure how it would be setup. I would look into MySQL Views and see if you can figure it out through that.
-
Can't select random entry from array with one entry using 'array_rand'
premiso replied to eugeniu's topic in PHP Coding Help
Ternary operators act like a shortened if/else. (condition is true/false) then ( ? ) do this else ( : ) do that. EDIT: On a separate note, if you wanted to get a random element, you could have just used shuffle with current $rand = current(shuffle($levelz)); $db = "quizdocs/" . $rand . ".txt"; Should work just as well, without the need for the ternary statement. -
On a side note, please do not double posts topics in separate forums. It is against our rules. Posting it in the correct forum, which you had right the first time, is all that you need to do. Moved this one to MySQL as well.
-
Can't select random entry from array with one entry using 'array_rand'
premiso replied to eugeniu's topic in PHP Coding Help
$rand_keys = (count($levelz) > 1)?array_rand($levelz, 2):array_keys($levelz); // you can change the 2 to be dynamic if you wish or just leave it at 2. What this should do is if $levelz as more than 1 item it uses array_rand, if not well randomizing will not do us anygood, so it just grabs the array keys. -
Query: post reply in PHP Freelancing?
premiso replied to rupam_jaiswal's topic in PHPFreaks.com Website Feedback
If you must know...Sticky Comics Those might be right up your alley Mchl -
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { // if it's a valid page number... $slash = ($x != ($currentpage - $range) || $x != $totalpages)?"/":""; if (($x > 0) && ($x <= $totalpages)) { // if we're on current page... if ($x == $currentpage) { // 'highlight' it but don't make a link echo " <span class='b fs11'>$x</span> {$slash}"; // if not current page... } else { // make it a link echo " <span class='fs11'><a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a></span> {$slash}"; } // end else } // end if } // end for Give that a try for the for loop.
-
Look into arrays. Learn how to use them as they will be a life safer and make everything go smoother. PHP.net Manual for Arrays This is what arrays were made for. Your could would then turn into something like: $id = intval($_GET['id']); // cast to int to prevent weird stuff. foreach ($list[$id] as $item) { echo $item['name'] . " has the id of " . $item['id'] . "<Br />"; } You want to look into the multi-dimensional array. If you want help on setting it up describe how you get your "listing". But if you are going to do it, you might as well not do it the slow half-assed way. Learn arrays and you will not be sorry, as it will make it a ton easier.
-
UNIQUE KEY (`player1`,`player2`,`player3`,`player4`) If you were getting an error, it is good to post that error for next times reference.
-
Program doesn't work.. please help ; "Hangman"
premiso replied to arsenal-computing's topic in PHP Coding Help
You should really use GD Library and make it actually draw the hang man and write in the letters. That would be a hoss script. Seriously. -
Added up profile photo's but now.. you cant register properly
premiso replied to Anxious's topic in PHP Coding Help
Perhaps add mysql error checking to see if the query is failing. function addNewPhoto($username){ $q = "INSERT INTO ".TBL_PROFILE." VALUES ('$username')"; mysql_query($q, $this->connection) or die("SQL Was: {$q}<br />Error Was: " . mysql_error()); return true; } And see what comes of it. -
This forum is not to ask people to write code for you. Put forth an effort and try and show us the code you tried if it does not work. Or place this in the freelance section and hopefully someone is willing to do it, but it may cost you some money.
-
[SOLVED] Adding value to variable from databse content.
premiso replied to Bman900's topic in PHP Coding Help
<?php mysql_connect("changed", "changed", "changed") or die(mysql_error()); mysql_select_db("db283875085") or die(mysql_error()); $titleRes = mysql_query("SELECT title FROM site_title"); $title = mysql_result($titleRes, 0, 0); echo "$title"; ?> For a one column pull mysql_result works. For multiple rows/columns mysql_fetch_assoc would be the way to go. -
Added up profile photo's but now.. you cant register properly
premiso replied to Anxious's topic in PHP Coding Help
Well what has changed? Were you working with PHP4 and switch to PHP5? Did your webserver implement new security restrictions (turning off Register_globals) You are really not giving us much to work here. Chances are if it stopped working, something changed. Most of the time, register_globals was turned off, as it should be. What this means what used to come from a form as the name of the input field (IE: Input field name = fname you could access by $fname) you now have to access it by $_POST['fname']. If you do not know if anything was changed, contact your host and ask them if they did do any updates as that will give you a better clue as to what is now happening. The bottom line: something had to change. Scripts do not just magically stop working for no apparent reason. -
[SOLVED] How to group by name with color group ?
premiso replied to plodos's topic in PHP Coding Help
If the script ran, there is no possible way the colors are the same. They may look the same, but I guarantee the hexadecimal is completely different. As far as how to solve the problem of similar colors, I have no clue. I never dug into the color spectrum that deep to know how to determine if a hexadecimal is similar to one already used previously. I am sure it can be done, but frankly that does not interest me at all. -
Compiling php with oracle support requires ORACLE_HOME variable set which requires oracle client to be installed as you have to mention --with-oci8=whatever ORACLE_HOME variable is when compiling php. As I know current php doesn't have OCI8 extension as per phpinfo page. Oci8 on PHP Requirements You have to recompile PHP with Oracle, if it is not already compiled with it. No matter what your vendor says. What is the question you are trying to get answered? ???