Jump to content

lalabored

Members
  • Posts

    48
  • Joined

  • Last visited

    Never

Everything posted by lalabored

  1. I want to be able to replace [user: someperson] with a link that goes to the someperson's profile but I have no idea where to start...
  2. I need a function that is able to evaluate a string. For example, I have $var = "3+4*5", is there a function that can be like function($var) = answer?? It has to be able to recognize that 4*5 is done first.
  3. If I have a number like this... 1.67785581773E+12 is there a function to change it back to the way it was before as a normal number without the E or just make me able to enter it into MySql without the E...
  4. I don't understand... so you want the username that's returned from your query to be passed onto another page? You should use sessions for that. Go on Google and look for tutorials, good luck!
  5. Make a variable for the table row background colour and every time your mysql database spits out another row, you set the colour to something else, for example... $colour = "dodgerblue"; //Sorry, too lazy to find the hex code... while($row = mysql_fetch_array($rs)){ echo "<tr><td bgcolor='$colour'>$row</td.</tr>"; if($colour == "dodgerblue"){ $colour = "skyblue"; //Don't know if that's a real colour xD }else{ $colour = "dodgerblue"; } }
  6. I have a membership system and I want to implement time zones so that users can choose their own time zones and the times in my database will be different for users of different time zones. How would I do this? Please help! Thanks!
  7. Make a form with a input button that calls an AJAX function using onclick function. Then in the AJAX function, use the .open("GET", "php_file_name" + input_fields, true); and .send(null); to call a php file which would do that. You have to obviously pass the info from the forms into a PHP file's address so it can get the data. Then use php to do the rest. I don't see why you didn't just go with straight forward PHP. ??? After PHP gets the data, how could I put the data in such a way in the responsetext so that I can use javascript to insert a new row into my table? I am inserting data into a form, that form uses ajax to insert data into a database and then I need it to return the new data inserted in a formatted form and then insert it as a new row in the table that's already on the page without refreshing the page.
  8. I have information in the form of name, details and date due in my database. How can I retrieve the data from the database as ajax response text and insert it as a new row in a table with a column for name, details and date due?
  9. Nevermind... I figured it out, I never knew you were able to compare dates using the greater than and less than signs ^^;;
  10. I need a query that deletes rows with dates that have already passed. I'm storing dates in the future in my MySql database and I want the rows to be deleted when those dates have passed, how so I make a query that does that? I tried this... DELETE FROM mytable WHERE TIME_TO_SEC(SUBTIME(release_date,NOW())) <= 0 But it doesn't work so now I'm stuck, please help me.
  11. But how would I compare something made from date() to a MySql date that's like this "0000-00-00 00:00:00"?
  12. That didn't work =S I tried using this... $old = mktime(0, 0, 0, date("m"), date("d")-1, date("Y")); $q = "SELECT * FROM `p_messages_sent` WHERE UNIX_TIMESTAMP(sentdate) < $old"; $rs = mysql_query($q); ..to get rows that were older than 1 day (because I didn't have anything older than 30 days) but that didn't work =\
  13. I have a MySql table with the field "sentdate". How could I set up a query that selects only entries that have a sentdate that is for example 30 days old?
  14. Yes, I checked that, this is what I used. This works... <script type="text/javascript"> var checkflag = "false"; function check(field) { if (checkflag == "false") { for (i = 0; i < field.length; i++) { field[i].checked = true;} checkflag = "true"; return "Uncheck All"; } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } checkflag = "false"; return "Check All"; } } </script> <input type="button" onclick="this.value = check(document.getElementsByName('pm[]'));" value="Check All"> This doesn't work... <script type="text/javascript"> var checkflag = "false"; function checkAll(field) { if (checkflag == "false") { for (i = 0; i < field.length; i++) { field[i].checked = true;} checkflag = "true"; return "Uncheck All"; } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } checkflag = "false"; return "Check All"; } } </script> <input type="button" onclick="this.value = checkAll(document.getElementsByName('pm[]'));" value="Check All"> I don't see any difference yet it doesn't work, I don't understand why... I'm using Firefox if that helps.
  15. When I use this code, it works fine... var checkflag = "false"; function check(field) { if (checkflag == "false") { for (i = 0; i < field.length; i++) { field[i].checked = true;} checkflag = "true"; return "Uncheck All"; } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } checkflag = "false"; return "Check All"; } } However, when I use this... var checkflag = "false"; function checkAll(field) { if (checkflag == "false") { for (i = 0; i < field.length; i++) { field[i].checked = true;} checkflag = "true"; return "Uncheck All"; } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } checkflag = "false"; return "Check All"; } } It doesn't work. Is there something about Javascript that does this?
  16. I need a check all button that will work with this... <input type="checkbox" name="check[]" value="1"> All the check all scripts I've found only work with name="check" and it doesn't have the brackets. I need to check all of the fields with the brackets, how can I do this?
  17. I'm really new to Ajax (I just started today). My code below isn't working... can somebody tell me why? Basically what it's supposed to do is it deletes a wall post from the database then it updates the div "wall_posts". <script> function ajaxFunction() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } function delete_wall_post(id,user){ var ajax = ajaxFunction(); if(ajax=null){ alert("Your browser does not support Ajax!"); return; } ajax.onreadystatechange=function(){ if(ajax.readyState==4){ var display = document.getElementById('wall_posts'); display.innerHTML = ajax.responseText; } } var url = "wall_delete.php"; url = url + "?id=" + id + "&user=" + user; ajax.open("GET", url, true); ajax.send(null); } </script> This is my delete link... <a href="javascript: if(confirm('Are you sure?')){ delete_wall_post(<?php echo $row['id']; ?>,'<?php echo $_GET['user']; ?>')}">Delete</a>
  18. Ah! I checked to see if $rs returned false and it did. I found my mistake I think. I put the variables in single quotes while they are integers so I guess that messed it up. Thank you for you help.
  19. I get this error... Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in readpm.php on line 22 With this code $q = "SELECT * FROM pm_messages WHERE id='$id' and to_id='$memberid' LIMIT 1"; $rs = mysql_query($q); $rscount = mysql_num_rows($rs); Can someone tell me what's wrong?
  20. But is there any extremely large disadvantages? If a MySql database has a lot of information, won't it load slowly as well?
  21. Is it okay to not use MySql and just use flat file databases to power a user management thing? I don't have any problems using flat file databases and I was just wondering if there are any major disadvantages. Do all large sites use MySql databases and is there actually any large site that uses flat files?
×
×
  • 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.