-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Adding Multiple Parameters to bind_param()
requinix replied to timothyarden's topic in PHP Coding Help
Use call_user_func_array(). But bind_param wants references so function foo(mysqli_stmt $stmt, array $args) { $refargs = array(""); foreach ($args as $key => $value) { $refargs[] =& $args[$key]; } call_user_func_array(array($stmt, "bind_param"), $refargs); }That's a start.- 5 replies
-
- mysqli
- bind_param
-
(and 2 more)
Tagged with:
-
Also make sure the magic_quotes php.ini setting is turned off.
-
How to make my random string end in .html (rephrased)
requinix replied to Xanco's topic in PHP Coding Help
exeTrix gave you the answer in the other thread. By the way, when you don't think you've gotten the answer you need, creating yet another thread is not the solution. Say that you don't understand and give people a chance to clarify. When you make a second thread it seems like you're just trying to ignore the people who were helping you before. -
The title says memory but your post says CPU. MySQL should be using as much memory as it possibly can. That's a good thing. If it's using too much CPU then it's probably choking on some difficult queries. Use the slow query log (or do some SHOW FULL PROCESSLISTs) to see what it's trying to work on during those high loads.
-
uniqid mt_rand
-
So you've got, say, /index.php and you have your links pointing to "/index" and it's not working? What do you know about your server setup?
-
...What?
-
Inside /images/.htaccess try RewriteRule ^/?$ / [L,R=301] RewriteRule ^/?subfolder(/|$) / [L,R=301]
-
That means the query failed. Use mysql_error to find out why.
-
1. That validates either exactly 10 digits or exactly 14 digits. 2. What "string returned"? Is there more code you haven't shown us? Also: sniped from Psycho
-
The second one is pointless because the first one will include the subfolder. That will redirect everything that tries to go to images/* to the homepage. If you have an image in there then it will not work. Is that what you want?
-
Not really. Do it in code instead: 1. Make your query sort by the question so that way all the answers for the same question will come together 2. As you loop through the answers, keep track of the current and previous question 3. When the question changes (or it's the first answer) then you display it anew, otherwise it's the same so don't do anything 4. Then display the answer What kind of output are you aiming for?
-
Because...? You do have to fix your links to not include the extension - that doesn't happen for free.
-
set_time_limit Are you running this from a cronjob? You should be. Apparently this takes too long to be suitable for doing during a normal page load.
-
Increase the timeout. Any reason you have to do them all at once? Can you put off looking up an individual user until you really need it?
-
If you don't mind being able to hide all extensions (you don't have to) and you use Apache then you can put Options +MultiViewsin your .htaccess.
-
And I'm saying (implying) that simplifying the template syntax is a step in the right direction. At a minimum right now you'd need three different regexes for the three different formats so that you can simply find tags in the right "format" and then deal with their actual purposes during replacement (a la preg_replace_callback()), but the one that handles the HTML-esque tags will slow down the parsing so much because it'll find HTML tags too. Neither of your solutions are great. That's why I'm trying to steer you in a smarter direction.
-
Typically the template does that logic, along the lines of {{if show_time eq "on"}} {{time}} {{/if}}
-
How do you feel about picking one tag format and sticking with it? I see three in there. {}s are traditional so maybe {include block=dim_header} {start block=welc} {$dimphrase.welc_msg|replace values="mooo,ererer"} {welc_msg|replace values="ya,yahoo"} {end block=welc} {start block=welc_msg2} {$dimphrase.welc_msg} {welc_msg|str_replace values="1,2,12"} {start block=UY} hii 6 {end block=UY} {start block=GO} hii 5 {end block=GO} {end block=welc_msg2} {include block=news_important} {*TEMPLATE ZONE START:DONT REMOVE NEXT LINE*} {includezone block=Important_block_module} {*TEMPLATE ZONE END*} {start code=php} echo "ahmoodi"; {end code=php} {start code=php} echo 'yoyoyo'; {end code=php} {gogogo|replace values="hi,hello dimofinf"|replace values="hell,hmooda"} {function: randomcolor} {function:calc name="row" values="1,5,8" sign="+"} {includescript block=./news} {if " eq '1'" - not sure what youre trying to show here} ahmed {endif}