Jump to content

ToonMariner

Members
  • Posts

    3,342
  • Joined

  • Last visited

Everything posted by ToonMariner

  1. think you may have to use variable variables here. <?php function out($varname, $varavl) { echo "$varname = $varval<br />"; } $x = 'x'; $$x=3; out($x,$$x); ?>
  2. you have already retrieved the data you want with the first query... <?php function login($username,$pass){ GLOBAL $db,$table; $username = trim($username); $pass = md5(trim($pass)); $query = mysql_query("SELECT * FROM $table WHERE userName = '$username' AND userPassword = '$pass'"); if (mysql_num_rows($query) == 1) { $data = mysql_fetch_assoc($query); return $data['userID']; } else { return false; } } ?>
  3. this is how I'd do it... <?php class MySQL { function DoQuery($query, $link) { // Do Stuff } } class FunStuff { function DoMore() { $blah = $this->db->DoQuery('blah', 'blah2'); $query = $this->db->FetchArray($blah); return $query; } } $MySQL = new MySQL(); $Fun = new FunStuff(); $Fun->db = $MySQL; while($Fun->DoMore() { //Do more stuff } ?>
  4. it depends on what is actually in the include file - some things you shoudl use require_once or include_once (like the html for the head section of a page) others you could include as many as you like if they perform a repetitive function.
  5. date diff is the way to go - what errors do you get when you use it??
  6. tell him to install php5! many hosts offer an option as to which php engine you want to use and if you are paying for something you should be able to use what you want.
  7. you shoudl NEVER execute queries in a loop that could be large - many hosts limit you to 50 or 100 queries per page (may sound alot but if you don't know how many queries you are going to execute you could hit problems). Multiple inserts can be perfromed with one query (it is MUCH more efficient). now one thing that will REALLY help you out here is instead of having lots of inputs called try1, try2 etc. have the input called try[1], try[2] and so on - this will let you loop through the correct array like so <?php $qry = INSERT into tries (tryOpponent, tryTeam, trySeason, tryPlayer) VALUES "; $counter =1; foreach ($_POST['try'] as $key => $val){ $qry .= "('" . $_SESSION['creatematch']['opposition'] . "', '" . $_SESSION['creatematch']['ottersteam'] . "', '" . $_SESSION['creatematch']['season'] . "', $val );"; } $qry = substr($qry,0,-1); $qry = mysql_query($qry); ?> try that one query and a nice neat way of managing them all.
  8. the first will call a function called 'Names' and pass the parameter '1' to that function. the second just calls the function.
  9. never just wondered if there were any people on here who had come up against the smae thing.
  10. well it concatenates a few mp3 files - they have to be mono but it does it well enough.
  11. sorry buddy but the audio file is a php generated mp3 file. its all to do with the flash file itself and this cannot change now - its how the site has to fucntion - no popups etc etc.
  12. <input type="hidden" name="ProductID" id="ProductID" value="<?php echo $r['ProductID'];?>" /> <input type="hidden" name="ProductPrice" id="ProductPrice" value="<?php echo $r['ProductPrice'];?>" /> <input type="hidden" name="ProductName" id="ProductName" value="<?php echo $r['ProductName'];?>" /> If you want something done properly.... NOW you may/maynot notice the flaw in your method... You shoudl only need to pass the prodcutID - use a query on the processing script to grab the proce - otherwiose someone could hood wink the system and get something for free!!!!
  13. only option is to fork your scipt - and as thorpe correctly states this may not be available to you... http://www.phpfreaks.com/tutorials/71/0.php
  14. you have not set any input to transfer the relevant data. try using <input type="hidden" name="x" id="x" value="<?php echo $val; ?>" /> for productid, price and name (set the values accordingly)
  15. really??? suppose its the legacy of the c background that makes me believe that - did read an article on it being around 10 - 15% faster than a comparable asp script run time.... will post if I find it.
  16. its faster than most too! (especially its MicroS(of)-(hi)t competitor)
  17. http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html - if you have a later version of mysql running thats even better mysql5 has even more datetime stuff to play with... the addtime function may be of interest to you.
  18. use a print style sheet for an example see http://www.waring-netts.co.uk if you view the source code you can see there are a few style sheets declared at the top of the page each for its own media type (thats how you switch them between devices). Just put the url in to teh css files if you need to see whats going on or get the developer tool bar for firfox and it tells you all you need to knoe...
  19. welll - it SHOULD be... <form action ="b.php" method="post"> <fieldset> <legend>Details</legend> <label for="name">Name</label><input type="text" name="name"> <label for="email">Email</label><input type="text" email="email"> <input type="submit" name="submit" value="submit"> </fieldset> </form> I oft use a <p> or <div> tag around my label - input pairs to keep them together - sometimes <br /> but even I frown at myself then.... really shoudl do a good css tutorial on styling forms...
  20. if you have enough queries left on your page I would advise that you use mysql to do this - its date manipulation support is VASTLY superior to that of php's...
  21. <? is the short tag opening effort (which in my opinion should be removed in php 6). it causes problems when you are using xml on your site and is an all round pain in the backside... if you have dreamweaver you can do a site wide search and replace - which would be my advice. alternatively you could set the short_open_tag setting in your php.ini file to On but you REALLY should use <?php
  22. you should create 2 separateimages. you can do this with php - upload you normal image and php can create a thumbnail of the correct dimensions. OK its not as good as what photy shop dose but its pretty good - this way you won't distort your image and you won't have to create one on the fly each time... the gd library is your friend here - imagecopyresampled et al will get you throug. i suggest you create a folder called thumb inside the folder where you currently store images and use that for the smaller image you create...
×
×
  • 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.