1. got problem with php/mysql. The think is i alredy retype 4 times, dont know wahat to do.So i let ya'll know my work: 2. 3. 4. Mysql table: (the table name is, jokes) 5. id ; text ; other 6. ------------------------- 7. 1 ; blah ; bluh 8. 2 ; blah ; bluh 9. 10. Here is the complete script for this table 11. ---------------------------------------------------------------------------------------- 12. Unable co connect to the database server at this time.

' ); 16. exit(); 17. } 18. mysql_select_db('jokes', $dbcnx); 19. if (! @mysql_select_db('jokes') ) { 20. 21. die ( '

Unable to locate the joke' . 22. ' database at this time.

'); 23. } 24. 25. $sql = 'create table Jokes ( 26. id int not null auto_increment primary key, 27. JokeText text, 28. JokeOther text, 29. JokeDate date not null)'; 30. if (@mysql_query($sql)) { 31. echo('

Jokes table successfuly created!

' ); 32. } 33. else { 34. die('

Error creating Jokes table:' . 35. mysql_error() . '

'); 36. } 37. ?> 38. ------------------------------------------------------------------------------------------- 39. 40. Add heres the joke list scrip (i think no problemo for this scrip) 41. 42. ------------------ 43. Unable co connect to the database server at this time.

' ); 47. exit(); 48. } 49. mysql_select_db('jokes', $dbcnx); 50. if (! @mysql_select_db('jokes') ) { 51. 52. die ( '

Unable to locate the joke' . 53. ' database at this time.

'); 54. } 55. 56. $sql = 'create table Jokes ( 57. id int not null auto_increment primary key, 58. JokeText text, 59. JokeOther text, 60. JokeDate date not null)'; 61. if (@mysql_query($sql)) { 62. echo('

Jokes table successfuly created!

' ); 63. } 64. else { 65. die('

Error creating Jokes table:' . 66. mysql_error() . '

'); 67. } 68. ?> 69. --------------------------------------------------------------- 70. 71. the PROBLEM IS IN HERE, adding+deleting data. for the adding data its ok. but the problem is from the DELETING data. CANNOT DELETE. 72. This is the script: 73. 74. --------------------------------------------------------------------------------------------- 75. 76. 77. 78. 79. 82. 83. 84.
85.

Type your jokes here:
86.
88.

89.
90. Unable co connect to the database server at this time.

' ); 96. } 97. 98. if (! @mysql_select_db('jokes') ) { 99. die ( '

Unable to locate the joke database at this time.

'); 100. } 101. 102. 103. 104. if (isset($_POST['submitjoke'])){ 105. $joketext = $_POST['joketext']; 106. 107. $sql = "insert into jokes set 108. joketext='$joketext', 109. jokedate=CURDATE()"; 110. 111. if (@mysql_query($sql)) { 112. echo('

your joke has been added

' ); 113. } 114. else { 115. echo('

error adding joke: ' . mysql_error() . '

'); 116. } 117. } 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. if (isset($_GET['deletejoke'])) { 128. $jokeid = $_GET['deletejoke']; 129. $sql = ("DELETE FROM jokes WHERE id='$jokeid'"); 130. 131. if (@mysql_query($sql)) { 132. echo('

The joke deleted.

'); 133. } else { 134. echo ('

ERROR DELETING JOKE: ' . mysql_error() . '

'); 135. } 136. } 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. echo('

Here are all the jokes in database:

'); 151. 152. 153. $result = @mysql_query('select joketext from jokes'); 154. 155. if (!$result) { 156. die('

Error performing query' . mysql_error() . '

'); 157. } 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. while ($row= mysql_fetch_array($result) ) { 170. $jokeid = $row['id']; 171. $joketext = $row['joketext']; 172. echo('

' . $joketext . '' . 'Delete this joke

'); 173. } 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. echo('

Add a Joke!

'); 190. 191. 192. endif; 193. 194. ?> 195. 196. 197. 198. 199. --------------------------------------------------------------------------- 200. When i click the delete link,nothing happen, it wont delete the data, just said "the joke is deleted" when i click the link. 201. --------------------------------------------------------------------- 202. thanx for the help