Jump to content

essjay_d12

Members
  • Posts

    121
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

essjay_d12's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  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
×
×
  • 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.