Jump to content

robs99

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Everything posted by robs99

  1. hello, thanks for the replies. the thing is i dont want to hide the div before it loads, i just want it to scroll to the "new" height of the loaded content. i know it works if i scroll it up, load the content and then scroll it down. but i want to find a way to do this without having to hide or scroll the div up. its hard to explain what im trying to achieve, i hope you understand what i mean thanks in advance
  2. Hey, im trying to load new content through ajax in a div and instead of showing all the new content at once i want the div to slowly slide down and reveal the new content. For some reason its not working, the new content gets loaded and its shown at once. Here is a demo: http://gator1016.hostgator.com/~youtubed/test/ And here is the JS code: function loadnew() { $('#divcontent').html('<img src="ajaxbar.gif">'); $.ajax({ url: 'ajaxcontent.php', success: function(data){ $('#divcontent').html(data); $('#divcontent').slideDown('slow'); } }); } Any ideas? Thanks in advance
  3. i just checked and there are no binary logs isnt there a way to recover it from the hard drive just like when you recover deleted photos etc?
  4. hi, i have a problem..i clicked the empty button in phpmyadmin in the wrong table and it deleted every row without a confirmation. is there any way to undo this? i already asked my hoster and he said that he only does daily backups shared hosters but not on VPS. my backup is from january so i really need a way to undo this if possible thanks in advance
  5. i cant find the edit button so im going to make another reply.. here is a code example to make it easier to understand: <div id="progressbar"></div> $('#progressbar').progressbar({value: 0}); $('#divAjax').load('addtomysql.php'); addtomysql.php: for ($i=1;$i<=5;$i++) { mysql_query("INSERT INTO test (something) VALUES ('bla')"); $percentage = $i / 5 * 100; echo '<script type="text/javascript"> $('#progressbar').progressbar('option', 'value', " . $percentage . "); </script>'; } since the addtomysql.php file is loaded once its completed it just updates the progressbar to 100%..
  6. Hello, ive got a slight problem. I'm trying to load a php file with jquery using load() to write entries to a mysql database. I want to keep track of the progress and update a progress bar while the entries are being written. The problem is that all the javascript code inside the php file im loading wont be executed until the file is completely loaded (after all the entries have been written to the db). Is there a way to change the load() function to display the content while its loading and not wait until its finished? I hope you can help me out Thanks in advance Rob
  7. Hey, i'm trying to build a video streaming site. Everything works good so far, except for one thing. I want users to be able to "jump" around the timeline, so users can browse through the video before its fully loaded. Alot of sites (like youtube) have this feature, for some reason its not working on my site. Here is the video player: http://www.pajasof.com/media/player/player.swf?f=http://www.pajasof.com/media/player/config.php?vkey=5 I hope you guys can help me Thanks in advance
  8. hey, ive got problem. im trying to kind of combine 2 tables in one query. ive searched and tried to look at examples but i didnt get it to work lets say i have 2 tables. one with posts which looks like this: posts: post_id, content, author and one which saves the post-id of a flagged post and the user-id of the user who flagged it flags: post_id, user_id what i want to do is show whether a post has been flagged or not in one query. lets say display the output like this: post_id, content, author, flagged (flagged can be true or false) is there a way to do is? sorry for sounding so confusing ive tried to find a solutions for the past 3 hours and my head is about to burst...
  9. both fields are varchars (deleted contains the name of the user who deleted it)
  10. Hello, i have a problem with a mysql query. this is my query: SELECT * FROM `posts` WHERE `bandname` LIKE '%something%' OR `title` LIKE '%something%' AND `deleted` = '' AND `approved_by` != '' ORDER BY `date` DESC , `id` DESC LIMIT 0 , 30 im trying to perform a search (my search parameter is 'something'). the results show up properly, but it ignores the rest of the query. deleted and unapproved posts still show up for some reason...any ideas? thanks in advance
  11. hey, i'm doing it manually. how exactly would the eval() work? ive tried to eval the responseText but then the loading state gets stuck at 2. here is my js code: function ShowNewReleasesAjax(start,divnumber) { var ajaxRequest; try{ ajaxRequest = new XMLHttpRequest(); } catch (e){ try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser broke!"); return false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById("DivNewReleases" + divnumber); ajaxDisplay.innerHTML = ajaxRequest.responseText; } else { var ajaxDisplay = document.getElementById("DivNewReleases" + divnumber); ajaxDisplay.innerHTML = '<br><br><br><br><br><br><image src=\"php/ajax-loader.gif\">'; } } ajaxRequest.open("GET", "php/releases.php?start=" + start + "&divnumber=" + divnumber, true); ajaxRequest.send(null); }
  12. hey, thanks for the fast reply. i tried it but it didnt work either i still have to call the function through javascript:runme(); right?
  13. Hello, i'm trying to load a php file through AJAX which accesses a mysql db. the php file loads fine, but for some reason i can't run any javascript functions inside the file. here's the code of the php file: <?php include ('sql.php'); if (!$_GET[start]) { $_GET[start] = 0; } $result = mysql_query("SELECT * FROM `posts` WHERE `post_content` NOT LIKE '' AND `post_status` NOT LIKE 'draft' AND `post_status` NOT LIKE 'inherit' $sqlsearch ORDER BY `post_date` DESC , `ID` DESC LIMIT $_GET[start] , 1"); if (mysql_num_rows($result) == 0) { echo "Sorry, no posts found. Please search for something else.<br>"; } while($row = mysql_fetch_array($result)) { echo "$row[post_title]<br><br>"; if ($row[genre3]) { echo "$row[genre1] - $row[genre2] - $row[genre3]"; } elseif ($row[genre2]) { echo "$row[genre1] - $row[genre2]"; } else { echo $row[genre1]; } echo "<br><br><br><a href=\"javascript:runme();\">Run Me</a>"; } ?> <script type="text/javascript"> function runme() { alert ('test'); } </script> any ideas why the runme function doesnt run? if i access the file directly the function works fine. stuff like <a href="javascript:alert('test');"> works aswell. You can view the script in action here: http://it-leaked.com/v4test/ thanks for the help if you need any other files let me know
  14. Hey, i was wondering if anyone can help me out. I have a simple ajax shoutbox which works fine on firefox & chrome, but fails to send or receive data on IE. does anyone have any suggestions? here's a live example, you'll see it's working fine on FF & chrome: http://www.it-leaked.com/ajaxsb.php here is the code: 1 2 //start the session 3 session_start(); 4 ?> 5 6 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 7 <html xmlns="http://www.w3.org/1999/xhtml"> 8 <head> 9 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 10 <title>Shoutbox</title> 11 <style type="text/css"> 12 body 13 { 14 font-family: Verdana; 15 font-size: 7pt; 16 } 17 .shout 18 { 19 margin: 5px; 20 } 21 #scroll_box 22 { 23 overflow: auto; 24 height: 120px; 25 width: 460px; 26 border: 1px solid #333; 27 margin-top: 3px; 28 } 29 </style> 30 <script type="application/javascript"> 31 var xmlHttp; 32 33 function getShouts() 34 { 35 xmlHttp = GetXmlHttpObject(); 36 if (xmlHttp == null) 37 { 38 alert("Could not create a XmlHttpObject"); 39 return; 40 } 41 //set the get url var 42 var url="shoutbox.php?q=get"; 43 xmlHttp.onreadystatechange = stateChanged; 44 45 //open the $_GET['get'] page 46 xmlHttp.open("GET",url,true); 47 xmlHttp.send(null); 48 } 49 50 function insertShout() 51 { 52 xmlHttp2 = GetXmlHttpObject(); 53 if (xmlHttp2 == null) 54 { 55 alert("Could not create a XmlHttpObject"); 56 return; 57 } 58 if (document.getElementById("shout").value == "" 59 || document.getElementById("shout").value == null) 60 { 61 alert("ERROR: No shout entered."); 62 return; 63 } 64 //set the get url var 65 var shout = document.getElementById("shout").value; 66 var url = "shoutbox.php?q=insert&shout="+shout; 67 xmlHttp2.onreadystatechange = stateChanged; 68 69 //open the $_GET['get'] page 70 xmlHttp2.open("GET",url,true); 71 xmlHttp2.send(null); 72 73 getShouts(); 74 document.getElementById("shout").value = ""; 75 } 76 77 function stateChanged() 78 { 79 if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") 80 { 81 //fill the div scroll box with the formatted shouts or "xmlHttp.responseText" 82 document.getElementById("scroll_box").innerHTML = xmlHttp.responseText; 83 } 84 } 85 86 function GetXmlHttpObject() 87 { 88 var xmlHttp = null; 89 try 90 { 91 //Firefox, Opera 8.0+, Safari 92 xmlHttp = new XMLHttpRequest(); 93 } 94 catch (e) 95 { 96 //Internet Explorer 97 try 98 { 99 xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); 100 } 101 catch (e) 102 { 103 xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 104 } 105 } 106 return xmlHttp; 107 } 108 109 //get the shouts for when the box is loaded initially 110 getShouts(); 111 112 function runme() 113 { 114 getShouts(); 115 setTimeout("runme()",3000); 116 } 117 118 setTimeout("runme()",3000); 119 </script> 120 </head> 121 122 <body> 123 124 125 126 //mysql info 127 $db_host = "REMOVED"; 128 $db_name = "REMOVED"; 129 $db_username = "REMOVED"; 130 $db_password = "REMOVED"; 131 132 //connect to the database 133 $conn = mysql_connect($db_host,$db_username,$db_password) or die(mysql_error()); 134 mysql_select_db($db_name, $conn) or die(mysql_error()); 135 136 //set the timezone for the script 137 putenv("TZ=America/Los_Angeles"); 138 139 //number of shouts to display 140 $i = 50; 141 142 //function to query the database for the shouts. only parameter is amount of shouts 143 function get_shouts($i) 144 { 145 //the sql query to pull all the info from table `shoutbox` 146 $sql = mysql_query("SELECT * FROM 2 ORDER BY id DESC LIMIT $i"); 147 148 //while there are still rows to assign to the $row var, do it 149 while ($row = mysql_fetch_array($sql)) 150 { 151 //set the row vars 152 $user = $row['user']; 153 $shout = $row['shout']; 154 $time = $row['timestamp']; 155 156 //echo the formatted shouts 157 echo "<div class=\"shout\">".$user." [".$time."]<br />".htmlentities($shout)."</div>\n"; 158 } 159 } 160 161 //function to insert the shouts 162 function insert_shout($user,$shout,$time) 163 { 164 $shout = mysql_real_escape_string($shout); 165 mysql_query("INSERT INTO 2 (user,shout,timestamp) VALUES ('$user','$shout','$time')"); 166 } 167 168 //url system for $_GET querys 169 if ($_GET['q'] == "archive") 170 { 171 //archive page 172 echo "<!--archive-->\n\n"; 173 } 174 elseif ($_GET['q'] == "get") 175 { 176 //get query 177 echo "<!--get-->\n\n"; 178 179 //get the formatted shouts while var $i is the amount of shouts to display 180 get_shouts($i); 181 } 182 elseif ($_GET['q'] == "insert") 183 { 184 //insert query 185 echo "<!--insert-->\n\n"; 186 187 //get the username, shout and set the timestamp and then insert it all into the database 188 insert_shout($_SESSION['user'],$_GET['shout'],date("g:i a")); 189 } 190 else 191 { 192 //default page 193 echo "<!--default-->\n\n"; 194 195 if (isset($_SESSION['user'])) 196 { 197 echo "Welcome, ".$user = $_SESSION['user']; 198 } 199 else 200 { 201 $_SESSION['user'] = "Guest"; 202 echo "Welcome, ".$user = $_SESSION['user']; 203 } 204 205 //echo the form and fill the div scroll box with the formatted shouts 206 echo "<br /><input type=\"text\" size=\"55\" id=\"shout\" /> 207 <input type=\"button\" value=\"Submit Query\" onclick=\"insertShout();\" /> 208 <div id=\"scroll_box\"></div>"; 209 } 210 211 ?> 212 213 </body> 214 </html> I hope someone can help me thanks in advance
×
×
  • 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.