Jump to content

essjay_d12

Members
  • Posts

    121
  • Joined

  • Last visited

    Never

Everything posted by essjay_d12

  1. actually now it if i put tes"t converts to .. tes\ ?
  2. I tried that and it does the same thing?
  3. Hi I am trying to be able to insert quotes into a input box then Update my sql table - but it doesnt seem to insert the quotes or anything after them into my table? How can I include this feature? I know it works fine with a textarea - but I also need it to work for an insert box as well Any ideas? CHeers, S
  4. Hi my code was working. Then when adding a second row into the database it only seems to picking up the $_POST['tree'.$id] value <!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=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form action="updateTrees.php" method="post"> <table> <?php echo '<tr><td>Tree</td><td>Type</td><td>pl</td><td>1 lit</td><td>2 lit</td><td>3 lit</td><td>5 lit</td><td>7 lit</td><td>10 lit</td><td>15 lit</td><td>Groups</td><td>Leaves</td><td>Hardiness</td><td>Text</td><td>Description</td><td>Price</td></tr>'; $conn = mysql_connect("localhost", "admin", "adm1n"); mysql_select_db("wizotrees",$conn); $query = "SELECT id, tree, type, pl, 1lit, 2lit, 3lit, 5lit, 7lit, 10lit, 15lit, groups, leaves, hardiness, text, description, price FROM trees"; $result = mysql_query($query) or die(mysql_error()); $rows = mysql_num_rows($result); $i=1; echo $rows; if ($rows > 0) { while ($row = mysql_fetch_assoc($result)) { echo '<tr><td><input name="tree'; echo $i; echo '" type="text" value="'; echo ($row['tree']); echo '" /></td><td><input name="type'; echo $i; echo '" type="text" value="'; echo ($row['type']); echo '" /></td><td><input name="pl'; echo $i; echo '" type="text" size="3" value="'; echo ($row['pl']); echo '" /></td><td><input name="1lit'; echo $i; echo '" type="text" size="3" value="'; echo ($row['1lit']); echo '" /></td><td><input name="2lit'; echo $i; echo '" type="text" size="3" value="'; echo ($row['2lit']); echo '" /></td><td><input name="3lit'; echo $i; echo '" type="text" size="3" value="'; echo ($row['3lit']); echo '" /></td><td><input name="5lit'; echo $i; echo '" type="text" size="3" value="'; echo ($row['5lit']); echo '" /></td><td><input name="7lit'; echo $i; echo '" type="text" size="3" value="'; echo ($row['7lit']); echo '" /></td><td><input name="10lit'; echo $i; echo '" type="text" size="3" value="'; echo ($row['10lit']); echo '" /></td><td><input name="15lit'; echo $i; echo '" type="text" size="3" value="'; echo ($row['15lit']); echo '" /></td><td><input name="groups'; echo $i; echo '" type="text" value="'; echo ($row['groups']); echo '" /></td><td><input name="leaves'; echo $i; echo '" type="text" value="'; echo ($row['leaves']); echo '" /></td><td><input name="hardiness'; echo $i; echo '" type="text" size="3" value="'; echo ($row['hardiness']); echo '" /></td><td><input name="text'; echo $i; echo '" type="text" value="'; echo ($row['text']); echo '" /></td><td><input name="description'; echo $i; echo '" type="text" value="'; echo ($row['description']); echo '" /></td><td><input name="price'; echo $i; echo '" type="text" size="5" value="'; echo ($row['price']); echo '" /></td><td><input name="idCheck'; echo $i; echo '" type="hidden" value="'; echo ($row['id']); echo '" /></td></tr>'; $i++; } } else { echo "<tr><td>There are no items</td></tr>"; } echo '<input name="rowCount" type="hidden" value="'; echo $rows; echo '" /><tr><td><input type="submit" name="submit" value="Update" /></td></tr>'; ?> </table></form> </body> </html> and then the form it goes to is ... <!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=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php $conn = mysql_connect("localhost", "admin", "adm1n"); mysql_select_db("wizotrees",$conn); $rowCount = $_POST['rowCount']; $insertCmd = NULL; for($i=1; $i<=$rowCount; $i++) { $id = $_POST['idCheck.$i']; $tree = $_POST['tree'.$i]; $type = $_POST['type'.$id]; $pl = $_POST['pl'.$id]; $_1lit = $_POST['1lit'.$id]; $_2lit = $_POST['2lit'.$id]; $_3lit = $_POST['3lit'.$id]; $_5lit = $_POST['5lit'.$id]; $_7lit = $_POST['7lit'.$id]; $_10lit = $_POST['10lit'.$id]; $_15lit = $_POST['15lit'.$id]; $groups = $_POST['groups'.$id]; $leaves = $_POST['leaves'.$id]; $hardiness = $_POST['hardiness'.$id]; $text = $_POST['text'.$id]; $description = $_POST['description'.$id]; $price = $_POST['price'.$id]; echo $id; echo $tree; echo $type; $insertCmd = $insertCmd.'('.$id.", '".$tree."', '".$type."', ".$pl.", ".$_1lit.", ".$_2lit.", ".$_3lit.", ".$_5lit.", ".$_7lit.", ".$_10lit.", ".$_15lit.", '".$groups."', '".$leaves."', ".$hardiness.", '".$text."', '".$description."', ".$price; IF ($rowCount>1) { $insertCmd = $insertCmd."), "; } else { $insertCmd = $insertCmd.")"; } } echo $insertCmd; ?> </body> </html> anybody see why it would have suddenly changed? regards, s
  5. Hi, I want to be able to add my $i to variables within a for loop (to creat multiple variables - the number of variables is dependant on the number of rows from a database - i.e. $final) $final will be generated from a number of rows from a database - so will be unknown. The below code didnt work - how do I go about adding a number to variables giving me the correct amount of variables $i=1; $final = 10; for($i; $i>$final; $i++) { $name.$i = $_POST['name.$i']; $number.$i = "$_POST['number.$i']; } echo $name2; echo $name3; Any ideas? Cheers S
  6. tried the upgrade and it says there are conflicting files lists a few conflicting files cheers d
  7. Were currently running version 4.0.18, but are looking to install an open source package that requires MySQL version 4.1 We have many databases/tables within version 4.0.18 Were wondering how updating MySQL will be affected.... will we lose any data? users etc? Is it as simple as downloading the latest version and installing it? Is it possible to be able to get 4.1 rather than the latest edition? Cheers d
  8. Windows won't let me change htaccess-dist to .htaccess - saying it needs a file type..!! is there another way in which I can save it other than just trying to rename it thanks d
  9. I am using the following .... select * from house LIMIT 10, 20; yet this produces 13 rows, surely it should only produce 11? thanks d
  10. How would I get just the 10th to the 20th items from a table when ordered by date etc so it skips the first 9 items - and skips any items after the 20th any ideas? cheers d
  11. I have a form and one of the fields has a button that opens a pop-up window - there are urls here and when the user selects the url the url is needed to be sent back to the original form into the field. At the moment i have it doing it but into a fresh page (problem here is that any values user had put into the other form fields will have dissapeared) Is this possible to do? if so how? cheers d
  12. When I try to order by ID it prints as the following 1 1 1 10 10 11 2 3 where as i want it going ..... 1 1 1 2 3 10 11 is there a way in which the sql statement can change this rather than editing the database (assuming the problme is because they dont have a zero in front of them!!) cheers d PS I have no access to the db......!!! (extracting information through asp)
  13. we know that the username is the same as the database - and we also know it is possible to obtain windows' username through asp so is it not possible in php? cheers d
  14. is there a way in which php can grab a computers username, i log into windows as john so i want php to grab john and use that to open up a mysql database with information on the user john. Basically so users do not need to log in themselves twice... ie windows then the website (just windows) as that is enough authentication thanks d
  15. Hi I am getting problems linking to files within different folders.... can some one explain the following ../ as i thought that should direct to the root folder I have root/admin/db/inc/file.php and am trying to link to the css in the following... in that file i want to require config.php which is located root/inc/config.php so i assumed (as i dont wish to put the full URL in - incase some other site wants to use the code) that you could do it like so... require("../inc/config.php"); But this is not working! Anybody got any solutions or explain further how ../ works?? thanks d
  16. I am sending a url to another page and retrieving it via a get clause http://server.com?url=http://www.mysite.ac.uk/test//course/mod.php?id=1&section=0&sesskey=4lTZTazk64&add=resource&type=file I use echo $_GET['url']; and it echoes out..... http://www.mysite.ac.uk/test//course/mod.php?id=1 how do i get it all as in this bit too .... &section=0&sesskey=4lTZTazk64&add=resource&type=file ?? thanks d
  17. save the data somewhere
  18. what you mean printing them to the screen?
  19. It is possible to put some javascript into a $_SESSION variable? I want to put javascript:history:back() into a session, is this possible and if so does it still function in correct way? cheers d
  20. is there a way in which i can print out the page the user has just come from?
  21. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html<?php echo $direction ?>> <head> <?php echo $meta ?> <link rel="stylesheet" type="text/css" href="<?php echo "$CFG->wwwroot/theme/$CFG->theme" ?>/print.css" media="print" /> <meta name="keywords" content="moodle, <?php echo $title ?> " /> <title><?php echo $title ?></title> <link rel="shortcut icon" href="<?php echo "$CFG->wwwroot/theme/$CFG->theme" ?>/favicon.ico" /> <?php include("$CFG->javascript"); ?>
  22. My session works in the page I set it, however I use onClick to go to another page or even a hyperlink and in the new page the session no longer exists, what may be the reasons for this? cheers d
  23. I get the following error when im trying to set a cookie... Warning: Cannot modify header information - headers already sent by (output started at /srv/www/htdocs/testmoodle/theme/pcol/header.html:2) in /srv/www/htdocs/testmoodle/mod/resource/type/file/file.html on line 17 with the following code... <?php session_start(); // function to get current URL function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } $url = curPageURL(); setcookie("URL", $url); ?> I need the result of that function in a cookie, but constantly giving me this error... why? cheers d
×
×
  • 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.