Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Personally, i agree more with Patrick. Whilst it is true that you can use AJAX, at the end of the day it is still the server side language which is doing the work. All you are doing is making an asynchronous request (i.e. without the whole page reloading) to the server - the javascript it just loading that content, whatever it may be.
  2. Why not just include them with PHP? As far as i'm aware, all you can do with javascript is include other javascript files. Of course, those javascript files could contain text to be written to the screen, but it's probably going to get messy.
  3. His album getaway is available in the UK Napster library, however that particular track is not available.
  4. Well i just found this: http://en.wikipedia.org/wiki/AP_Calculus So it looks like i've done the vast majority of Calculus AB and BC - thought not all of it. I may have done stuff which isn't covered in those, however.
  5. It'd be interesting to know how the UK system compares with the US. Calculus AB and calculus BC mean nothing to me. Anyone fancing giving me a quick idea of what's involved in each?
  6. 10 stories appearing in today's newspapers in the UK which aren't april fools...amazingly: http://news.bbc.co.uk/1/hi/magazine/7324127.stm Unless, of course, that's one big april fool.
  7. Ah good ol' google. I knew I could count on them for some April Fools.
  8. Sorry, thats partly my fault. You should be using $myusername and $mypassword, since those are the variables you defined. Try: $sql="SELECT * FROM members WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql) or die(mysql_error()); echo '<br />Query was:<br />'.$sql; If those variables are still empty, then there's a problem with your form. Check that the names of the fields are "username" and "password" respectively, and that the method is set to POST. Of course, keeping the names consistant rather than switching in between would make things easier.
  9. What do you actually wish to do with the data? At the moment, the query you're trying to do doesn't make much sense. Do you want to update an existing row with some data? Or just create a new row?
  10. Do some error checking on the query: $sql="SELECT * FROM members WHERE username='$username' and password='$password'"; $result=mysql_query($sql) or die(mysql_error()); echo '<br />Query was:<br />'.$sql; If that doesn't help you, post the updated code.
  11. Well, $username and $password are undefined. This line: $sql="SELECT * FROM members WHERE username='$username' and password='$password'"; Should be: $sql="SELECT * FROM members WHERE username='$myusername' and password='$mypassword'"; Are there really supposed to be 4 rows returned with the same username and password? Surely there should just be one matching row? In which case this: if($count==4){ Should be: if($count==1){
  12. Or: <?php $a = 'http://www.XblahXblah.com/someplace/else/id/551478/track.php?&url=http://www.XanotherXblahXblah.com'; list($url,$junk) = explode('?',$url,2); ?> Avoids the overhead of the regex.
  13. Being able to memorise functions and their arguments in no-way indicates an understanding of the language. Sure, it helps you write your code a touch quicker, but there's nothing wrong with using websites and books for reference.
  14. No problem - you'd done most of it!
  15. So you just want to return files with that policy number at the beginning? <?php function browsepdf($policy){ $pdffile=glob("printable/$policy*.pdf"); rsort($pdffile); foreach($pdffile as $filename){ $filename=ltrim($filename, "printable/"); $filename=rtrim($filename, ".pdf"); $file=$filename; $datetime=strtotime($filename); $newdate=strtotime("+3 days",$datetime); $filenamedate=date("F d", $datetime); $filenamedate.=" - ".date("F d, Y", $newdate); echo "<option value='$file'>$filenamedate</option>"; } } browsepdf(485743); ?>
  16. The glob function allows you to search for filenames matching a pattern.
  17. 1.) This isn't really maths based. If the addition of two variables were counted as maths based programming, then every topic would be here 2.) There's absolutely no need to bump a topic after one hour - it was probably still the first topic anyway! 3.) You've shown us your HTML code - do you have any PHP code as well? Or as you asking someone to do this for you? If you do have some knowledge of PHP, then this tutorial on form processing may be of use to you: http://www.rbredlau.com/drupal/node/10
  18. So you're at the stage where the admin has confirmed they want the update to take place? You'll be wanting something like: <?php $groupe = $_GET['groupe']; $groupe = mysql_real_escape_string($groupe); $sql = "SELECT COUNT(*) FROM BANDS2,NEWS2 WHERE BANDS2.title = '$groupe' and NEWS2.title='$groupe'"; $result = mysql_query($sql) or die(mysql_error()); $num = mysql_result($result,0); if($num == 0){//there isnt a match echo "Record does not exist!"; exit; } mysql_query("UPDATE BANDS2,NEWS2 SET NEWS2.localisation=BANDS2.localisation, NEWS2.web=BANDS2.web, NEWS2.infos=BANDS2.infos WHERE BANDS2.title = '$groupe' AND NEWS2.title = '$groupe'") or die(mysql_error()); mysql_query("DELETE FROM BANDS2 WHERE title='$groupe'") or die(mysql_error()); echo "Modification complete"; ?> There are a few things to note, however. I've deliberately not included the updating of the id or title fields. I dont think you should ever be wanted to update the ids and given that you are using the title to identify the band at the moment, it would not be a good idea to update this either. I would recommend that you modify this and use the id of the band to update - that way the name of the band can also be modified. Also, you may wish to consider what would happen if two people suggested an update at the same time. I would, however, agree that a bit of a better attitude will help you get along. As you can see, i've not done everything for you, which appears to be what you are asking for - rather given you a prod in the right direction. Your code is nearly always useful - sometimes it can clarify the situation. And it certainyl shows us that you're trying something. Oh, and finally...FYI - it is not necessary to connect to the database prior to each query. Once (assuming you dont disconnect) per script is sufficient.
  19. Give this a whirl: <?php $query = "SELECT detention.detentiondate, detention.pupilno, detention.reason, detention.teacherid, pupil.firstname, pupil.lastname FROM detention, pupil WHERE detention.detentiondate >= '$_SESSION[startdate]' AND detention.detentiondate <= '$_SESSION[enddate]' AND detention.pupilno = pupil.pupilno ORDER BY detention.detentiondate, pupil.lastname, pupil.firstname, pupil.pupilno "; $result = mysql_query($query) or die(mysql_error()); if ($result){ $last_date = ''; while ($array= mysql_fetch_assoc($result)) { echo "<br />"; if($array[detentiondate] != $last_date){//the current date is different from the last one print "$array[detentiondate]<br />"; $last_date = $array[detentiondate]; } print "$array[detentiondate]<br />"; print "$array[pupilno]: <i>$array[firstname] $array[lastname]</i><br />"; print "<b>Reason:</b> $array[reason]<br />"; print "<b>Allocated By:</b> $array[teacherid]<br />"; } } ?> I think that's what you wanted.
  20. I personally don't see the issue with someone nicking a 10 second sample.
  21. Thats right, yes. You'll need to loop through the results and put them in an array first. For example, you'll need to replace this: <?php $pla = mysql_fetch_array($plr, MYSQL_NUM); $planum = count($pla); ?> With: <?php $product_lines = array(); while($row = mysql_fetch_row($plr){ $product_lines[] = $row[0]; } $planum = count($product_lines); //you'll then use $product_lines instead of $pla in the rest of your script. ?> Looks like you need to do a similar thing on the second query too. I do wonder if you might be able to make your life easier with some more advanced queries - you might find that if you head over to the mysql forum and post up your table structure and what you're trying to achieve, someone can help you perform that more easily(i.e. less queries)
  22. Probably an easier approach andy! The 10-X comes from the fact that the bases of the two triagles must be equal to 10, since the bottom of the trapeziod has length 32 and the top has length 22. The difference (which is what the bases of the triangles are) is therefore 10. If you then say one of the bases has length X, then the other one must have whatever's left from 10: 10-X
  23. There's rather a lot of code there. Any chance of you narrowing down where you think the problem lies? Perhaps it's just me, but i'm not entirely sure what the problem is either - perhaps showing us the current output and expected output would be useful too.
  24. I would recommend echoing out the actual query that is being performed, e.g: $q = "SELECT actual_id, wp_description FROM ordering_info$cat WHERE wp_identifier LIKE '%$id%' AND product_line='$pla[$i]' AND product_category='$pca[$x]' ORDER BY detail_sort ASC"; echo '<br />Query: '.$q.'<br />'; You can then check that the right values are being passed into your query (which seems unlikely if, as you say, everything works ok when you put the values in manually and execute through phpMyAdmin)
  25. I doubt it. I seem to remember a similar argument circulating about music downloads - if the server the music was being download from was in a country in which copyright laws were not enforced/did not exist, then there was nothing stopping people in other countries downloading the music. Im fairly sure it wasn't true, however.
×
×
  • 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.