Jump to content

mattm1712

Members
  • Posts

    108
  • Joined

  • Last visited

About mattm1712

  • Birthday 12/17/1986

Contact Methods

  • Website URL
    http://www.gamerforums.co.uk

Profile Information

  • Gender
    Male
  • Location
    UK

mattm1712's Achievements

Regular Member

Regular Member (3/5)

1

Reputation

  1. hi im having trouble removing ' from strings so say $name = "D'vion"; $newname = str_replace("'","",$name); but this just returns the same. thanks matt
  2. 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']; ?>
  3. i am trying to make an update script using an xml with a login username / password authorization. i have never encountered one before one looking to see if anyone could point me in the right direction. any questions please ask matt
  4. 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
  5. 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?
  6. 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>
  7. 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>
  8. Firstly I want to know the pros and cons of scraping a website for data, eg prices. And does anyone know the best website to show me how to do it? Cheers matt
  9. if i use that it says 'MySQL server has gone away' but i cant understand why
  10. 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
  11. 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; ?>
  12. yeah if i put decimal into where $priceformat is it works but i want to be able to change so i can another format out
  13. 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
  14. why does this not work? mysql_query("UPDATE footballodds SET price='$price', SET change='$change' WHERE eventid='$eventid', outcome='$name', company='$company', market='$marketname'");
  15. 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
×
×
  • 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.