Jump to content

Jurik

Members
  • Posts

    59
  • Joined

  • Last visited

    Never

Everything posted by Jurik

  1. Never mind I have it working now, just needed to make name in code to Name, DOH! Thanks
  2. hhhmmm I tried this as well and it just does not print the number. Its just blank after "Your job number is" any ideas?
  3. Hi guys, this is proberly a simple soluition and I should know it by now, but I just cant think today and its getting ridiculas now, what im wanting to do is get the ID of the data I have just recently entered so that the user can get a job number from it. My code is below for you to look at im wanting the ID number to appear where I have typed "Your job number is **" any ideas? [code] <?php if (isset($_POST['submit'])) { $Name = $_POST['Name']; $Date = $_POST['Date']; $Department = $_POST['Department']; $Room = $_POST['Room']; $ProbCat  = $_POST['ProbCat']; $ProbDes = $_POST['ProbDes']; $submit = $_POST['submit']; } else { $Name = ""; $Date = ""; $Department = ""; $Room = ""; $ProbCat  = ""; $ProbDes = ""; $submit = ""; } $success = 0; if ($submit == "Save" && $Name != NULL && $Date != NULL && $Department != NULL && $Room != NULL && $ProbCat != NULL && $ProbDes != NULL) { $sql = "INSERT INTO help_msg (Name,Date,Department,Room,ProbCat,ProbDes) VALUES ('" . $Name . "', '" . $Date . "', '" . $Department . "' ,'" . $Room . "' ,'" . $ProbCat . "' ,'" . $ProbDes . "')"; include "conn.inc.php"; $result = mysql_query($sql); if(mysql_affected_rows() == 1) { print("New record has been added sucessfuly. Your job number is **"); $success = 1; } else { print("I'm afraid an error has been detected, please check the information entered again. If the problem persists then contact IT support"); } } if($success != 1) { ?> [/code]
  4. ok I have tried both methods and for the first one it prints out '; ?> while the second example just displays blank, any ideas?  Heres what ive done <?php $pictures=glob('PrizeGiving/thumbnails/*.jpg'); echo $pictures[rand(0,count($pictures)-1)]; ?>
  5. Hi guys. I have a folder with a load of images in, all of which are named diffrently. They are all .jpg however so that makes things a little bit easier I was just wondering how I would go about setting up a peice of php code that will pick one of these images and display it. Basicaly a random image generator I have googled it but all the tutorials seem to only work if you name the images 1.jpg 2.jpg etc any help would be great.
  6. [quote author=sanfly link=topic=118586.msg484696#msg484696 date=1166089400] Most likely the value of $rows is not an array try using [url=http://au3.php.net/manual/en/function.print-r.php]print_r()[/url] to print out the array, it might give you an idea whats going on eg: print_r($rows); [/quote] Ok ive tried printing the array but nothing is displayed, i've also looked for the var but cannt find it all I can find is the following in the script [code] // SOMES VARIABLES $option = mosGetParam( $_REQUEST, 'option', 'com_events'); $task = mosGetParam( $_REQUEST, 'task', _CAL_CONF_STARTVIEW); $mode = mosGetParam( $_REQUEST, 'mode', 'com_events'); $limit = intval( mosGetParam( $_REQUEST, 'limit', '' ) ); $limitstart = intval( mosGetParam( $_REQUEST, 'limitstart', 0 ) ); $offset = intval( mosGetParam( $_REQUEST, 'offset', 0 ) ); $catid = intval( mosGetParam( $_REQUEST, 'catid', 0 ) ); $agid = intval( mosGetParam( $_REQUEST, 'agid', 0 ) ); $keyword = mosGetParam( $_REQUEST, 'keyword', '' ); $pop = mosGetParam( $_REQUEST, 'pop', 0 ); [/code]
  7. Hi I was wondering if anyone could help me with this error I am getting with this script, when I run the script in both explorer and firefox I am getting the following messages [quote] Warning: usort(): The argument should be an array in /home/e-smith/files/ibays/Primary/html/mambo/components/com_events/events.php on line 1349 Warning: Variable passed to each() is not an array or object in /home/e-smith/files/ibays/Primary/html/mambo/components/com_events/events.php on line 1350 [/quote] Now below is what is on both of these lines as well as the whole function it is in, the errors are comming from the usort and while lines but to me it seems fine. Can anyone see the problem? [code] function showCalendar ($rows,$year,$month,$day){     global $mosConfig_offset,$database,$option,$Itemid;         $cellcount = count($rows);        usort($rows, "sortEvents");     while(list($key,$value)=each($rows)) {                                $id_Array[] = $value->id;                                          $title_Array[] = $value->title;                 $color_Array[] = $value->color_bar;                 $publish_up_Array[] = $value->publish_up;                 $publish_down_Array[] = $value->publish_down;                  $reccurtype_Array[] = $value->reccurtype;                 $reccurday_Array[] = $value->reccurday;                  $reccurweekdays_Array[] = $value->reccurweekdays;              } [/code]
  8. [quote author=ProjectFear link=topic=118168.msg482584#msg482584 date=1165838603] well you how much other images are there. i am guessing you are changing img_header.jpg? well just have a couple of those with a number on the end. then use the rand. [code=php:0] <img src="<?php echo $mosConfig_live_site; ?>/templates/waterandstone_green/images/img_header<?php echo rand(1, 4); ?>.jpg" alt="header image" />[/code] remember to change the 4 to however many images there are. [/quote] Thats works a treat, thanks alot
  9. Hi guys,         I've been asked to add a radom image generator to a site that is using Mambo to create it's web-site in. At the moment the image that is needed to become a random image is using the following code [code] <img src="<?php echo $mosConfig_live_site; ?>/templates/waterandstone_green/images/img_header.jpg" alt="header image" /> [/code] Now I have tried to add some scripts I have found on the net to make this image randomly selected but I just cant seem to get it to work, can anyone help me out?
  10. [quote author=thorpe link=topic=113224.msg459968#msg459968 date=1162219148] You dont' need to escape forward slashes. [code=php:0] $target_path = "/benin/videolibrary/"; [/code] Also... you [i]may[/i] need to remove the trailing slash. [/quote] well ive tried /benin/videolibrary/ as well as /benin/videolibrary and no success, would it bing worthwhile to meantioning that the benin drive is over a network, they are not in the same case together.
  11. [quote author=thorpe link=topic=113224.msg459960#msg459960 date=1162218465] For starters its Lin[b]u[/b]x not Linex, and it uses / as a directory delimeter. [/quote] ok well i've changed the $target_path = "\\\benin\\videolibrary\\"; to $target_path = "///benin//videolibrary//"; and still no joy, im sorry I havent used Linux before so I have no idea how to map an address from it
  12. Hi guys i've just moved my finished project for work over to the server on which it is going to be run off only to find that its a linex box and that the place im saving the files to with the code is a windows box so the path I am using is on longer working. Can anyone tell me how I can set this $target_path = "\\\benin\\videolibrary\\"; so that it moves from the linex server and onto the address given above which is a windows server.
  13. [quote author=thorpe link=topic=113207.msg459922#msg459922 date=1162211648] I would think this... [code=php:0] unlink("\\\benin\\Videolibrary\\" . $Videofile); [/code] would need to be..... [code=php:0] unlink("\\\benin\\Videolibrary\\" . $row['Videofile']); [/code] [/quote] That seemed ta do the job, thanks
  14. [quote author=Destruction link=topic=113207.msg459917#msg459917 date=1162210187] As far as I'm aware print_r() is for arrays, I think using print $tralala will appear as an empty array because it's not actually reading the array. In the code given, you haven't actually defined the $videoFile at all.  You've fetched the array into $tralala and not done anything following that such as: [code] <?php $videoFile = $tralala['videoFile']; ?> [/code] HTH Dest [/quote] Have tried that and am still getting blank reports, this is strange
  15. [quote author=kenrbnsn link=topic=113207.msg459907#msg459907 date=1162209113] How is this script being invoked? Is $_GET['vivID'] set when entering? Put this code at the start of your script: [code]<?php echo '<pre>' . print_r($_GET,true) . '</pre>'; ?>[/code] Ken [/quote] Well this is what its printing out Array (     [ID] => 75 ) Running query ... SELECT * FROM videos WHERE ID = 75 Found 1 record(s) Resource id #4Array
  16. [quote author=gmwebs link=topic=113207.msg459896#msg459896 date=1162208282] My first suggestion is to print out the contents of your $result variable, so that you can see the values. You would then need to assign the filename contained in the result to the $Videofile variable. [code] <?php $query = "SELECT * FROM videos WHERE ID = ('$vidID')"; //Try to always fetch the columns that you need from the table. SELECT filename, description FROM videos WHERE ID = ('$vidID') $result=mysql_query($query); print_r($result); //Print out the results from the query exit(); //Exit the script so that you can see the output ?> [/code] [/quote] Already started doing that, strange thing is that its printing out nothing, it seems the Array is empty. Heres the code that im using. [code] <?php if (isset($_GET['ID'])) {   $vidID = $_GET['ID']; } else {   $vidID = NULL; } $query = "SELECT * FROM videos WHERE ID = {$vidID}"; echo "Running query ... {$query}<br>"; $result = mysql_query ($query); echo "Found " . mysql_num_rows ($result) . " record(s)<br>"; print ("<pre>"); print ($result); print ("</pre>"); $tralala = mysql_fetch_array ($result); print ("<pre>"); print ($tralala); print ("</pre>"); ?> [/code] And like I said it seems to be saying the array is empty
  17. [quote author=gmwebs link=topic=113207.msg459885#msg459885 date=1162205667] Yeah... The $Videofile variable is being used on the following line... [code] <?php //Code that goes to the drive and deletes the file.   unlink("\\\benin\\Videolibrary\\" . $Videofile); ?> [/code] I would assume that it should be defined as the filename of the video file you are trying to delete. Do you store the filename in the database table? If so, you need to assign that value to the variable before using it. [/quote] Yes the file name is stored in the database in the videos table and in there under Videofile, I thought I had assigned the value in the code as I delaire the variable in the code. How do I go about doing this then, do i simple put another quary in before the unlink?
  18. Hi guys, im think im getting somewhere with me delete code now. Instead of the usual error message of erro2. Im now only getting [quote] Notice: Undefined variable: Videofile in c:\documents and settings\administrator\my documents\web pages\st john fisher movie front end v2\delete.php on line 28 Warning: unlink(\\benin\Videolibrary\): Permission denied in c:\documents and settings\administrator\my documents\web pages\st john fisher movie front end v2\delete.php on line 28 [/quote] Can anyone help me work out where the undefined variable is comming from? Heres my code [code] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <?php include "conn.inc.php"; ?> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>St John Fisher Catholic High School</title> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="St John Fisher Catholic High School" name=keywords> <META content="St John Fisher Catholic High School" name=description> <META content="Simon Mackness-Pettit, Arutha Studios" name=Author> <link type="text/css" rel="stylesheet" href="styles.css"> </head> <body> <?php if (isset($_GET['ID'])) {   $vidID = $_GET['ID']; } else {   $vidID = NULL; } $query = "SELECT * FROM videos WHERE ID = ('$vidID')"; $result=mysql_query($query); while($row=mysql_fetch_array($result)) //Code that makes sure a certain file can be found on the drive before it unlinks the videofile if ( file_exists( "\\\benin\\Videolibrary\\checkme_sjf.txt" ) ){ //Code that goes to the drive and deletes the file.   unlink("\\\benin\\Videolibrary\\" . $Videofile);   //Code that deletes record from database   $query2 = "DELETE FROM videos WHERE ID = ('$vidID')";   $result2 = mysql_query($query2);     echo "The video has been deleted.";   //Code that happens if checkme_sjf is not found on the drive  } else { echo "Im afraid the drive you are trying to upload the file to is incorrect, please contact the ICT department."; } ?> <p align="center"><a href="delvideo.php">Back To Video Removal Facility</a></p> </body> </html> [/code] Thanks for any help you can offer
  19. Hi guys im back again, I have been unable to solve the problem i am still having with my PHP code not being able to delete the file I am requesting it to, i've pasted all my code below for you to look at, the problem is still when I click the delete link I get the following errors [quote]Warning: chdir(): No such file or directory (errno 2) in c:\documents and settings\administrator\my documents\web pages\st john fisher movie front end v2\delete.php on line 30[/quote] and this error im guessing will be fixed once the above error is fixed [quote]Warning: unlink(): Permission denied in c:\documents and settings\administrator\my documents\web pages\st john fisher movie front end v2\delete.php on line 31[/quote] Now when i go to my database its deleting the correspondind entry in the table but the file is not being deleted, can anyone help? Here is all my code in its entirity. [code] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <?php include "conn.inc.php"; ?> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>St John Fisher Catholic High School</title> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="St John Fisher Catholic High School" name=keywords> <META content="St John Fisher Catholic High School" name=description> <META content="Simon Mackness-Pettit, Arutha Studios" name=Author> <link type="text/css" rel="stylesheet" href="styles.css"> </head> <body> <?php if (isset($_GET['ID'])) {   $vidID = $_GET['ID']; } else {   $vidID = NULL; } $query = "SELECT * FROM videos WHERE ID = ('$vidID')"; $result=mysql_query($query); while($row=mysql_fetch_array($result)) {   chdir (\\\benin\\videolibrary\\);   unlink($Videofile); } $query2 = "DELETE FROM videos WHERE ID = ('$vidID')"; $result2 = mysql_query($query2); echo "The video has been deleted."; ?> <p align="center"><a href="delvideo.php">Back To Video Removal Facility</a></p> </body> </html> [/code]
  20. [quote author=ProjectFear link=topic=112099.msg454882#msg454882 date=1161341587] so the file and everything is uploaded? [/quote] Yep it appears in the database and everything, its just the second peice of code with the unlick command that dont seem to work
  21. Hi guys I have two peices of code one adds a file to a folder, the other deletes the file in the fodler. Both are using the same path, the add code works, however the delete code code not below is the coede I use on both pages. [code] $target_path = "\\\benin\\videolibrary\\"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); [/code] [code] {   extract($row);   chdir ("\\\benin\\videolibrary\\");   unlink($Videofile); } [/code] As you can see both are using the same path, the belete code however brings up the following error [quote] Warning: chdir(): No such file or directory (errno 2) in c:\documents and settings\administrator\my documents\web pages\st john fisher movie front end v2\delete.php on line 28 Warning: unlink(Seeifthisfileuploads.php): No such file or directory in c:\documents and settings\administrator\my documents\web pages\st john fisher movie front end v2\delete.php on line 29 [/quote] Now im guessing the second error is because the first error occurs, does anyone know what is causing this problem and how to fix it, I can work out how its not working when the adding code works fine and there both using the same path
  22. Right I have no knowledge of Linex so i'll meantion it to me boss who knows more bout Linex than me, cheers
  23. [quote author=kenrbnsn link=topic=112005.msg454385#msg454385 date=1161267270] If the script is running on a Linux server the files will be saved to the Linux server. PHP running on the Linux server has no knowledge of the Windows server. Ken [/quote] hhhmmm ok, I changed the path so that it saves the file in a folder in the same directory as the php files and I still get the same error, could this be because I am selecting files off a windows system to be saved onto a linex server? If what you say ken is true is there a way to make it knowlegable of the windows servers and thus save onto them?
  24. [quote author=printf link=topic=112005.msg454346#msg454346 date=1161264839] if your on Windows or Linux, or Unix, or Mac, always use forward slashes, Windows understands them, like all the rest! So this... [code]      $target_path = "\\\benin\\Videolibrary\\";             path = str_replace('\\','/',$path);       $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); [/code] Could be written like this.. [code]       $target_path  = "./benin/Videolibrary/";       $target_path .= basename( $_FILES['uploadedfile']['name'] ); [/code] me! [/quote] Nope im still getting the same error, this problem is really weird. It just dont seem to want to be fixed
  25. What I am trying to do is upload a file that is selected by the user, after the user clicks Save it will then put the file onto a server. The php files are running of a Linex server but the server it gets off and saves to are window servers.
×
×
  • 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.