Jump to content

waterssaz

Members
  • Posts

    111
  • Joined

  • Last visited

    Never

Everything posted by waterssaz

  1. All that snippet of code essentially does is select one of the files from the array at random everytime the page is called, so yes it would change when the page is refreshed and on each visit, although due to the nature of random and depending on how many files you specify this may sometimes stay the same. The files can contain whatever code you want, Regards Sarah
  2. Ok, can't say I've actuallly tried this with jut php before but I could think of a few ways that should work, some will be more graceful than others. One to try then, How about an array of files that you want to include and then use something like <?php $files = array("file1.html", "file2.txt", "file3.php", "file4.php"); $rand = array_rand($files); include ($files[$rand]); ?> You could include this in on each page or to make it more portable incase you change the array, include it in a class file or function and call it from there. Forgive any syntax errors as I haven't tested it Hope it helps Regards Sarah
  3. Are you trying to create some kind of dynamic footer I take it but purely with PHP?
  4. You mean you want to count how many occurences of each there are? If so just do a simple GROUP BY query For example Select ID, COUNT(ID) from [YOUR_TABLE_NAME] GROUP BY ID or in PHP you can use the function array_count_values(array) Hope either of these helps :-) Regards Sarah
  5. You say you can't evaluate 'any' against the database which is why you have so many queries going on which is overcomplicating the code in my view. Why don't you evaluate the $_SESSION['type' and $_SESSION['area'] 1st to seewhat they contain like so: if ($_SESSION['area']== 'any') { $area = '%'; } else{ $area = $_SESSION['area']; } if ($_SESSION['type']== 'any') { $type = '%'; } else{ $type = $_SESSION['type']; } Then run your query inserting those variables but using like()
  6. If you say you are putting multiple entries into the database, I presume you are using some kind of loop, if so is $reference set inside or out of the loop? :-)
  7. beat me lol :-) But mine had extra BETWEEN typo as well
  8. no like SELECT *FROM model_picturesWHERE user_id = colname AND model_pictures.user_picture_date BETWEEN BETWEEN DATE_SUB( CURDATE( ) ,INTERVAL 7 DAY ) AND CURDATE( )
  9. Thats because you are sending $name as a string literal and not a variable. Take it out of the quotes like this: mail('email@email.com','Application Completed',$name.' has completed the exam',$body);
  10. AHhhh the dreaded common fpdf error .Also make sure you have no whitespace after the code as well :-) Sorry I meant to say whitespace at the end of the include files :-)
  11. will the users at the office go through proxy before accessing your web page?
  12. Yes you could do that which would make your code more portable should you ever move it to another host, however it depends how many files you will have to change. If there are a lot, then you could just turn on short tag support as I explained above although i have never been a fan of short tags at all :-)
  13. To enable short tags on WAMP left click the wamp taksbar icon and select PHP > PHP Settings > short open tag.
  14. As i said the short tags are probably not supported on your configuration which means that the php is being interprted as literal text
  15. haven't read through all the code as i assume its decent quality if you paid someone to do it. At an absolute glance I see it uses short tage ie <? instead of <?php, ur server is probably not set up to support short tags :-)
  16. function average($array) { return array_sum($array) / count($array); } Works out the mean.
  17. Ok , basically all you do is, in the original form that posts the values you change the form action to submit to itself instead of the other page that it is going to to do the validation. Then all you need to do is put the code from your validation page into the same page as the code for the form that does the submitting. That way when you hit submit, the page will redirect back to itself, then the if(submit) will pick up beacuse the form has been submitted and display errors etc in the same page. Hope this makes sense. If you posted the code for the actual form then I could have shown you an example instead of having to explain :-)
  18. As suggested above I find the fpdf class very easy to use so definitaly worth a look, don't find dompdf as simple but just IMO :-)
  19. Apart from madTechie whos reply was very contructive I don't think all this sarcasm helps reallly does it. As much as I agree that the post was very vague, it really puts new people off posting. How about guiding newbies into waht they shoud be askin instead of baltantly takin the p*ss
  20. forgive my thickness :-) but can you elaborate on line next eachother. Do you mean that you want the job id, desc esc for each row along one line as per example below: Job id:4 , Desc:job 4, print date: 13/8/09, delivery date: 16/8/09 Job id:5 , Desc:job 5, print date: 13/8/09, delivery date: 17/8/09 etc and then after job 5 have a line break or like this: Job id:4 , Job id:5 , Desc:job 4, Desc:job 5, print date: 13/8/09 , print date: 13/8/09, delivery date: 16/8/09 delivery date: 17/8/09 etc..................
  21. Well depending on your php abilitty this could be very tricky for you to build successfully from scratch. I haven't used this myself but a colleague has, so you coul lookk at the following: http://www.rotaboard.com/account/login Regards Sarah
  22. add a counter??, along the lines of below but not tested :-) [code<?php $sql = "SELECT * FROM Jobs where Print_Complete=0 and Print_Date=CURDATE()"; $results=mysql_db_query($database_name,$sql,$conn); echo "<h2>Today's Jobs for "; echo(Date("l F d, Y</h2>")); $counter = 1; while ($output=mysql_fetch_array($results)) { if($counter == 5) { $spacer="<br><br>"; } else { $spacer=" ->"; } echo "<h1><p><b>Job ID:</b>". $output['JobNo']; echo "<br /><b>Desc:</b> ". $output['Job_Desc']; echo "<br /><b>Print Date:</b> ". $output['Print_Date']; echo "<br /><b>Delivery Date:</b> ". $output['Delivery_Date']."".$spacer."; ?> <a href="GetSingleJob.php?JobNumber=<?php echo $output['JobNo']; ?>">[View Job]</a> <?php $counter++; echo "</h1><hr /></p>";} mysql_close($conn); ?>
  23. did you have to create any tables for your database manually or was their an sql script to do this for you?. Basically the error that you are getting is saying that there are no results being returned from a query which means that an array has no data to cycle through. :-)
  24. Just to let you know it was missing quotes but also look at how you were calling the array here: if ($today >= $week_array[$i] && $today < $week_array[$i+1]) { As I had to change it to "$weeks_array" (notice the 's') as it should have been. easy mistake to make but just thought I'd point it out. :-)
×
×
  • 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.