Greaser9780
Members-
Posts
326 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
Greaser9780's Achievements
Regular Member (3/5)
0
Reputation
-
Then you'll need to run a while statement to have it run continuously until one of them reaches 0. Run the calculation the first time. $new_a = ($d - ($a * .1)); $new_c = ($a - ($c * .1)); Set the while loop to continuously run until one or the other is at or below 0. while ((($new_a) && ($new_c)) > '0') { $new_a = ($d - ($new_a * .1)); $new_c = ($d - ($new_c * .1)); } when while loop is finished, use an if statement to determine if $new_a is greater than 0 if ($new_a > '0') { $new_a = ($new_a + 'Set Number to add'); } if $new_a = 0 then increment by set number for $new_c if ($new_c > '0') { $new_c = ($new_c + 'Set Number to add'); } Am i correct in assuming that you want to add the set number to the new variable that didn't quite reach 0? Haven't done coding in awhile. So this is probably far from perfect. There may even be a better way to do it. But this logically makes sense to me. Not sure if my coding is perfect but at least the thought process is laid out.
-
Do you know how to Update MySQL tables and gather information from them? This is going to be the major part of what you need to do.
-
Just break it down step by step. First you need to gather the appropiate information from each table. Use the appropriate queries and pull your info from the db. Then assign a variable to each of the appropriate pieces of information. Lets say you use $a $b $c and $d Then formulate your calculations on the variables in question. So for your first one you want to get 10% of $a and subtract it from $d. $new_a = ($d - ($a * .1)); $new_c = ($a - ($c * .1)); As for the rest I am unsure of what you are trying to accomplish. Are you trying to do this: '$new_a' does not equal '0' therefor we need to take 10% of $new_a and subtract it from $d ?
-
Trouble getting <img> alt text with regular expression
Greaser9780 replied to Greaser9780's topic in PHP Coding Help
Thank you. That's pretty much what I ended up using. -
Trouble getting <img> alt text with regular expression
Greaser9780 replied to Greaser9780's topic in PHP Coding Help
Now I'm starting to wonder how to put it all in the db. Since the links, alt text,headings, and bold type are all listed by line. I hate to input it with a foreach loop since this will cause many small queries, but maybe this is better than one ginormous query. Then there is the problem when a search is performed. How exactly should the user query to keyword % get checked? 1. Check for all keywords if all are found what is the percentage if all are not found break string into individual words and check for % or 2. Break user query into individual words and check percentage this way? -
Trouble getting <img> alt text with regular expression
Greaser9780 replied to Greaser9780's topic in PHP Coding Help
I'm in the midst of building a search engine. I am going to rank sites for each search on things like % of query words to total words for various groups(alt text, description words, title, keywords) and so on. I did however get the following to work: $regexp = "<img src=\"(.*)\" alt=\"(.*)\">"; if(preg_match_all("/$regexp/siU", $input, $img, PREG_SET_ORDER)) { foreach($img as $alt){ $alt_words = adv_count_words($alt[2]); echo "$alt[2] - $alt_words<br />"; So far I can get the words and word count for the following: title meta description meta keywords link text link href heading text bold text underlined text img alt text -
Trouble getting <img> alt text with regular expression
Greaser9780 posted a topic in PHP Coding Help
Here is what I have: $regexp = "<img\s[^>]*alt=(\"??)([^\" >]*?)\\1[^>]*>"; if(preg_match_all("/$regexp/siU", $input, $img, PREG_SET_ORDER)) { foreach($img as $alt){ echo "$alt[2] <br />"; }} I am a reg expression noob. This presents empty results. Can anyone find the error? -
Better direction ty. I'm gonna have to hit up the regular expressions pretty heavy. After seeing the results from that I am also going to need to strip out any class,target, or title sections of the link. Thank you for pointing me in the right direction.
-
I want to strip links from various html pages that I enter from a form. I am so far using file_get_contents() to get the info into a string. The part I am confused with is how exactly do I get the link text itself into one string and then the href or url it leads to in another?
-
[SOLVED] Can't get mod rewrite to work
Greaser9780 replied to Greaser9780's topic in Apache HTTP Server
Finally I figured out how I am such an idiot. All this time I thought the rewrite was supposed to change the second value in the rule to the second. After banging my head against the wall reading tutorials on this from google I ran into one that finally showed me what I was doing wrong. I also had to figure out how to escape the %20 thing for spaces with streplace. Thanks for your patience Thorpe. -
[SOLVED] Can't get mod rewrite to work
Greaser9780 replied to Greaser9780's topic in Apache HTTP Server
After many trial and error sessions, I got sick of my site shutting down everytime I tried an Apache rebuild. I finally contacted support to get things in order. They also reinstalled my GD2 library, although under the php info where it lists how it was configured it's not showing anything to do with mod rewrite. It's running CentOS 4.5. I still have the following code in my .htacess file but it's still not actually rewriting. RewriteEngine On Options +FollowSymLinks RewriteRule ^pornstar/(.*).php /pornstar.php?name=$1 -
[SOLVED] Can't get mod rewrite to work
Greaser9780 replied to Greaser9780's topic in Apache HTTP Server
It's not showing an error log in that directory. When I try to do an apache rebuild, it never shows the --enable-module=rewrite in the config. Should I attempt a manual rebuild through SSH and force it to load the enable? -
RewriteEngine On Options +FollowSymLinks RewriteRule ^star/(.*).php /star.php?name=$1 I get no errors from this code but it doesn't actually rewrite the url. I had to manually add the module in apache. under my php.info it's showing the apache module. But I'm not sure if something should be showing under the php section or not.
-
If you want the php part to work you must have it as a .php file. And you must have php access within your server space.
-
If you have a decent number of similar sized banners, you could place them in a database and use php to pull one out at random everytime the page is loaded or refreshed.