Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. I'm still not completely understanding your question. Where's the PHP to go along with that? Also, I'm not sure what you're trying to do here: </php> edit: Hm.. I think I might get it now. But still, you're never echoing out the result of your calculation anywhere that I can see.
  2. You wouldn't require a PHP script to do any checking. You could have MySQL do all the work with a simple select query. This can probably be done better, but roughly: SELECT Tasks.ID from Tasks WHERE Tasks.ID NOT IN (SELECT Complete.TaskID FROM Complete WHERE Complete.UserID = 'some user id')
  3. Well, first off you'd need to use the comparison operator, == (not =). Unfortunately you can't do exactly what you're proposing in PHP, you would have to do: if($var == 'something' || $var == 'something else' || ..) If you have a lot of possible values, alternatively, you could put them in an array and use in_array: $possible_values = array('something', 'something else', 'something else else'); if(in_array($var, $possible_values)) { // ... }
  4. Nowhere in that code are you outputting anything. You're either not showing enough code, or simply aren't ever outputting anything.
  5. Well, your real problem is that your database is structured poorly, so it's making a task like this not so easy to accomplish. Anytime you're storing concatenated data in a field like that is a pretty good indication of poor database design. If you remove the "Done" field from the Tasks table so that it's just a table to describe each task, then you can create another table of completed tasks. In this table you could have the id of a user, and the id of the task completed. So a record for each task each user has completed. Then selecting the tasks that haven't been completed for a particular user is a simple, and much more efficient, task.
  6. The selector should be img.online not #img.online.
  7. First you'll need to create the image resource for the image you want to merge onto your existing GD image: $pic1="2011-Chysler-Town-And-Country-pic1.jpg"; $pic = imagecreatefromjpeg($pic1); Now you can merge your two resources: $im and $pic using imagecopymerge: imagecopymerge($im, $pic, 0, 0, 0, 0, 640, 480, 50); Look at the manual to see what the parameters mean to get exactly what you're after.
  8. You're planning on using AJAX, and that link explains AJAX. How could it not be relevant? You're after a quick solution, and specifically one that doesn't even make sense given the nature of AJAX. There is no simple "copy & paste this magical code and everything will work". It depends on your situation. If you want to get the data from a PHP function, then have the PHP page call the function.
  9. You obviously don't know how this technology works. I suggest you read into it before you attempt to use it. The mozilla link fugix posted is a good place to start.
  10. "Field" isn't a particularly esoteric term. I think your average person would understand that.
  11. I'm not entirely sure what you're asking, can you try reforming the question?
  12. Alex

    pdf help

    Instead of this: $name1 = $select = mysql_query("SELECT * FROM members") or die(mysql_error()); while ($member = mysql_fetch_array($select)) { ''.$member[name].''; } and this: $pdf=new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFont('Times','',12); for($i=1;$i<=40;$i++) $pdf->Cell(0,10, $name ,0,1); $pdf->Output(); Which I'm not very sure what you're trying to accomplish with it.. You should loop through the database list and add them to the PDF at the same time, in a single loop. So something like this: $pdf=new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFont('Times','',12); $select = mysql_query("SELECT * FROM members") or die(mysql_error()); while($member = mysql_fetch_array($select)) { $pdf->Cell(0,10, $member['name'] ,0,1); } $pdf->Output();
  13. Alex

    pdf help

    In what way isn't it working? Assuming your PDF Output method is supposed to actually output the pdf to the browser, you shouldn't have any other output in your file, so no HTML.
  14. This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=331228.0
  15. I realized that you created another thread with the code, so I merged them. You already have the loop, so now just output a new table row for each loop. To record the frequencies of each result you can create an array with an index for each result (1-6) and initialize each element with a value of 0. Then simply increment that element every time it's rolled.
  16. Why don't you post what you have so far? If you just need help with the loops maybe the documentation and examples will suffice: for, while
  17. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=322620.0
  18. The error is pretty self-explanatory. You can't call that method statically, you need to change an instance of the MySQLi object. $mysql = new MySQLi($CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname);
  19. Well I don't think it accomplishes the task you're after completely. The second parameter isn't even used.
  20. Your description of what you need to do doesn't seem complete, or consistent with your example. Why do you need to take a parameter "diameter"? Where should that parameter be used? A simple example of what it sounds like you want: function area_from_diameter($diameter, $str) { if($diameter < 0) { return -1; } return M_PI * pow($diameter / 2, 2); } $diameter = 5; echo area_from_diameter($diameter, "diameter");
  21. You have a few scope issues. Variables like $pi, $radius, etc.. that are defined outside of the function and aren't passed in won't be accessible in that context (You don't even need to define $pi yourself, you can use the predefined constant M_PI - it will be more accurate anyway). You've named things in a strange way that don't really make it clear as to what your intentions are; For example, "if($radius == "Diameter")", that doesn't really make sense, and I'm not sure what you're trying to accomplish with that. You also seem to have some problems with your formulas. For example, the area of a circle is: [imath]A = \pi r^2[/imath] (you can do exponents in PHP using the pow function).
  22. You have a few problems there. You can't set properties through "this.prototype", and you don't define properties with "var" just use the this keyword. This won't throw any errors, but I'm not entirely sure what you're attempting to do: function JEffect(){ this.props = new Array('x', 'y'); this.in_array = function(needle, haystack){ for(var k in haystack){ if(k == needle){ return true; } } return false; } } JEffect.prototype.transition = function(obj, prop, begin, finish, drration){ if(!this.in_array(prop, this.props)){ alert('not found'); } } var effect = new JEffect(); effect.transition('', 'm', 1, 2, 2); Because you're adding the in_array method in the constructor I'm guessing you want to add that to the JEffect prototype as well, but I left it as you had it.
×
×
  • 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.