- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 33
- Posts with Upvotes
- 31
- Upvoting Members
- 26
- Downvotes Received
- 3
- Posts with Downvotes
- 3
- Downvoting Members
- 3
Software Engineer99X Technology www.99XTechnology.com Sri Lanka
- Interests
- Music & Movies
- PC Specs
- Ubuntu
118 Posted Topics
Hi All, I have a PHP code which do some changes to the POST variables it receives and redirect the page to some other page. This PHP code was initially designed to work without Ajax. So there wasn't any problem with the redirect function and it perfectly handles the POSt … | |
Re: I found a sample XML file by searching. So I wrote a small php code to read it. I hope this example will help you. <?php // Loading the XML file $xml = simplexml_load_file("books.xml"); echo "<h2>".$xml->getName()."</h2><br />"; foreach($xml->children() as $book) { echo "BOOK : ".$book->attributes()->id."<br />"; echo "Author : ".$book->author." … | |
Re: Following is my Java version I got by running `java -version` and you code perfectly compiled for me java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) Client VM (build 25.45-b02, mixed mode) | |
Re: `mysql_query()` returns a resource on success, or FALSE on error. So better if you can check for that before calling mysql_num_rows() if($query) { if(mysql_num_rows($query)==0) { die("User not found"); } else { $row = mysql_fetch_assoc($query); //other code } } else { die("Invalid Query"); } | |
Re: In the `KeyPress` event of the textbox1 text box, check for the text length. When text length is equal to 5 set the focus to textbox2 using `Focus()` method | |
Re: You are missing the `WHERE` clause in the query $query="UPDATE va SET id_key='$id' WHERE id_key='".$row['id_key']."'"; | |
Re: Try to separate the JavaScript. That will look nice =) <script> function redirect(rowID) { window.location="delete_article.php?id="+rowID; } </script> <?php echo "<input type='submit' name='submit' id='submit' class='btn btn-primary' value=Cancella onclick='redirect(\"".$rowId."\");'/>"; ?> | |
Re: There are couple of errors I found in your code... 1. You have to import io and util packages in order to use I/O related classes and ArrayList class import java.io.*; import java.util.*; 2. You don't have to put "String" in between variables when declaring them static private String cID, … | |
Re: In the event handler which handles the Click event for the Menu Item, you can set the status bar information. Protected Sub ChangeEnv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChangeEnv.Click 'Set the Status Bar Information by iterating child forms here End Sub I think you can use the … | |
Re: Try and see whether this works for you $t = time(); if(date("H",$t) < 12) { // Say Good Morning } else { // Say Hello } | |
Re: What would you expect as a result for the following sequence of integers? 1 2 3 6 7 8 11 | |
Re: As I understood, you want to have nested combo boxes where the child combo box gets repopulated when the parent combo box gets changed. I am sorry if I misunderstood your question. | |
Re: $(document).ready(function(){ $(".box).show(); }); | |
Re: I found a way, but little bit messy. Dim numLIst As New List(Of Integer) If Not numLIst.Contains(Number1) Then numLIst.Add(Number1) End If If Not numLIst.Contains(Number2) Then numLIst.Add(Number2) End If If Not numLIst.Contains(Number3) Then numLIst.Add(Number3) End If If Not numLIst.Contains(Number4) Then numLIst.Add(Number4) End If If Not numLIst.Contains(Number5) Then numLIst.Add(Number5) End If Dim … | |
Re: You can generate the IDs using couple of variables string empPrefix = "EMP"; int counter = 0; public string getNewID() { counter = counter + 1; return empPrefix + counter.ToString("D4"); } | |
| |
Re: You are missing a space in following places Use echo "<option value = $M "; instead of echo "<option value = $M"; Use echo "<option value = $n "; instead of echo "<option value = $n"; Use echo "<option value = $n "; instead of echo "<option value = $n"; | |
Re: This is new to me too. Found this after googling -> http://www.phpini.in/php/php-incomplete-class-object.html | |
Re: I have no idea what InputWrapper is, but I change the code little bit to update the year value inside the loop which you have missed in your code Console.WriteLine("Enter -1 at any time to terminate the program"); string read = Console.ReadLine(); int year = Convert.ToInt32(read); while (year != -1) … | |
Re: Your requirment can be achieved by a foreach loop. I just used an echo for the merge, but u can insert the values to another array as you wish. <?php $arr = Array ( "certificate" => Array ( "name" => Array ( 1 => 11, 2 => 22, 3 => … | |
Re: Try starting the session at the top `<?php session_start(); ?>` And **$_SESSION** should be in uppercase | |
Re: You are checking the `$_POST['submitset']` in the PHP code if(isset($_POST['submitset'])) But, in the $.post you are not including that value $.post(url,{oldans: oldanswer.val(), newquest: newquestion.val(), newans: newanswer.val()}, function (data) { ... } So `if(isset($_POST['submitset']))` always returns `false` Try this: $.post(url,{oldans: oldanswer.val(), newquest: newquestion.val(), newans: newanswer.val(), submitset: "true"}, function (data){ ... } | |
![]() | Re: You code snippet should work fine. Are you getting an error? FYI : `session_start();` must be the first thing sent to the browser, or it won't work properly. Make sure you are not sending anything to the browser before the `if` clause. |
Re: Will you be able to post the 'txtShow' function too? Where do you update the $_SESSION['schp'] variable? If you are trying to do a string concatanation in the for loop, you are missing the '.' before the equal sign. `$sch .= $_SESSION['schp'][$i]. "; ";` | |
Re: Since I have no idea about the structure of your table, i have written following as a sample. Modify it as you wish **HTML** <table> <tr> <td>R1_C1</td> <td>R1_C2</td> </tr> <tr> <td>R2_C1</td> <td>R2_C2</td> </tr> </table> **Javascript** $("table").each(function(){ $("tr", $(this)).each(function(){ $("td", $(this)).each(function(){ console.log($(this).html()); }); }); }); | |
Re: Will you be able to post the code you have written so far with a sample text file? | |
Re: Try using "http://" infront of the URL <tr> <td> </td><td> </td><td align="right" valign="top"><b>Full Text Link :</b></td> <td align="left" valign="top"><a href='http://<?php echo $FULTEXT;?>' target='_new'><?php echo $FULTEXT;?></a></td> </tr> | |
Re: `document.getElementsByTagName("*")` returns all the tags. Following is the list which it returns * html * head * body * p#demo * div#original * button * script | |
Re: What is the error you are getting? I think you do not have to put the 1st forward slash in [B]^/100bestbuy/search-(.*)/$[/B] ![]() | |
Re: Interesting point :) I tested you code and added some more lines var array = ["hello", "world", "daniweb"]; alert(array.length); // this will give you three console.log(array); // ["hello", "world", "daniweb"] array.length = 10; // Here is the line that changes the value of length alert(array.length); // this will give 10 … | |
Re: What is the problem you are having with **`require_once`** ? | |
Re: > ITS ALL ABOUT RECURSION This is a basic UI question right?? | |
Re: Put a **`var_dump`** above the foreach loop and make sure it has data var_dump($resultViewed); If **`$resultViewed`** has data, put a **`var_dump`** inside the loop and check what is in **`$results`** foreach($resultViewed as $results) { var_dump($results); $stringResult = $stringResult . "['".$results['name']."',".$results['quantity']."],"; } Let's see what's in those variables first and then … | |
Re: Try using **`mysqli_fetch_assoc`** instead of `mysqli_fetch_array` | |
Re: Check this thread : http://www.daniweb.com/web-development/php/threads/427263/extract-data-from-an-xml-file-and-display-it-in-php My example might help you. If not feel free to reply :) | |
Re: Try, $strTemp = preg_replace('/<|>|\||%|;|\(|\)|&|\+|-|:|\x24|@/i', '', $strTemp); NOTE: **`\x24`** will replace **`$`** sign | |
Re: You can not call a non-static method like that Try changing **`Main.setPage(2);`** in **PwGUI.java** to, Main m = new Main(); m.setPage(2); | |
Re: I changed your URLs into Google and Facebook, just to make sure other parts are working and it worked. <script language="JavaScript"> function goto(form) { var index=form.select.selectedIndex if (form.select.options[index].value != "0") { location=form.select.options[index].value; } } </script> <FORM NAME="form1"> <SELECT NAME="select" ONCHANGE="goto(this.form)" SIZE="1"> <OPTION VALUE="">-------Choose a Purpose------- <OPTION VALUE="http://www.google.com">Google</option> <OPTION SELECT="SELECTED" VALUE="http://www.facebook.com">Facebook</option> … | |
Re: > "SELECT * FROM locations WHERE title LIKE '%".$input."%'"; > > The "SELECT * FROM locations" query only does give me the full table but using that input variable substitution (from an input field) kills my query and returns nothing. (yes the tables are full and contain matches haha) Just … | |
Re: Actually I am not sure why you did something like this: > `if((checkmemory($user,$ayat)==0) || !(checkmemory($user,$ayat)==0))` It is always `true` right? So you are always trying to insert **user_id** and **ayat** without considering what `function checkmemory($user,$ayat)` returns If **user_id** is the primary key your `INSERT` will fail when trying to insert … | |
Re: Try it just by making **null** a string if('null' == a) | |
Re: You can not apply different formatting to different parts of the same textarea, i.e. you can not make some text bold and some text italic at the same time inside a textarea. It does not identify html tags as html tags when you put in between textarea tags. So that … | |
Re: The mistake in your javascript function is, you are giving the same **"name"** to every input you dynamically create. Try assigining input element's **name** and **id** as below element.name = "testname_"+table.rows.length; element.id = "testname_"+table.rows.length; Now you can refer each input value by echo $_POST["testname_1"]; echo $_POST["testname_2"]; echo $_POST["testname_3"]; ... | |
Re: Just use, border:2px solid red; border-radius: 5px; | |
Re: I am not sure whether I understood your question correctly. Do want to make sure the GET and POST variables sent from client side to the server are not altered inbetween? If so how about generating a hash value? Sorry if I misunderstood your question | |
Re: `$data` is a result object. You have to fetch array from it like follows $row = mysql_fetch_array($data, MYSQL_ASSOC); $marks = $row['marks']; echo $marks; OR you can replace `$row = mysql_fetch_array($data, MYSQL_ASSOC);` by `$row = mysql_fetch_assoc($data);` | |
Re: Split the String from `[` and `]`. Then from 0th and 4th indexes you can get what you want | |
Re: I think what you need is automatic page refresh using javascript Following javascript function will do the trick <head> <script type="text/JavaScript"> function refreshPage(timeoutPeriod) { setTimeout("location.reload(true);",refreshPage); } </script> </head> Do the initial call in body onload <body onload="JavaScript:refreshPage(5000);"> | |
Re: You can do something like in the following code <?php $comboText = "1-7 Jan 2012"; // Categorizing the weeks $weeks = array('1-7', '8-14', '15-21', '22-28', '29-31'); $comboTextArray = explode(' ',$comboText); $weekNumber = array_search($comboTextArray[0], $weeks); if($weekNumber >= 0) { echo "Week".($weekNumber+1).$comboTextArray[1].$comboTextArray[2]; } ?> **$comboText** must be replaced from the string you … | |
Re: What you really need is a newline (As @cereal posted in the above reply) |
The End.