Jump to content

Pawan_Agarwal

Members
  • Posts

    102
  • Joined

  • Last visited

Everything posted by Pawan_Agarwal

  1. Javascript CODE: var m=n=0; function show_services() { m=m+1; n=m+1; if(m==6) {m=6;n=1;} if(m==7) {m=1;n=2;} str1 = "/images/pic" + m + ".PNG"; str2 = "/images/pic" + n + ".PNG"; document.getElementById('w1').innerHTML = str1; document.getElementById('w2').innerHTML = str2; document.getElementById('img1').src = str1; document.getElementById('img2').src = str2; } var my_str = setInterval(function() {show_services()},1000); ############################################################################## <img id="img1" src="/images/pic1.PNG" style="margin-top:30px" height="100px" width="550px"/><br> <img id="img2" src="/images/pic2.PNG" style="margin-top:30px" height="100px" width="550px"/><br> <br> <div id='w1'></div> <br> <div id='w2'></div> ############################################################################## the code is working fine, files have been placed at the right place, str1 and str2 are getting correct values and they are updating at the right time..............I run same code on browser and it works fine, but, when I run the same code on website domain, it does work at all, what can be the reason for this ............
  2. I want to know question related to php and database If I fetch information from database, I get "Steve Jobs" if I print the name in html page echo "<td width=50% align=center>".$row['NAME']."</td></tr>"; BUT If I fetch information from database, I get only "Steve" if I put the name in text field or text box echo "<td width=50% align=center><input type='text' size=50 value=".$row['NAME']."></td></tr>"; Can any one help me ?????
  3. Thanks for your participation here. now i have few questions, >> now i know how to create index in database, so after creating index, is there anything that I have to do OR mysql database will take care of indexing and providing faster output on database queries ?? >> Suppose in a table 'X' I have few cols with maximum length as 15,20,25,20,30,10,15,15. The sum of all cols length is 150. My next question is that if I insert one row in table 'X', how much KB will it take to store in database for single row?? Does Indexing creates a difference in creating and managing the memory allocation ??
  4. Thanks for your answer, I am putting the user ID in primary key and i want to know if i want to retrieve all fields of table using user_id and you can see that with one user id , i will get only one record, so, if i am fetching one record at a time from table with one million rows, can you tell me how fast will select query work ?? Select * from table_name where user_id='AAAA_00001' You have listed something about indexing, please elaborate about this ...................
  5. Suppose, I have a table that has one million rows in it. That particular table has information related to people of particular country. It has few fields like user_id, name, phone, address, email address and some relevant fields like that. I am keeping user_id as primary key [which is unique]. Table name is people_record. There is no join or stuff like that, I am asking for the simple query. Now, my question is, I have to search single record in a table that has one million rows. So, if I search one record in that table using one user_id, how much time will it take with mysql. The query that I am executing is : select * from people_record where user_id=AAAA_00001 Will this query provide the output fast or I have to use some searching and sorting techniques to sort the database. I am asking the question here to know the better way to query a single row out of one million rows, I have listed the query above and want to know if there is something that i can do here to retrieve the result faster ???? Looking forward for the best solution..............Thanks
  6. Suppose, I have a table that has one million rows in it. That particular table has information related to people of particular country. It has few fields like user_id, name, phone, address, email address and some relevant fields like that. I am keeping user_id as primary key [which is unique]. Table name is people_record. There is no join or stuff like that, I am asking for the simple query. Now, my question is, I have to search single record in a table that has one million rows. So, if I search one record in that table using one user_id, how much time will it take with mysql. The query that I am executing is : select * from people_record where user_id=AAAA_00001 Will this query provide the output fast or I have to use some searching and sorting techniques to sort the database.
  7. I am trying to fetch data with AJAX but it is not working and also it is not providing any error ......... -------------------------------------------------------------------------------------------------------------------------------------------- This is the function that I have implemented to access the information -------------------------------------------------------------------------------------------------------------------------------------------- function get_data() { str = document.getElementById("select_data").value; var xmlhttp; if (str=="") { document.getElementById("select_data_here").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("select_data_here").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","page.php?_search="+str,true); xmlhttp.send(); } -------------------------------------------------------------------------------------------------------------------------------------------- The page 127.0.0.1/online/page.php?_search=product1 is showing data, but it is not displaying that output on index.php -------------------------------------------------------------------------------------------------------------------------------------------- index.php <div id='select_data'> product1 </div> <button onClick="get_data()">Click </button> <div id='select_data_here'> Output here </div> --------------------------------------------------------------------------------------------------------------------------------------------
  8. I have tried to explain each and every aspect , I am still wondering why no one is replying to this post............
  9. I am trying to send data from page1.php to page2.php with ajax, can someone tell me how to send data from page1 to page2 and then insert it into database, also tell me that after inserting the values in database, it must display the message on html page "data has been saved !!!"... I am trying to display message by document.getElementById('message').innerHTML = "Your data has been saved"...........
  10. is there anyone to suggest something here ????
  11. you can put the links and then the <DIV> like this <a></a> <a></a> <a></a> <a></a> <a></a> <DIV>image background</DIV>
  12. give some css to your html code
  13. $rn = rand(); <?php if (isset($_GET['rn'])) { mysql_query('SELECT * FROM table WHERE rn = '.$_GET['rn']); } echo '<a href="?rn='.$rn.'">random number link</a>'; ?> try this re-arrange code
  14. do not add brackets [] with $text[] and provide a column name with $row[0] in place of zero like $row["Address"]
  15. Line 14: $myfile = "s_vcs.txt"; Line 15: $fh = fopen($myfile, “a+”) or die("Couldn't open $myfile"); write semi-colon in line 14 at the end and it will work...........
  16. Developing CART for Online Shopping I am trying to add buttons on html page and the code is working............I have some products in <SELECT> tag i.e. Product 1,Product 2,Product 3,Product 4,Product 5......... I create an array "list_array" and storing all the values in array dynamically... I click on <BUTTON>ADD </BUTTON> and it reads the value from <SELECT> tag and add it into array...........To display all the products, I execute the loop and display all the items in array with a <BUTTON>REMOVE</BUTTON> in-front of every product.......... To delete the particular product, I can select it in <SELECT> tag and then click on delete button..........It removes the element from array .........To display the cart, I am using the loop again, and it shows all the products after clicking the <BUTTON>Display</BUTTON> Now the issue that I am facing here is that I am adding <BUTTON>REMOVE</BUTTON> button when I am displaying the products that have been added in CART, the code of java_script is listed below function display() { string = ""; str=""; for(j=0;j<i;j++) { str = list_array[j]+"_"+j; string = list_array[j]+" <button onclick='remove_me(this)' id="+str+">Remove</button><br>"+string; } document.getElementById('write').innerHTML = "Array:<br> " + string; document.getElementById('i_val').innerHTML = "I: " + i; } Now, I am trying every way to make a code that will help me in removing the product by clicking on <BUTTON>REMOVE</BUTTON>, I hope I have explained everything here, so, help me to fix this issue...............
  17. I rearrange the code and now it is working fine.............I am thankful to all guys participated in helping me...
  18. I rearrange the code and now it is working fine.............I am thankful to all guys participated in helping me on this post............
  19. well, i am trying my best to sort it out, however, I am just stuck in it. I am unable to remove the warning as I am newbie... Just understand that I am not posting the code directly here, I am trying to sort it out 1st and then i post here....I tried to rearrange the code but I did not get it right, I am posting the complete code here...............you try to rearrage it and let me know how to make it work ? The code itself is not making a problem here... I am saving the code in counter.php and this page has been included in index.php page.............if I execute the page counter.php, i get no error or warning, but if i include counter.php in index.php then i get error or warning ............I hope you got my point............ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// <?php session_start(); global $total; error_reporting(E_ALL); $username = "******************"; $password = "******************"; $hostname = "******************"; $database = "******************"; $connect = mysql_connect($hostname, $username, $password, $database) or die("Could not connect: ".mysql_error()); $selected = mysql_select_db($database,$connect) or die("Could not select database"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $result = mysql_query("SELECT * visitors"); if(!$result) {echo(die("cannot execute:").mysql.error());} //fetch tha data from the database while ($row = mysql_fetch_array($result)) { $total=$row['TOTAL']; } if(!isset($_SESSION['__name__'])) { global $total; $_SESSION['__name__']="Guest"; echo $_SESSION['__name__']; $total=$total+1; $result = mysql_query("UPDATE visitors SET TOTAL='$total'") ; } ?> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  20. the code is not displaying error , however , the condition is true and it is updating database, it is not considering it as false, here is the code for you....... if(!isset($_SESSION['__name__'])) { global $total; $_SESSION['__name__']="Guest"; $total=$total+1; $result = mysql_query("UPDATE visitors SET TOTAL='$total'") ; } the session creates successfully and it updates the value in database as soon as i refresh the page............i don't know why it is not halting when there is no error or warning in the code...........
  21. I am working on a code that will help me in creating and maintaining the session on webpage. When the customer visits the page the session must become active and increase the counter by one. I am able to do that. But, when the customer visits that page again, session_start() has been called again and it provided a warning. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\index.php:13) in C:\xampp\htdocs\counter.php on line 2 so, what can I do to omit this warning After visiting the page the session gets created and it does not updates further but it gives the above listed warning , looking for a quick answer .................
  22. the code is executing fine for the first execution, but after that it is displaying the warning........... Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\index.php:13) in C:\xampp\htdocs\index.php on line 3 I understand now that in code, i was calling the session_start() at each page, that was the point that i was facing issue a lot, know I have transferred the code and it will be called only once. But , what is happening now is that that single page can be called frequently, so what do I do now if that page is visited by any customer more that once, it will start displaying the warning again and that warning is Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\index.php:13) in C:\xampp\htdocs\index.php on line 3
  23. I have this array that has n elements ---> list_array = new Array(); it contains ['Product 1','Product 2','Product 3','Product 4','Product 5','Product 6','Product 7','Product 8'] what I am trying to do is that starting a loop from j=0 to j<n, I am adding button on html page, now when I click on button, it must remove itself from the page. I want to do this with the help of javascript...Is there anyone who can help ??? If I click on "product 8", the page must display other 7 buttons and it must delete the button itself on the page..... function create() { for(j=0;j<i;j++) { "<button onclick='remove_me(this)' id="+list_array[j]+">Remove</button><br>"; } } function remove_me(obj) { _button = obj.id; remove(_button); } I am trying to perform this operation, however, it only receive "Product" in obj.id.............It skips the text after the first whitespace..... I hope that you got my concern, looking for quick reply.......
  24. is there anyone to answer this question ???????
  25. ////////////////////////////////////////////////////////////////////////////// if(!isset($_SESSION['__name__'])) { global $total; $_SESSION['__name__']="Guest"; $total=$total+1; $result = mysql_query("UPDATE visitors SET TOTAL='$total'") ; } ////////////////////////////////////////////////////////////////////////////// I am applying this in the code but the if condition is returning true, it is never returning false, what must I do here ?????????
×
×
  • 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.