Jump to content

Greaser9780

Members
  • Posts

    326
  • Joined

  • Last visited

    Never

Posts posted by Greaser9780

  1. 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.

  2. 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  ?

  3. 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?

  4. 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

  5. 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.

  6. 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?

  7. 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.

  8. 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 

  9. 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.

  10. I am having difficulty figuring out how to only show a list of gametitle by a givin letter. I used a tutorial found here to get the list broken down by letter using a substring but don't know how to only show certain letters. Here is my code right now:

    $gam1 = mysql_query("SELECT gametitle FROM games ORDER BY gametitle ASC") or die(mysql_error());
                                 while ($list = mysql_fetch_object($gam1)): 
                    $letter = strtoupper(substr($list->gametitle, 0, 1)); 
                    if ($prev_row != '0-9' && is_numeric($letter)): 
                        echo '<br /><a gametitle="#number"></a><b><u>0-9</u></b> '; 
                        $prev_row = '0-9'; 
                    endif; 
                    if ($letter != $prev_row && !is_numeric($letter)): 
                        echo '<br /><a gametitle="'.$letter.'"></a><b><u>'.$letter.'</u></b> ';  
                        $prev_row = $letter; 
                    endif; 
                    echo $list->gametitle.'<br />'; 
                endwhile; 
    

  11. To test it first you could simply use echo $formid; echo $userid; . If it all works out you can move on to the database stuff. In the tables where the users are you create a new field for each field. This will be named the form id. Then when a user submits a form for the first time enter a certain value into that field to show he/she has filled it out. Then on the php page that processes the script, run a query to check the database to see if the user has filled out the form previously. You want to run the query before you process the form. Then if the user has filled it out previously redirect them with a message saying it was already filled out. If they haven't continue to process the form.

×
×
  • 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.