$res = array(); while($row = mysqli_fetch_assoc($res)){ $res[] = $row; } print(json_encode($res)); I did it the other way. It get the same result. notice that I use mysqli_, because I think mysql_ will be remove from php in the future. nice tuts, keep it coming! =)
Thank you, I did check the code, and after I could not figure it out, I copied and pasted the code exactly from your technotip site, and I still had the same issue. I will keep trying to debug and advise if I can find the solution. Thank you again for your tutorial!!
Hey Satish, you are a fantastic teacher. I just want to have more and more of the cool things you can teach us. Other people do thesame thing but the effect is never thesame. You are gifted with that magic that other people don't have. Although I say magic, but I think the key word is patience. 1 thing: I went to technotipDOTcom and somewhere we can pay to learn more, but I didn't see a clear content list of the diffent courses and what their topics are. It looks like I am missing something?
Hi Satish, Thank you for this tutorial, it really helped me a lot. But I got one question here. For example I have to fetch data from the db using the provided codes from this tutorial and then after fetch them, read them and use each separately to fetch other data from the db concerning the data chosen. Consider a simple scenario; lets say I have a db with doctor table (with attributes name, specialty and status). In html view I have a button that when clicked will fetch array list of all specialist from the table excluding duplicates (eg. cardiologists, dentist, dermatologist etc.) and show them to the html list, then after within each specialist group there are list of doctors that is when I click may be cardiologists then I will be able to fetch list of array doctors names from the table where their specialist is cardiology and this should be the same when I click dermatology list and others. And lastly, when I click each name of the doctor fetched the status information from the doctor table will be fetched to see whether there are available or not available. This is like a series of actions. Please Help how to do so.... Regards.
Hello Satish, your tutorial was fantastic and very helpful, thank you! I am having a bug with it though... In Chrome, everything works fine, unless I hit refresh, then it does not display any mysql data at all. It does work just fine in IE though. I tried several different machines, clearing the cache, etc. and had the problem every time. I was wondering if you had this problem as well, or if you knew what might cause it? Thank you again for such a wonderful tutorial I learned a lot from it.
None of this is working for me...I did the coding exactly as you did but the json data did not show in index file. The json data format displayed in the fetch.php file but when I run the index file, nothing shows up...why could this happened? Any idea?
I followed your other tutorial on how to insert data into a db with jquery without refresh and got it working fine. I followed this tutorial and also got it working fine. How can I combine the two so I can insert data into a db from a form and have it display the posted info from the database with no refresh ala facebook status updates or twitter?
+Umesh akshayan you should edit the MyScritp.js and remove the white spaces, it will work in this line $("ul").append("Admin ID: "+this['admin_id']+....etc make them all in one line
nic3 video.. can you make a tutorial video, by using "moda"l that can display data and every time i click the modal the data will also automatic refresh.. if the data in database was change?
hi i need help about inserting the data into mysql through PHP script i m doing the same but my fields in the form are not bringing the data to my insert.php file in which the insertions code is written pelase guide me if you can thanks
before I check your code ..make sure to visit the link present in the description section of "inserting record in sql" video tutorial. There I've posted all the code, please compare your code with the one I've posted on my blog. That's the easiest method to correct your code.
Satish thank for sharing, i copy and paste your code from techonotip but its not working please help my i am going to design a one to one chating system using this concept. i also connect jquery properly, and create the database. plz help me for this.
+Kyle Smith In file DB.PHP make this changes to use "mysqli" $conn = mysqli_connect(DB_HOST,DB_USER,DB_PASS,DB_NAME) or die(mysql_error()); in FETCH.PHP make this: $query = "SELECT * FROM people"; if(mysqli_query($conn,$query)) { $res = mysqli_query($conn,$query); } else { echo "Bad Connecteion"; } this works for me :)
the "or die(mysql_error());" should only ever be used for debugging and/or back-end testing - as a security precaution it should not be presented to the public facing side due to the fact that it can easily give away critical elements of your database structure - rendering the use of mysqli meaningless.
since everything is inside my local system it'll fetch the data in fraction of seconds, so I simply wanted to show you a bit of delay - like the real applications do!
You can look at this link ruclips.net/p/PLM4pPs1mzl_MnAMZT1vIPLRDIMRCFt7mB But this is not the complete list and most of these PHP tutorials are very basic. I would advise you to start learning objective php directly. OR if you have choice, you can go with MEAN stack instead of PHP.
If you know the echo function in php you can print anything from database in anywhere. The trick in echo function is the " " ' ' . Analyze it and you will unlock something!
Good tutorial, What if i have parameters to pass and how can i insert data Page without reloading, my code is something like $.post('fetch.php',{param1:paramval1,param2:paramval2)},function(data){ },'json')
+Cantuğ Çavuşoğlu you should edit the MyScritp.js and remove the white spaces, it will work in this line $("ul").append("Admin ID: "+this['admin_id']+....etc make them all in one line
dear i m not using jquery yet, i m new to php and was watching ur earlier tutorial with inserting records in sql using php, if you give me ur email address then i will send u the source files to look at if possible these are not bigger files just 5-10 lines.
You mayke doing something as this. This gives you less code :) $(document).ready(function(){ nameOfFunction(); setInterval(function(){nameOfFunction();},5000); });
$res = array();
while($row = mysqli_fetch_assoc($res)){
$res[] = $row;
}
print(json_encode($res));
I did it the other way. It get the same result.
notice that I use mysqli_, because I think mysql_ will be remove from php in the future.
nice tuts, keep it coming! =)
holy shit, i have been looking for this exact thing for the past 8+ months, thank you.
Thank you, I did check the code, and after I could not figure it out, I copied and pasted the code exactly from your technotip site, and I still had the same issue. I will keep trying to debug and advise if I can find the solution. Thank you again for your tutorial!!
Excellent video tutorial! Clear and concise.
Thanks Satish, For sharing your talent with us
Hi Satish, i want to thank you for this tutorial, i learned a lot from it.
Thanks a lot Nasser ..
All these feedback means a lot to me. Thanks again
Hai sateesh.... thnx for the tutorial... it works properly...
please include image uploading and downloading tutorials.....
Great explanation on how it works! Excellent!!!
Hey Satish, you are a fantastic teacher. I just want to have more and more of the cool things you can teach us. Other people do thesame thing but the effect is never thesame. You are gifted with that magic that other people don't have. Although I say magic, but I think the key word is patience. 1 thing: I went to technotipDOTcom and somewhere we can pay to learn more, but I didn't see a clear content list of the diffent courses and what their topics are. It looks like I am missing something?
Hi Satish,
Thank you for this tutorial, it really helped me a lot. But I got one question here. For example I have to fetch data from the db using the provided codes from this tutorial and then after fetch them, read them and use each separately to fetch other data from the db concerning the data chosen.
Consider a simple scenario; lets say I have a db with doctor table (with attributes name, specialty and status). In html view I have a button that when clicked will fetch array list of all specialist from the table excluding duplicates (eg. cardiologists, dentist, dermatologist etc.) and show them to the html list, then after within each specialist group there are list of doctors that is when I click may be cardiologists then I will be able to fetch list of array doctors names from the table where their specialist is cardiology and this should be the same when I click dermatology list and others. And lastly, when I click each name of the doctor fetched the status information from the doctor table will be fetched to see whether there are available or not available. This is like a series of actions.
Please Help how to do so....
Regards.
Thanks man. This is exactly what I was looking for.
nice now got to know how to get data from db using just creating json data
very good....wonderful
Hello Satish, your tutorial was fantastic and very helpful, thank you! I am having a bug with it though... In Chrome, everything works fine, unless I hit refresh, then it does not display any mysql data at all. It does work just fine in IE though. I tried several different machines, clearing the cache, etc. and had the problem every time. I was wondering if you had this problem as well, or if you knew what might cause it? Thank you again for such a wonderful tutorial I learned a lot from it.
i'm trying it but it's telling me that the my_script.js file has a problem ?
None of this is working for me...I did the coding exactly as you did but the json data did not show in index file. The json data format displayed in the fetch.php file but when I run the index file, nothing shows up...why could this happened? Any idea?
this is great working properly. please let me know how can I put MORE button.that can show one sentence and after clicking more every displace.
I followed your other tutorial on how to insert data into a db with jquery without refresh and got it working fine. I followed this tutorial and also got it working fine. How can I combine the two so I can insert data into a db from a form and have it display the posted info from the database with no refresh ala facebook status updates or twitter?
Perfect!; thanks.
hey man, great tut. appreciate your effort
Thank you! Great tutorial, very helpful...
Great Tutorial buddy
you making my life easier! thanks! :D
this is exactly what i am looking for! Thanks so much!
is it possible for you to show me how to do this on joomla please?
how to make the output text to specific UL (like get element by id) to view the data in it?
thank you satish, but what if i want to make the newest data always at the top place ? can we do that ?
thank you,its very usefull for me.
i copied all the code from your website but it's not workin, the php file is working but there is nothing displaying in index.html
+Umesh akshayan I was wondering you got it working? I got it up to fetch.php, but index.html display blank. Spend 2 days, no luck so far.
+Arthur Chang same here
+Umesh akshayan you should edit the MyScritp.js and remove the white spaces, it will work in this line
$("ul").append("Admin ID: "+this['admin_id']+....etc
make them all in one line
nic3 video.. can you make a tutorial video, by using "moda"l that can display data and every time i click the modal the data will also automatic refresh.. if the data in database was change?
Thank You!!!!!
hi i need help about inserting the data into mysql through PHP script i m doing the same but my fields in the form are not bringing the data to my insert.php file in which the insertions code is written pelase guide me if you can thanks
before I check your code ..make sure to visit the link present in the description section of "inserting record in sql" video tutorial. There I've posted all the code, please compare your code with the one I've posted on my blog. That's the easiest method to correct your code.
Thanks alot for a great tutorial!
thank you for such a good tutorial,, i have a question ,, can we convert a web app to an app using phonegap?
vry nice tutorial
Thanks for your videos! How can I do to bring data from my Google spreadsheet to a site with jquery?
Excelente!
Very very Good!
can i ask where did jSon array folder came from and the folder script too?
Thank You Very Much for the help sir! :)
i want to display data from database using ajax in php by onload function.
Thanks man really appreciate
Excellent !!
thanks for the tutorial, very helpful :)
Well done ! How can we display it like facebook notification. I mean how to write the code in jquery to display.
i followed all the steps but i dont seem to see any display in my main html
same here
thanks nice tutorial ! thumbs up
thank you ..
How do I append the data to a table in rows and columns instead of ordered list. Thanks.
Got it.
problem solved problem was in php page which i was calling by in getJSon function..
thanks for reply
Satish thank for sharing, i copy and paste your code from techonotip but its not working please help my i am going to design a one to one chating system using this concept.
i also connect jquery properly, and create the database.
plz help me for this.
very nice tute...
if i want to display images in different divs how can we do that ???
thanx dude.
thanku yar
How you do it if you have images in your array?
I love you
awesome!
from where i get jquery-1.8.2.min.js ?
when I try to select the text, it does not select
Some of the PHP like mysql_fetch_array isn't supported in PHP 5.5 you should make a new video.
Kyle Smith not needed. This video is just to get the Idea for retrieving and consuming json in PHP .
+Kyle Smith
In file DB.PHP make this changes to use "mysqli"
$conn = mysqli_connect(DB_HOST,DB_USER,DB_PASS,DB_NAME) or die(mysql_error());
in FETCH.PHP make this:
$query = "SELECT * FROM people";
if(mysqli_query($conn,$query))
{
$res = mysqli_query($conn,$query);
}
else
{
echo "Bad Connecteion";
}
this works for me :)
the "or die(mysql_error());" should only ever be used for debugging and/or back-end testing - as a security precaution it should not be presented to the public facing side due to the fact that it can easily give away critical elements of your database structure - rendering the use of mysqli meaningless.
Nice
can u do an example on refreshing table
Please explain why do you set a time delay of 0.2 sec thanks.
since everything is inside my local system it'll fetch the data in fraction of seconds, so I simply wanted to show you a bit of delay - like the real applications do!
Can anyone help in integrating facebook login,g+ login,twitter login in a website which is built in codeigniter using hybridauth
I want the first jquery plugin...
i have problam not going in side this function
$.getJSON("j_db.php",function(data){
hello sir where is your php tutorial playlist please provide me link
You can look at this link ruclips.net/p/PLM4pPs1mzl_MnAMZT1vIPLRDIMRCFt7mB
But this is not the complete list and most of these PHP tutorials are very basic. I would advise you to start learning objective php directly. OR if you have choice, you can go with MEAN stack instead of PHP.
Thank's Man
nice to know that it helped ..
this one is very good. but can you teach me how to put it inside the table. :)
If you know the echo function in php you can print anything from database in anywhere. The trick in echo function is the " " ' ' . Analyze it and you will unlock something!
good code sir cna your give index.php code bech on website it only showing js file
how can i print it in a descending order
+alhussain taher
edit this query : SELECT * FROM people ORDER BY 'name' DESC
you just add some statement with ORDER BY
Here we are pinging database for every 2 sec? is it?
tks
Good tutorial,
What if i have parameters to pass and how can i insert data Page without reloading, my code is something like
$.post('fetch.php',{param1:paramval1,param2:paramval2)},function(data){
},'json')
awesome ... (y)
thanks but this not working in ie
I waste my all one day. I tried everything. It didnt work :/ Php is working though.
+Cantuğ Çavuşoğlu you should edit the MyScritp.js and remove the white spaces, it will work in this line
$("ul").append("Admin ID: "+this['admin_id']+....etc
make them all in one line
Thamk you mr alex
First make sure the php files are working.. then implement jQuery to it.
I think the table people at the start is called info (by mistake)
Even so, the code doesn't work
Finally, it worked! I did the mistake to include additional echo statements in the fetch.php file. This spoilt the functionality of my code.
dear i m not using jquery yet, i m new to php and was watching ur earlier tutorial with inserting records in sql using php, if you give me ur email address then i will send u the source files to look at if possible these are not bigger files just 5-10 lines.
u have any vediosites for learn core java, php,html,j2ee and free down load ebooks send me address.........
thank u for reply
I want that first jquery file jquery file..:-)
You mayke doing something as this. This gives you less code :)
$(document).ready(function(){
nameOfFunction();
setInterval(function(){nameOfFunction();},5000);
});
sir please make video for comments like youtube plzzzzzzzzz
give me ur email. I wil send all the coding
you need a bigger vocabulary