Jump to content

lyndsey.pearce@ntlworld.com

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

lyndsey.pearce@ntlworld.com's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Got it! C:\xampp\htdocs\web\uploads should be C:\xampp\htdocs\web\uploads\. The image was saving to the root as uploadsimage.gif. Thanks for your help guys!
  2. Hi GingerRobot, Major screw up on my part. The logic is running now and outputting the message 'tmp_name has been uploaded'. However, there is no sign on the image in the tmp or uploads folders. Permissions?
  3. Hi ronnie88, I tired turning off access control to no avail. GingerRobot, that was a typo on my part. The Files array index I am referencing is $_FILES['picMain']['tmp_name']. I am getting some warnings like: Warning: move_uploaded_file(C:\xampp\htdocs\web\uploads) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\xampp\htdocs\web\upload.php on line 10 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\xampp\tmp\php50.tmp' to 'C:\xampp\htdocs\web\uploads' in C:\xampp\htdocs\web\upload.php on line 10 C:\xampp\tmp\php50.tmp has not been uploaded! ERROR: 0 Thanks for input so far! Any more ideas?
  4. Hi guys, I was hoping someone could help me with a problem? First off, I'll let you know what I have: Local machine is Windows Vista Server is apache - xampp to be precise Developement environment is PHP 5 & MYSQL 5 I have a very simple script that should upload a file to my local server like so: <?php error_reporting(E_ALL); //'submit' button is clicked - submitting all the data if (isset($_POST['submit'])){ //handle file upload //check for the first main image upload if (isset($_FILES['picMain'])){ $filename1 = $_FILES['picMain']['name']; //move the the file from it's temporary location on the server if (move_uploaded_file($filename1, 'C:/xampp/htdocs/web/uploads')){ echo $filename1 . ' has been uploaded!'; }else{ echo $filename1 . ' has not been uploaded!<br /> ERROR: ' . $_FILES['picMain']['error']; } } //insert all data into vehicles, vehiclesmakes, vehiclesmodels, etc.. }else{} ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="multipart/form-data" name="form1"> <input type="hidden" name="MAX_FILE_SIZE" value="30000" /> <input type="file" name="picMain" id="picMain" /> <input type="submit" name="submit" id="submit" value="Add" /> </form> </body> </html> What happens is that the script runs, returns the message filename1 has not been uploaded ERROR: 0, and the graphic is not uploaded. I am confused because the Error 0 means there was no error and the file was uploaded. I have double checked the uploads folder path and it is correct. I have found the 'apache' process in windows task manager and the user is 'Lyndsey' - that's me! I have then tried to add permissions to the uploads folder for the user 'Lyndsey' by: Right-clicking the folder Selecting the security tab Finding the user 'Lyndsey' and adding full access (read, write, execute, modify, full control) to that user. Selecting the sharing tab Clicking share Select 'change sharing permissions' Adding 'Lyndsey' userand making that user the owner Clicking 'share'. I also clicked advanced sharing and gave permissions here. I have also looked around this forum for similar threads but found no definitive answers. Anyone any ideas as to what maybe happening? I am new to Vista and XAMPP so still finding my feet. Any help greatly appreciated! Thanks in advance! Lyndsey
  5. Hiya! I am trying to pull out a record from one table in my database. I am having trouble pulling out data from one field named "Article Entry" for two records. This is the code to convert the sql to xml: [code] <?php include ('common_db.php');          $link_id = db_connect(); $table_id = 'Article'; $query = "SELECT * FROM $table_id"; $dbresult = mysql_query($query, $link_id); //----------------------------- //create a new XML document //----------------------------- $doc = new DomDocument('1.0'); //------------------------ //create root node //------------------------ $root = $doc->createElement('News'); $root = $doc->appendChild($root); //---------------------------------- //process one row at a time //----------------------------------- while($row = mysql_fetch_assoc($dbresult)) {   //----------------------------   //add node for each row   //----------------------------   $occ = $doc->createElement($table_id);   $occ = $root->appendChild($occ);   //--------------------------------   //add a child node for each field   //---------------------------------   foreach ($row as $fieldname => $fieldvalue) {     $child = $doc->createElement($fieldname);     $child = $occ->appendChild($child);     $value = $doc->createTextNode($fieldvalue);     $value = $child->appendChild($value);   } // foreach } // while //------------------------------- //get completed xml document //------------------------------- $xml_string = $doc->saveXML(); echo $xml_string; ?> [/code] This is the output: [code] <?xml version="1.0"?> <News> <Article> <ArticleID>1</ArticleID> <ArticleSubmitter>1</ArticleSubmitter> <ArticleSubmitDate>4th April 2006</ArticleSubmitDate> <ArticleLastUpdated>2006-04-24 15:43:19</ArticleLastUpdated> <ArticleTitle>Affordable Housing Strategy for Dingley Dell</ArticleTitle> <ArticleDate>3rd April 2006</ArticleDate> [b]<ArticleEntry></ArticleEntry>[/b] <ArticleImage>2</ArticleImage> </Article> <Article> <ArticleID>2</ArticleID> <ArticleSubmitter>1</ArticleSubmitter> <ArticleSubmitDate>10th April 2006</ArticleSubmitDate> <ArticleLastUpdated>2006-04-24 15:53:04</ArticleLastUpdated> <ArticleTitle>Schools take the easter egg challenge</ArticleTitle> <ArticleDate>9th April 2006</ArticleDate> [b]<ArticleEntry>Do you love chocolate? Can't wait for your Easter egg? The young people at Dingley Dell's schools are starting Easter early this year by helping trading standards officers test a range of Easter eggs. The pupils from various schools across the borough will be testing the eggs for weight, packaging, price, value for money and the all important taste. The results of this testing will be presented in an eye-catching poster to be judged by a panel of trading standards experts. Elle (11) from All Saints Catholic Primary School -last year's winning team - said: "We tested the eggs and evaluated the information we found using colourful graphs and charts, my favourite part of the project was testing for value for money." The Dingley Dell winners will take part in the Greater Manchester final. </ArticleEntry>[/b] <ArticleImage>4</ArticleImage> </Article> <Article> <ArticleID>3</ArticleID> <ArticleSubmitter>2</ArticleSubmitter> <ArticleSubmitDate>10th April 2006</ArticleSubmitDate> <ArticleLastUpdated>2006-04-24 16:14:33</ArticleLastUpdated> <ArticleTitle>New sports facility in Dingley Dell</ArticleTitle> <ArticleDate>9th April 2006</ArticleDate> [b]<ArticleEntry></ArticleEntry>[/b] <ArticleImage>5</ArticleImage> </Article> </News> [/code] As you notice, in the second record the "Article Entry" has content contained inside of it, but the other two records don't seem to pull out the content from the database. I have double checked these records. In PHPMyAdmin, all three article records have an entry. Does anyone have any ideas as to what I am doing wrong? Cheers!
  6. I am struggling to create a dynamic link because I can't seem to figure out how to suitably nest some php in HTML. Could anyone help? This is my script: [code] <?php //-----------------------       //CONNECT TO DB       //-----------------------              include ('common_db.php');                      $link_id = db_connect(); //--------------------------------------------------------------- //THIS QUERY WILL CREATE THE DYNAMIC LINKS IN THE WEB PAGE //--------------------------------------------------------------- ?> <div id="navRight"> <h2 class="navHeader">The heading</h2> <?php      $selectquery = "SELECT * FROM Table";      $result = mysql_query($selectquery) or die("Invalid query: " . mysql_error());      while ($row = mysql_fetch_array($result))                 {                    echo "<a href=\"\">" .$row['FieldName']. "</a>";                 } ?> </div> [/code] I want to place the link info into this bit: [code] echo "<a href=\"\">" .$row['FieldName']. "</a>"; [/code] What I have to create the link is: [code] echo "<a href=\"pagename.php?action=Table&id=\"$row['IDNumber']\"\">" .$row['FieldName']. "</a>"; [/code] Keep returning this error: [code] Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in script.php on line 108 [/code] Can anyone help? Cheers!
  7. Hiya! I have checked field names and everything is correct. This is some more code here: [code] <?php   If (isset ($_SESSION['AdminAccess'])) {       $admin_username = $_SESSION['AdminUsername'];           include ('common_db.php');           $link_id = db_connect();      //-----------------------PULL UP PAGE DETAILS-----------------------------------------                   $selectquery = "SELECT * FROM table WHERE FieldIDNumber = '" . $_GET['id'] . "'";                   $result = mysql_query($selectquery) or die("Invalid query: " . mysql_error());                   $row = mysql_fetch_array($result)   ?> <p>Last updated:<em><?php echo $row['FieldLastUpdate']; ?></em></p> <form action="edit.php" method ="post" enctype="multipart/form-data"> <p>Alter name: <input type="text" name="Name" size="25" value=" <?php echo $row['Name']; ?>" /></p> <p>Alter heading: <input type="text" name="Heading" size="25" value=" <?php echo $row['Heading']; ?>" /></p> <p>Alter Entry: <textarea name="Body" cols="50" rows="50"><?php echo $row['Body']; ?></textarea></p> <p>Upload new image: <input type="file" name="image_filename" id="image_filename" value="<?php echo $row['PageImage']; ?>"/></p> <p>Alter image title: <input type="text" name="ImageTitle" value="<?php echo $row['ImageTitle']; ?>" /></p> <p>Alter image alt text: <input type="text" name="AltText" value="<?php echo $row['ImageAltText']; ?>" /></p> <p><input type="submit" value="submit" /> </form> <?php } else                   {                    echo "<p>**You are not authorised to access this page!**</p>";                    echo "<p><a href=\"AdminLogin.html\">login</a></p>";                    } ?> [/code] What is interesting is when I view the page source for the output I get this: [code] <h2>Edit details</h2> <form action="edit.php" method ="post" enctype="multipart/form-data"> <p>Alter name: <input type="text" name="Name" size="25" value=" Sitemap" /></p> <p>Alter heading: <input type="text" name="Heading" size="25" value=" this is the heading" /></p> <p>Alter body: <textarea name="Body" cols="50" rows="50">jf fjhjhuy  uy u yu </textarea></p> <p>Upload new image: <input type="file" name="image_filename" id="image_filename" value="/uploadimages/image.gif"/></p> <p>Alter image title: <input type="text" name="ImageTitle" value="image is the title" /></p> <p>Alter image alt text: <input type="text" name="AltText" value="image is the alt text" /></p> <p><input type="submit" value="submit" /> </form> [/code] The value seems to be pulled out, but the path is not displayed in the browser. Weird!
  8. Hello! I have a simple HTML form with some PHP inside it: [code] <p>Upload new image: <input type="file" name="image_filename" id="image_filename"                            value="<?php echo $row['ImagePath']; ?>" /></p> [/code] All I want to do is display the contents of the field called "ImagePath" which is the path to an image stored on the server. The user can then click the browse button to change the path if they wish. I have no errors returned, but the path to the image is not displayed in the input field in the browser. I have done this for other input fields with a "type" of "text" and it works. Can anyone tell me what I am doing wrong? Cheers!
  9. Hey thanks alot for your help Ray! I took your advice and got shot of the $_GET['type'] in two places and just used the name of the table and key field, as I am only querying 1 table. I did notice something odd though. Something somewhere doesn't like the use of "#" in the name. I was using the same name for the PK field as for the table, except the key field is tablename#. I can change this to anything else and the query works. Change it to something#, and I get an invalid query error. Aah well! Lyndsey
  10. Hello! I am trying to create a web front end editing page to modify database entries. All my Primary Key fields in the database end in hash for consistency and denote it contains a whole number. I wrote script A: [code] $selectquery = "SELECT * FROM Page"; $result = mysql_query($selectquery) or die("Invalid query: " . mysql_error()); while ($row = mysql_fetch_array($result)) { <?php echo ">>"; echo $row['ColumnEntry']; ?>         <a href="deletepage.php?type=TableName&id=<?php                     echo $row['PrimaryKeyField#']?>">[DELETE]</a></p> [/code] When you click the link "DELETE" you get transfered to script B: [code] $sql = "DELETE FROM " . $_GET['type'] . "             WHERE " . $_GET['type'] . "# = '" . $_GET['id'] . "'             LIMIT 1";             echo "$sql"; [/code] Interestingly, the sql statement I echo out is: [code] DELETE FROM TableName WHERE PrimaryKeyField# = '1' LIMIT 1 [/code] However, I get this error: [code] Invalid query: Unknown column 'PrimaryKeyField' in 'where clause' [/code] It misses out the hash. I have attached the hash symbol in the where clause like so: [code] WHERE " . $_GET['type'] . "# = '" . $_GET['id'] . "' [/code] And it is visible from the echo output. What am I doing wrong, is it the way I mixed PHP and MySQL? Is this even a PHP issue or a MySQL one? Can anyone point out my mistake please? Cheers!
×
×
  • 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.