Jump to content

11Tami

Members
  • Posts

    329
  • Joined

  • Last visited

    Never

Everything posted by 11Tami

  1. Thank you, but I don't understand how you can think that because I still have to look through a whole huge table, and even several tables. If there is a gap between 1-10 and so on means I have to go back to the very beginning each time just to look for all the new fields. Even if I put accept etc. on some of the fields, I'll still have to go back to the beginning to look through all the fields for all of that including the new entries. These tables are getting huge and will only get bigger. My sql must have a way as popular of a database program that it is. I hope someone knows a way.
  2. Thanks guys, here's what is causing the big problem. When stuff is automatically added to the database from a web page by someone: I have to go through all the entries and decide which rows I want to pull out onto pages and which ones should be deleted. Many of the rows are never kept. There is no problem assigning an id to someone else because it was never used. Then new rows are added by people and I have to go through the table again and delete any new ones we don't want. This is taking so much of my time and as the database grows will be virtually impossible. I don't get paid for helping my brother figure out his web site and looking through his tables and who knows someday if the site will make money where I ever will. If the id's were replaced with new ones eventually there would be very few new ones mixed in with the old ones. I wouldn't have to look through the whole table each time, and I would know where to look for only new added rows to decide to keep or not. I hope you can understand why keeping it as is will cause a lot of stress and won't work in the long run. Unfortunately the form is sent by others not me so I can't insert just the row and new id I specify.
  3. Thank you very much but there is no other way? I am not dealing with any money issues. I think I approached that wrong. The id's are already in the table so I probably need something to insert the next new row, into the first available id slot, instead. I should be trying this instead. How can I alter this code so that it inserts a next row into the first missing id slot? So if row id 33 is missing between rows 30 and 35, how to have only id row 33 added? Here is the code I have right now to just add a new row. $sql="INSERT INTO addthis (comment) VALUES ('" . $_POST['comment'] . "')"; Can I just add a "where" command or something instead? Maybe something like $id= "some code here saying enter into first empty id row found" //then the insert command to add the row $sql="INSERT INTO addthis (comment) VALUES ('" . $_POST['comment'] . "') WHERE `id` = $id"; I just need someone to help me to know, what to put in this variable. $id
  4. Hello, if I add this to my mysql server tables it adds an id to all my rows and numbers them. ALTER TABLE `table_name` ADD COLUMN `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY Is there a way to make it so if I delete some id's or rows, that the removed numbers will be refilled in? For instance right now I could have 100 rows where many of them previous and in between could be deleted. Then if a new entry comes along it is listed as 101, and it automatically gets stuck right in the middle of maybe 34 and 40 or really anywhere. It also makes it impossible to know how many total rows there are. It would be better if 35 had been deleted and then when a new row id came along it were listed as 35 again, instead of 101. Anyone know if this can be done? Thank you very much.
  5. Doh! I'm an idiot. I pulled a row that wasn't there! lol. Thanks for the extra error message.
  6. Hi, I'm getting hung up here on what is I'm pretty sure is a simple id problem. Not sure why and really need some help. This is the only part I think that's causing the problem. I'm just trying to pull a row based on what id number it is. $query = "SELECT comment FROM addthis WHERE `id` = '18'"; But here's the rest of the code if my code above looks ok, and maybe you can see where the problem following might be. <?php $link = mysql_connect('severaddress', 'database', 'password'); if (!$link) { die('Not connected : ' . mysql_error()); } $db_selected = mysql_select_db('database', $link); if (!$db_selected) { die ('Can\'t use database : ' . mysql_error()); } $query = "SELECT comment FROM addthis WHERE `id` = '18'"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { echo "$row[comment]"; } ?> $result says it is putting the query in the variable $result. while says "while $row has found a result put it in the echo." Hope someone can help, thanks.
  7. Believe me you are not alone, I myself was very frustrated with http when I first got it going, it took me months and it was a nightmare and few people helped me. I really believe there is something else wrong. Because it works for me every time, you just have to make sure a function is attached to it that works. What version of IE do you have? Also what browser are you using? Add this to the code I already gave you above, to the bottom of it and it should work. You have to upload your page with all this code in it. Then upload a page named testhttp.html as well. In testhttp.html stick in any old text. If its working it will add the text you put in testhttp.html and will put it in the div below named "countposts." If it doesn't work and no text was added let me know and I'll try to keep helping you for a bit until you get this working. I'll need you to try this though because http is so complicated it will take me too long to analyze your code when I already know this works. Then you can adjust whatever you need to fit to your own needs soon. But for now, first get this working and we'll go from there. Thats why a lot of people don't help with http, because reading the code is very difficult. Add to the bottom of my other code above. // Make the XMLHttpRequest object var http = myNewXMLobject(); function sendRequest(act) { // Open PHP script for requests http.open('get', 'testhttp?act='+act); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4 && http.status == 200){ // Text returned FROM testhttp.html var response = http.responseText; if(response) { // UPDATE ajaxTest content document.getElementById("countPosts").innerHTML = response; } } } function countPosts() { sendRequest('countPosts'); } </script> </head> <body onload="countPosts();"> <div id="countPosts" style="border:1px solid black;height:100;width:150;color: rgb(255, 255, 255)"></div> </body> </html>
  8. I can't pick through all your code but I know this code works in IE7. I'll gladly help because I know what a pain it is to get your http set up to work properly. This puts your http in a function though so that you can manipulate the function if you need it. I found if I didn't have my request in a function from the get go it messed me up. You will see at the end of this that it return the xmlhttp which means the http has been pulled and is then ready to go for the rest of your functions. You'll have to add the rest of your functions after the end of this. This is working code and works in all the important English browsers including IE.
  9. Great help~! Thanks a lot, seems everything new we try has some certain trick to it to get it to work. At least now I'll know what to try. Thanks for the great explanations that make a lot of sense.
  10. I appreciate the help, yes I was including the php tags with it, I'll try it without. Regarding the eval, looks like your using eval outside of the database? But you think eval is needed in order for the php to code properly? Thanks.
  11. Hi, does ajax work on browsers if people have disabled the javascript? Please let me know, thanks.
  12. I'm not sure what that is. I was trying to see if we can pull php from a database and have it still work. So outside of a my sql server database this works fine. But pulled from a database field it no longer works. <?php $string = "echo date('h:i:s');"; eval($string); ?> Wanted to know if normally working php code can also work when coming from a database?
  13. What part of it don't you like?
  14. Thanks, I went over to my girlfriends house who has a my sql server database and tried putting php in a database to see what would happen. I pulled it back out on the page with a select query. Normally working php that works when you put it on a regular php page, and nothing happened. Even though the code is exactly the same and looks exactly the same in the source code nothing happened at all. I even tried clicking on refresh to see if that would launch or update the php. Nothing still happened. I tried several different working php codes. So does anyone know of a way that php works coming from a database? I'm trying to understand this better because I thought I read in several places where individuals where using php in their database fields. Please let me know, thank you.
  15. Hello, can php code execute in a database before it appears on a page? For example the following code usually shows the current time. If this gets pulled from the database with query select and a timer will the current date appear still? I can't test it I'm away from a database for awhile. Please let me know, thank you very much. <?php $string = "echo date('h:i:s');"; eval($string); ?>
  16. I got it, I just colored the text. Thanks I'll send you something.
  17. Thats a unique approach. Downside is this is how it loads, with no image appearing because of it. http://www.website.com/%3Cimg%20src='/file02.jpg'%3E So I put this in the brackets and the double quotations instead. <img src="=<?php echo $imageurl; ?>"> Great thing is the images appeared! But now I have this on the viewing part of the page on both sides of the image. <img src=""> Anyone know how I can get rid of it? Once that is gone I'll be good to go. Thank you very much.
  18. I think I'm taking the wrong approach on this. The http request is calling another page called test.php. And putting it all in an id called "countposts." I'm trying to pull an image from that page. So basically I'm just trying to call whats in the page, not any text at all. So I think I can get rid of the text commands in the javascript and do something like this instead. But I think there is something missing in the getelement by id, like a src. command or something. Anyone know how to take an image from a php page and stick it in an id? function handleResponse() { if(http.readyState == 4 && http.status == 200){ document.getElementById("countPosts") setTimeout('countPosts()',2000); }
  19. Hello I have a function that returns text only. How would I adjust this if I wanted it to get images too? function handleResponse() { if(http.readyState == 4 && http.status == 200){ // Text returned FROM PHP script var response = http.responseText; if(response) { // UPDATE ajaxTest content document.getElementById("countPosts").innerHTML = response; setTimeout('countPosts()',2000); } I would imagine I would also add this document.getElementById("countPosts").src = response; But then I'm not sure what I would do with this--how would I add an image src to this next? var response = http.responseText; Please let me know, thank you very much.
  20. Perfect, I love it. I'll send you something.
  21. So for instance could you adjust this somehow? $delete = mysql_real_escape_string($_POST['id']); So that it takes the id number you enter into the form plus the 4 rows after the id, to delete 5 rows instead of 1? I already looked in the manual under limits and order by etc. and couldn't see how to delete more than one row. Thanks.
  22. toplay on your last date code. That limits how many entries can be added a day? It kind of looks like it doesn't. Tami.
  23. OK got it!! I used a combination of all of these, thanks a lot I'll send you something. Last question, I changed it to do by id. Is there anyway to enter more than one id so I can delete several at the same time? Its going to take a lot of time to do one at a time. Here's the working code doing one at a time.
  24. Very great suggestions thanks. Last thing I need help on then is how to move a field in the table to a different position. So lets say I have 10 fields in the table. The first field is named "date" and the last of the 10 fields is named "id." How to move id from the end to make it the first field instead? So it is listed before "date." Please get back to me, thank you very much.
  25. OK thanks, this database doesn't have any id numbers in it. Is there a way to see which id number there is? I don't see anything. Or do you have to set up the database to include number id's from the get go. The database asks how many rows I want to view, but as far as numbered id's go, I don't see any anywhere. Please get back to me, thanks.
×
×
  • 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.