Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Change of content, PHP help~

views
     
TSBlueSilver
post Mar 25 2006, 03:15 PM, updated 19y ago

Regular
******
Senior Member
1,142 posts

Joined: Sep 2004
From: Puchong


I'm trying to build a website that once a user clicks a button, the content of the website will change accordingly by retrieving the data from mysql. I know how to retrieve data from the database. I just don't know how to code the changing of content part. Can anyone help me? notworthy.gif
nxfx
post Mar 25 2006, 03:25 PM

Enthusiast
*****
Senior Member
979 posts

Joined: Jan 2003


put the html in the php code.
eg.
If the return value is true then //php part
Display html tabke here //html part
else
Display none
TSBlueSilver
post Mar 25 2006, 08:05 PM

Regular
******
Senior Member
1,142 posts

Joined: Sep 2004
From: Puchong


ok i'll give it a try. Thanks so much nxfx. smile.gif
nexus-
post Mar 26 2006, 08:16 AM

The intrepid coward
Group Icon
VIP
3,744 posts

Joined: Jan 2003
From: Sydney, Australia



Perhaps you are looking at AJAX.
http://en.wikipedia.org/wiki/AJAX
TSBlueSilver
post Mar 26 2006, 12:10 PM

Regular
******
Senior Member
1,142 posts

Joined: Sep 2004
From: Puchong


I'll take a look at AJAX too. biggrin.gif Thanks nexus.
crynobone
post Mar 26 2006, 12:20 PM

1'm n0t @ n00b n0t y3t @ 1337
*******
Senior Member
2,811 posts

Joined: Jan 2003
From: Somewhere in middle earth


A more direct toturial totally to get you started > http://www.pixel2life.com/twodded/t_ajax_a...nd_data_/page1/

This post has been edited by crynobone: Mar 26 2006, 12:20 PM
TSBlueSilver
post Mar 26 2006, 07:26 PM

Regular
******
Senior Member
1,142 posts

Joined: Sep 2004
From: Puchong


i've surf through lots of stuff about AJAX and most of it was about form components and i'm still stuck. Does anybody know of any good AJAX tutorial websites?

sunsuron
post Mar 26 2006, 07:32 PM

Regular
******
Senior Member
1,334 posts

Joined: Nov 2004



1. http://www.ajaxfreaks.com/
2. MORE
TSBlueSilver
post Mar 26 2006, 08:45 PM

Regular
******
Senior Member
1,142 posts

Joined: Sep 2004
From: Puchong


thanks sunsuron biggrin.gif
zorex
post Apr 2 2006, 05:51 PM

Regular
******
Senior Member
1,185 posts

Joined: Apr 2006
Alternative ways beside Ajax :

CODE

<?php
//Assume your have your data in database oledi
//Select your DB with the connection $link
//$var is the content name u want or whatever key (primary key)

$result_array = @mysql_query("SELECT * FROM tablename WHERE fieldname='$var'",$link);

   while($data = mysql_fetch_array($result_array)) {
   $content = $data["fieldname"]; //depend on your fieldname
   //remember to replace quote and < > after you retrive the data.
   }
?>
<!--html part!-->
<html>
<body>
<form name="" method="post" action="">
my content : <br><textarea style="width:400px;height:150px;" name="txt"><? echo $content ?></textarea>
</form>
</body>
</html>



This should works! Else reply again

 

Change to:
| Lo-Fi Version
0.0123sec    0.20    5 queries    GZIP Disabled
Time is now: 29th March 2024 - 07:31 AM