Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
adding checkbox value to php array on click
Philip replied to tryingtolearn's topic in Javascript Help
No, it's just because there aren't many people that help on the ajax forums. So what you're wanting to do (want to make sure this is correct), the page displays X results with a checkbox by each one. Whenever the user is ready, they click the next page - but then you lose all the checks on the previous page, correct? I see 2 different ways to go through this. It really depends on how your page is setup. Does your page get the results via AJAX, or a full page reload? (in other words, does it update one section of your page, or the whole page when they load the next set of results)? -
What does the rest of your js script look like?
-
Yes you can do multiple requests. It's kinda like a send and forget thing - you can send it, and do other things while you're waiting on the reply.
-
If you want it in the format "Year+Make+Model" $vehicles_oodle["title1"]=$veh["int_1"]."+".$veh["v_255_9"]."+".$veh["v_255_10"];
-
chronister, I'm not sure what you're trying to accomplish. I find it ironic that you had more errors when you put in your own style <?php $mysql_b = "SELECT * FROM links_b ORDER BY pos, naam ASC"; $sql_b = mysql_query($mysql_b); while ($links_b = mysql_fetch_array($sql_b)) { $naam = stripslashes($links_b[naam]; // need semi-colon here, indent code to make it easier to read -- you're missing a ) ) // no semi-colon here -- what?! echo '<a href="rubriek.php?rubriek='.$links_b[id].'">'.$naam.'</a>'; // use apostrophes around html strings and concatenate the variables in them -- but this is outside the loop // you had an extra } down here -- yeah, it was needed ?> This is all that was needed: <?php $mysql_b = "SELECT * FROM `links_b` ORDER BY `pos`, `naam` ASC"; $sql_b = mysql_query($mysql_b); while ($links_b = mysql_fetch_array($sql_b)) { $naam = stripslashes($links_b['naam']); echo '<a href="rubriek.php?rubriek='.$links_b['id'].'">'.$naam.'</a>'; } ?> Simple fix.
-
In your ajax.js script - you have something like: if (ajaxreq.status == 200) { if (ajaxCallBack) { ajaxCallBack (); } } Somebody correct me if I'm wrong, but it is trying to call a function called ajaxCallBack, not displayResults(); Hmmm, I don't really know what to suggest here, besides hard coding the ajaxResponse function (it's what I do)
-
<?php $veh["title"] = $veh["int_1"].$veh["vmake"].$veh["vmodel"]; ?>
-
Wow! That is insane, the difference is just unbelievable IE7 Test 1: 25,516 Test 2: 61 FF3 Test 1: 55 Test 2: 28 Chrome Test 1: 14 Test 2: 6
-
You're missing an ending a " onclick = "getData('upalbum.php', 'formload');"
-
Well, as long as your PHP version is up to date you can use it. Connection: <?php $mysqli = new mysqli('localhost','user','pass','database'); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } ?> Multi-query: <?php $query = "SELECT * FROM `users` WHERE `id`='5';"; $query.= "SELECT * FROM `sometable` WHERE `live`='1' "; // etc... just seperate the queries with a semicolon if ($mysqli->multi_query($query)) { // DO - so that the first query gets done first... do { /* store first result set */ if ($result = $mysqli->store_result()) { while ($row = $result->fetch_row()) { echo $row[0]; } // Free result $result->free(); } // if there are more results, print a divider if ($mysqli->more_results()) { echo '-----------------<br />'; } } while ($mysqli->next_result()); } ?>
-
I know you're wanting to make your own.... but have you tried mysqli? It has a multi query option. http://php.net/mysqli
-
[SOLVED] MYSQL Select minus 6 hours, SQL working but not in PHP.
Philip replied to PHPKevin's topic in PHP Coding Help
<?php echo 'Start<br />'; $sql = "SELECT DISTINCT request , first_name FROM request WHERE request BETWEEN NOW()- INTERVAL 6 HOUR AND NOW() GROUP BY id"; $hour = mysql_query($sql) or die('Query failed: ' . mysql_error()); echo 'Num of rows: '.mysql_num_rows($hour).'<br />'; while ($noresponse = mysql_fetch_array($hour)) { echo '<pre>'; print_r($noresponse); echo '</pre>'; //echo $noresponse["first_name"]; echo '<br>'; } echo 'End'; What does output? -
I'm 99.99% sure that you have to delete each file individually, then delete the folder when it's empty. However, depending on your system setup, you might be able to get away with some server commands. Example: <?php $pathto = '/home/user/public_html/images/iwanttodeletethis/'; system ("rm -Rf $pathto") ; ?> That should delete the folder and all the contents, given your running the correct os
-
Why not just use GET variables? Instead of the form/submit button: <a href='result.php?name=corina_account_request'>Corina account request</a> In the PHP file: <?php mysql_connect ("localhost","user","pass") or die (mysql_error()) ; mysql_select_db ("kb") or die (mysql_error()) ; $search = $_GET["name"]; // make sure to clean this variable - running the risk of SQL injection ?> <table border="1" cellpadding="0" cellspacing="0"> <tr> <td>Id</td> <td><?php $sql = mysql_query ("SELECT * FROM subjects where Subject = '$search' ") ; while ($liste = mysql_fetch_array($sql)) { echo $liste[0]; } mysql_free_result($sql); ?></td> </tr> If you don't like my way, thats fine. You do have a missing semicolon though (in result.php): $search = $_POST["name"] Oh, and next time, don't forget the [ code ][/ code ] tags It makes it easier on us to read your code.
-
As seen in the header page in the PHP manual: <?php $filename = "theDownloadedFileIsCalledThis.mp3"; $myFile = "/absolute/path/to/my/file.mp3"; $mm_type="application/octet-stream"; header("Cache-Control: public, must-revalidate"); header("Pragma: hack"); // makes it no-cache basically header("Content-Type: " . $mm_type); header("Content-Length: " .(string)(filesize($myFile)) ); header('Content-Disposition: attachment; filename="'.$filename.'"'); header("Content-Transfer-Encoding: binary\n"); readfile($myFile); ?> I haven't tested it 100%, but I'm pretty sure it works. Basically it just takes the mp3, and echos the contents to this page - which since you sent the headers saying it's a mp3 and not a page.... it'll play the song.
-
To open the popup you could pass a variable (via GET/POST [side note: make sure if you use either of those to check to make sure the user has permissions to edit that comment, because they can be easily faked] or a server-side session) when opening the page, whether via target='_blank' for new page, or using javascript's window open method. var newWindow; function popwindow(url) { if (parseInt(navigator.appVersion)>3) { if (navigator.appName=="Netscape") { winW = window.innerWidth; winH = window.innerHeight; } if (navigator.appName.indexOf("Microsoft")!=-1) { winW = document.body.offsetWidth; winH = document.body.offsetHeight; } } var scrollbars = ",scrollbars=0,"; if(winW<(winWidth+5) || winH<(winHeight+5)) { //alert("You will have scrollbars. Your inner height and width are as following: \n"+winW+" by "+winH); scrollbars = ",scrollbars=1,"; winWidth = 800; winHeight = 600; } var data = 'height='+winHeight+',width='+winWidth+scrollbars+'location=0,status=0,directories=0,toolbar=0,menubar=0,resizable=1'; newWindow=window.open(url,'name',data); if (window.focus) {newWindow.focus()} } <a href="popup.php?id=6" onclick="popwindow('popup.php?id=6'); return false;" target="_blank">popup</a> On the popup page, have it pull data from the database - and auto populate the fields. Then use an onClick or form action to submit the form. If you know your users will have javascript enabled - using the window.open and onClick would be the fastest, and nicest way. However, being able to fall back onto the target='_blank' and form action is 100% needed if you are not sure if your users have javascript enabled. Hopefully thats what you're looking for
-
Simple Google search pulls up the following: http://www.brandspankingnew.net/specials/ajax_autosuggest/ajax_autosuggest_autocomplete.html Try it out - let me know if you have any problems... because that should work just fine for your needs.
-
how can I make my page feel with database ?
Philip replied to elhelaly1999's topic in Javascript Help
Periodically check the database to see if it updates. Your ajax script would have to do that at timed intervals - there isn't a way for the database to tell the user that it was updated. Example: Person A loads the 'check database' script Person A's page automatically checks the database - nothing new, so do nothing Person B adds a new row Person A's page automatically checks the database - one new row, let user know. ... Person A's page automatically checks the database - nothing new again, do nothing ... -
I'm not quite sure what you're trying to do here - but it looks like execute a PHP filled javascript file after the page has loaded. Is that correct?
-
Kinda hard to look when you took it down A few things I wanted to point out to you: ajaxgetshoutbox.php There is a JSON encode function in PHP - which is really handy, especially if you decide to expand and add another field or two later on. send_message.php MySQL injection anyone? Now back to the real question, when you say the operation stops - does the php side or the js side stop?
-
Pretty much. Actually PHP is/was written in C - so you'll notice a lot of similarities
-
Well, #rowset1 { width:600px; height:170px; border:1px #F3EDED solid; margin-left:auto; margin-right:auto; } #link1 { border:1px #F3EDED solid; width:200px; height:150px; text-align:center; padding-left:10px; padding-right:10px; margin:10px; } Did you want them next to each other correct? If not - your heights for the row is 170 and then for link1 is 150. If so - take a look at using a float in that case.
-
I'm not real sure what your problem is... but I'm going to try: So, this would be more of an AJAX question - since you want to retrieve data from the other website and display it on yours, without refreshing the page. Correct? If so, have ever done any AJAX requests before? If not, maybe you can help me out by explaining the question/problem again
-
Last time I checked you couldn't get the file size before you started uploading. I know you can use ActiveX for that (but yuck!). But Javascript doesn't have access to local files, which in a way is a very good thing
-
Personally, I voted for kl. @OP: What kind of problem are you running into?