How to retrive data from mysql database dynamically

Status
Not open for further replies.

Butterfly

Broken In
Folks ,

I tried Dreamweaver MX 2004 to do it automatically, that coroupted my whole site..

So , can u plz write me one code for me , all i wanted is i have already stored data in the database , now what i want is to show that data in the web page dynamically, like say dynamic table !

can u u show me how and if possible plz give me a full php coding for retriving data from databse..

thanks
 

Deep

Version 2.0
i had given you the code in your last post i suppose..

need to use the same code to fetch the records and display the stuff in while loop...

Deep
 
OP
B

Butterfly

Broken In
Well,

If i were damn expert in it i would have not post it in the froum...well yeah Deep u did post it last time , but u dinbt post it all , somne parts are blank, and thats a difficult for me to add..

never mind

thanks a lot
 

Deep

Version 2.0
Code:
<?php
mysql_connect ($host,$user,$pass);
mysql_connect_db ($database);

$sql = "SELECT id,image_path,image_description FROM pic";
$result = mysql_query ($sql);

while ($row = mysql_fetch_row($result))
{

$id = $row[0];
$image_path = $row[1];
$image_description = $row[2];

$show_stuff .= "<img src=\"$image_path\">
$image_description";

// ^^^ this will store all the values of table inside $show_stuff ^^^
}

echo $show_stuff;
?>

all done...
this is just basic..you need to customize it and add into your code according to your needs...

Regards
Deep
 

Deep

Version 2.0
you need mysql server for that...

connection you have to make it using the code i specified about...

Deep
 
OP
B

Butterfly

Broken In
Hellow Friends ,
This is the code am trying : have a look am getting error, if u all can fixed it up for me :

am getting error on this line : Parse error: parse error in c:\web\test.php on line 12

***************************************************
<html><body>

<?
$host = "localhost";
$user = "root";
$pass = "";
$dbname = "karmas";
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."
");
mysql_select_db($dbname)

$sql = "SELECT ID,logo,Description FROM client";
$result = mysql_query ($sql);



while ($row = mysql_fetch_row($result))
{

$ID = $row[0];
$logo = $row[1];
$Description = $row[2];

$show_stuff .= "<img src=\"$image_path\">
$image_description";

// ^^^ this will store all the values of table inside $show_stuff ^^^
}

echo $show_stuff;
?>
</body></html>

************************************************

My Table structure (karmas)

¦ID¦logo¦Description¦

*****************************************************
Parse error: parse error in c:\web\test.php on line 12

($sql = "SELECT ID,logo,Description FROM client"; )

:)
 
OP
B

Butterfly

Broken In
Thanks Deep,

It finally worked , i like it ,...... something not yet arranged ..

cant the data be in dynamic table , so that what ever i retrive it from the datbase it directly show it in table in the browser ..

Let me know more

thnaks
 
Status
Not open for further replies.
Top Bottom