Jump to content

mattm1712

Members
  • Posts

    108
  • Joined

  • Last visited

Posts posted by mattm1712

  1. i'm trying to save the amount off times my code is viewed with this code but the impression rate isnt counting up any ideas why?  Matt

     

    This is just an example code because i cant get the sessions to work.

     

    <?

    session_start();

    if(isset($_SESSION['count']))

    {

    $_SESSION['count'] = $_SESSION['count']+1;

    }

    else

    {

    $_SESSION['count'] = 1;

    }

    echo $_SESSION['count'];

    ?>

  2. i am trying to do a php foreach loop from a variable i get from a java script variable.  this is what i have come up with if outputs $acc_code as and array of eg.  12-home,11-away,23-home etc

     

    but when i run the foreach i only have 1 output which is the full string can you guysd help??

     

    <SCRIPT LANGUAGE="JavaScript">

    <!--

     var AccValue = GetCookie('Accumulator');

     var n=AccValue.split("|");

     //-->

    </SCRIPT>

    <?php

    $acc_code = "<br><script type='text/javascript'>document.write(n);</script>";

    echo "cookie value = ".$acc_code."<br><br>";

    $acc_values =  explode(",", $acc_code);

     foreach($acc_values as $bet)

     {

     echo $bet."<br>";

     }

    ?>

     

     

     

    cheers matt
  3.  
    im running this code :
     
    $return = array();
    $query = mysql_query("SELECT name, uf_id FROM leaguenames WHERE source='$sourceid'");
     
    while ($array = mysql_fetch_assoc($query))
    {
    $return[] = [     "name" => $array["name"],
                           "uf_id" => $array["uf_id"]
     
                      ];
    }
     
     
     
    and im getting this error
     

    Parse error: syntax error, unexpected '[' in /home/content/35/10014135/html/scripts/updatefunctions.php
     
    can anyone help me?
  4. this is m code if i remove the doctype it works but not the styles in ie so i need it there but adds a white bar at the top of the page, can anyone help?

     

    <!DOCTYPE HTML>

    <html>

    <head>

    <link rel="stylesheet" href="styles.css" type="text/css" media="all">

    </head>

    <body style="margin: 0px; padding: 0px;" >

    <div id='topbar' align='center'>

    <div class='menubar'>

    <ul>

    <li class='list'>sdf</li>

    <li class='list'>sdf</li>

    <li class='list'>dsf</li>

    </ul>

    </div>

    </div>

    <div id='centainer' style='width: 100%;' align='center'>

     

    </div>

    </div>

    </body>

    </html>

  5. hi having issue with set cookie this is my code but it only sets the cookie after i have clicked the link for the 2nd time :s can anyone help??

     

    cheers matt

     

    code

    ------------------------------------

    <?php

    $addbet = $_GET['addbet'];

    $eventid = $_GET['eventid'];

    $outcome = $_GET['outcome'];

    $value = $eventid."-".$outcome;

    if (isset($_GET['addbet']))

    {

    setcookie('Betslip', $value, time()+1200);

    }

    ?>

     

     

    <?php

    echo $_COOKIE['Betslip'];

    ?>

     

    <a href='index.php?addbet=true&eventid=123&outcome=Home'>Home</a>

  6. if this is my function code

     

     

    function getleague($templeague,$company)

    {

    echo $templeague;

    $query = mysql_query("SELECT * FROM templeagues WHERE templeague='$templeague'");

    $numrows = mysql_num_rows($query);

    If($numrows==1)

    {

    echo "found league<br>";

    }

    else

    {

    echo "no league<br>";

    }

     

    }

     

     

    i am returning the templeague, but am getting an error

     

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in/home/content/35/10014135/html/update/updatefunctions.php on line

     

    what wounld be causing this??

     

    cheers matt

  7. hi i have this code but having problem with reoccurring decimals say my datbase says its 0.3333333 which should be unlimited as its 1/3 but i cant have unlimited values in my database. i am suplied the value as 0.3333333 so i cant put 1/3 into my database so i have this formulat so far but i am having problems with it due to this, i need a way of replacing any value eg .33333 or .333333 or .333333333 to 1/3 any ideas ???

     

     

    <?php

     

    $price = 0.33333333;

    $numer = $price*1000;

    $denom = 1000;

    $primes = array(41,37,31,29,23,19,17,13,11,7,5,3,2);

    $factors = array(10,9,8,7,6,5,4,3,2);

    $running = true;

    while ($running)

    {

    $changed = false;

    if (in_array($denom,$primes)&&$numer % $denom != 0)

    {

    $running = false;

    }

    else

    {

    foreach($factors as $fac)

    {

    if ($numer % $fac == 0 && $denom % $fac == 0)

    {

    $numer = $numer/$fac;

    $denom = $denom/$fac;

    $changed = true;

    }

    }

    if (!$changed)

    {

    $running=false;

    }

    }

    }

    echo $numer."/".$denom;

     

    ?>

  8. i am trying to do this

     

    <?php

    $priceformat = "decimal";

     

    $query = mysql_query("SELECT * FROM price");

    $array = mysql_fetch_assoc($query);

     

    echo $array[$priceformat];

     

    ?>

     

    so i want to return the decimal price from my database

     

     

    cheers matt

  9. hi i am trying to return values in my data base which are like what my varibale is

     

    say my data base has these values is

     

    1 Manchester Utd

    2 Chester

    3 Macclessfiled

    4 Liverpool

     

     

    and i have a variable $tl = "chester city";

     

    and i wanted to echo out the values that look like 'chester city' eg i want a list that has chester in it

     

     

    $tl = "chester city";

    $query2 = mysql_query("SELECT * FROM teams LIKE '{$tl}'");

     

    while($array2 = mysql_fetch_assoc($query2))

    {

    echo $array2['name'];

     

    }

     

    why whould this not work?

     

    cheers matt

  10. i am using xml files where the data i am getting is in different formats so say i am getting DOG from one xml, Dog from another and finally dog from the last one so i am getting

     

    DOG,Dog and dog

     

    say i wanted them to be displayed all as Dog before i put them in to my database how would this be done?

     

    i know i can do it like this but its a bit long winded

     

    If($var=DOG)

    {

    $name = "Dog":

    }

     

    but i dot want to be doing this for all my data

     

    cheers matt

  11. this is my full script

     

    <?

    include 'inc/connect.inc';

    $getfixtures = mysql_query("SELECT * FROM footballfixtures");

    $count = mysql_num_rows($getfixtures);

    while($fixturesarray=mysql_fetch_assoc($getfixtures))

    {

    $match = $fixturesarray['id'];

    $hometeam = $fixturesarray['home'];

    $homeselect = mysql_query("SELECT * FROM footballteams WHERE id='$hometeam'");

    $homeselect2 = mysql_fetch_assoc($homeselect);

    $homename = $homeselect2['name'];

    $awayteam = $fixturesarray['away'];

    $awayselect = mysql_query("SELECT * FROM footballteams WHERE id='$awayteam'");

    $awayselect2 = mysql_fetch_assoc($awayselect);

    $awayname = $awayselect2['name'];

    $datenew = $fixturesarray['date'];

    $matchdaytime = $fixturesarray['date'];

    $maindate = date("G:ia",$matchdaytime);

    echo "<tr class='rowmouseover'><td width='160' class='greymatchbar'>".$maindate."</td><td width='300' class='greymatchbar'><a href='/test/Betting/".$var2."/".$var3."/".$var4."/".$fixturesarray['id']."/".$homename."-".$awayname."/Win-Draw-Win'>";

    echo $homename."  v  ".$awayname."</a></td>";

    $homequery = mysql_query("SELECT * FROM footballodds WHERE gameid='$fixturesarray[id]' AND type='Match Betting' AND outcome='Home' ORDER BY price DESC LIMIT 0, 1");

    $homeprice = mysql_fetch_assoc($homequery);

    $companyhome = $homeprice['companyid'];

    $companyhomequery = mysql_query("SELECT * FROM sitenames WHERE id='$companyhome'");

    $homeid= mysql_fetch_assoc($companyhomequery);

    $homenamev = $homeid['name'];

    $drawquery = mysql_query("SELECT * FROM footballodds WHERE gameid='$fixturesarray[id]' AND type='Match Betting' AND outcome='Draw' ORDER BY price DESC LIMIT 0, 1");

    $drawprice = mysql_fetch_assoc($drawquery);

    $companydraw = $drawprice['companyid'];

    $companydrawquery = mysql_query("SELECT * FROM sitenames WHERE id='$companydraw'");

    $drawid= mysql_fetch_assoc($companydrawquery);

    $drawnamev = $drawid['name'];

    $awayquery = mysql_query("SELECT * FROM footballodds WHERE gameid='$fixturesarray[id]' AND type='Match Betting' AND outcome='Away' ORDER BY price DESC LIMIT 0, 1");

    $awayprice = mysql_fetch_assoc($awayquery);

    $companyaway = $awayprice['companyid'];

    $companyawayquery = mysql_query("SELECT * FROM sitenames WHERE id='$companyaway'");

    $awayid= mysql_fetch_assoc($companyawayquery);

    $awaynamev = $awayid['name'];

    echo "</td>

    <td width='60' class='greymatchbar2' align='center' title='".$homenamev."'>".$homeprice['price']."</td>

    <td width='60' class='greymatchbar2' align='center' title='".$drawnamev."'>".$drawprice['price']."</td>

    <td width='60' class='greymatchbar2' align='center' title='".$awaynamev ."'>".$awayprice['price']."</td>

    <td width='80' class='greymatchbar'><a href='/test/Betting/".$var2."/".$var3."/".$var4."/".$fixturesarray['id']."/".$homename."-".$awayname."/Win-Draw-Win'>See All</a></td></tr>";

    }

    ?>

     

     

  12. is there a better way of doing this set off queries?

     

    $homequery = mysql_query("SELECT * FROM footballodds WHERE gameid='$fixturesarray[id]' AND type='Match Betting' AND outcome='Home' ORDER BY price DESC LIMIT 0, 1");

    $homeprice = mysql_fetch_assoc($homequery);

    $companyhome = $homeprice['companyid'];

    $companyhomequery = mysql_query("SELECT * FROM sitenames WHERE id='$companyhome'");

    $homeid= mysql_fetch_assoc($companyhomequery);

    $homenamev = $homeid['name'];

    $drawquery = mysql_query("SELECT * FROM footballodds WHERE gameid='$fixturesarray[id]' AND type='Match Betting' AND outcome='Draw' ORDER BY price DESC LIMIT 0, 1");

    $drawprice = mysql_fetch_assoc($drawquery);

    $companydraw = $drawprice['companyid'];

    $companydrawquery = mysql_query("SELECT * FROM sitenames WHERE id='$companydraw'");

    $drawid= mysql_fetch_assoc($companydrawquery);

    $drawnamev = $drawid['name'];

    $awayquery = mysql_query("SELECT * FROM footballodds WHERE gameid='$fixturesarray[id]' AND type='Match Betting' AND outcome='Away' ORDER BY price DESC LIMIT 0, 1");

    $awayprice = mysql_fetch_assoc($awayquery);

    $companyaway = $awayprice['companyid'];

    $companyawayquery = mysql_query("SELECT * FROM sitenames WHERE id='$companyaway'");

    $awayid= mysql_fetch_assoc($companyawayquery);

    $awaynamev = $awayid['name'];

     

    it has to do this about 40 times everytime a page loads and it takes ages is there a way off cutting it down?

     

    cheers matt

  13. i have

     

    <IfModule mod_rewrite.c>

     

    # .htaccess mod_rewite

     

    RewriteEngine On

    RewriteBase /test/

     

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-l

     

    RewriteRule ^(.*)$ index.php?url=$1/$2 [QSA,L]

     

    </IfModule>

     

    and index is

     

    $page = explode('/',$_GET['url']);

    $var1 = $page[0];

    $var2 = $page[1];

    $var3 = $page[2];

     

    echo "<img src='images/logo.png'> ";

     

    say i am at  /test/hello

     

    it displays the image

     

    but id i got to /test/hello/matt/

     

    it doesnt

     

    can anyone help???

     

     

     

  14. i know this will be a simple answer but

     

    say i am at

     

    www.my-domian.com/bookmarks

     

    i have a link

     

    echo "<a href='shake'>shake</a>";

     

    which goes to

    www.my-domian.com/shake

     

     

    but if i am at

    www.my-domian.com/bookmarks/bake

     

    and click the link

     

    it goes to

    www.my-domian.com/bookmarks/shake

     

    but i want it go to

    www.my-domian.com/shake

     

    how do i do this???

     

     

    if you understand this!!

     

     

     

     

     

  15. hi i am having trouble and cant see why

     

    this is my htaccess file

     

    # .htaccess mod_rewite

     

    RewriteEngine On

     

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-l

     

    RewriteRule ^(.*)$ index.php/url=$1 [QSA,L]

     

    and my index is

     

    <?php

     

    echo 'index file';

     

    echo $_GET['url'];

    echo '<hr />';

    $url = explode('/',$_GET['url']);

    print_r($url);

    ?>

     

    if i got to

     

    mydomain/test/hello

     

    nothing is beenig returned

     

    other than

     

    index file

    Array ( [0] => )

     

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