Re: [PHP] printing php variable into html > print $result; ?

2002-01-03 Thread Philip Olson

A quick rewrite of your code:

";
  }

?>

Your question was how to print the query, in this case you'd just print
$sql.  That was the point of the above but I got a bit carried away :) Oh,
mysql_error() can be very useful for debugging.  Regarding the type
resource, have a look here:

  http://www.php.net/manual/en/language.types.resource.php

Regards,
Philip Olson


On Fri, 4 Jan 2002, louie miranda wrote:

> Hi, is it possible to print the sql query? i mean
> i want to print the output of the command "SELECT * FROM members;"
> and output it into html, i tried
> 
> print $result; -- it gives me different output..
> 
> > Resource id #2
> 
> 
> ty,
> louie...
> 
> # PHP SCRIPT ###
> 
> 
> 
> 
>  
> $db = mysql_connect("my_db_host", "my_db_user", "my_db_pass")
> or die("Could not connect");
> 
> mysql_select_db("cavite",$db);
> 
> $result = mysql_query("SELECT * FROM members",$db) or
> die("Error:".mysql_error()
> );
> 
> printf("ircname: %s", mysql_result($result,0,"ircname"));
> printf("email: %s", mysql_result($result,0,"email"));
> printf("realname: %s", mysql_result($result,0,"realname"));
> printf("asl: %s", mysql_result($result,0,"asl"));
> printf("info: %s", mysql_result($result,0,"info"));
> 
> print "";
> 
> ?>
> 
> 
> 
> 
> 
> # PHP SCRIPT ###
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] printing php variable into html > print $result; ?

2002-01-03 Thread charlesk

something like

someColumnInTable;
   echo $row->someOtherColumnInTable;
}
?>

-- Original Message --
From: "louie miranda" <[EMAIL PROTECTED]>
Date: Fri, 4 Jan 2002 04:45:57 +0800

Hi, is it possible to print the sql query? i mean
i want to print the output of the command "SELECT * FROM members;"
and output it into html, i tried

print $result; -- it gives me different output..

> Resource id #2


ty,
louie...

# PHP SCRIPT ###




", mysql_result($result,0,"ircname"));
printf("email: %s", mysql_result($result,0,"email"));
printf("realname: %s", mysql_result($result,0,"realname"));
printf("asl: %s", mysql_result($result,0,"asl"));
printf("info: %s", mysql_result($result,0,"info"));

print "";

?>





# PHP SCRIPT ###


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
Charles Killmer
Netgain Technology
251-4700
--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] printing php variable into html > print $result; ?

2002-01-03 Thread Mehmet Kamil ERISEN

use 
$sql = "select .. ";
$result = mysql_query($sql);
echo $sql;

--- louie miranda <[EMAIL PROTECTED]> wrote:
> Hi, is it possible to print the sql query? i mean
> i want to print the output of the command "SELECT * FROM
> members;"
> and output it into html, i tried
> 
> print $result; -- it gives me different output..
> 
> > Resource id #2
> 
> 
> ty,
> louie...
> 
> # PHP SCRIPT
> ###
> 
> 
> 
> 
>  
> $db = mysql_connect("my_db_host", "my_db_user",
> "my_db_pass")
> or die("Could not connect");
> 
> mysql_select_db("cavite",$db);
> 
> $result = mysql_query("SELECT * FROM members",$db) or
> die("Error:".mysql_error()
> );
> 
> printf("ircname: %s",
> mysql_result($result,0,"ircname"));
> printf("email: %s", mysql_result($result,0,"email"));
> printf("realname: %s",
> mysql_result($result,0,"realname"));
> printf("asl: %s", mysql_result($result,0,"asl"));
> printf("info: %s", mysql_result($result,0,"info"));
> 
> print "";
> 
> ?>
> 
> 
> 
> 
> 
> # PHP SCRIPT
> ###
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> 


=
Mehmet Erisen
http://www.erisen.com

__
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] printing php variable into html > print $result; ?

2002-01-03 Thread louie miranda

Hi, is it possible to print the sql query? i mean
i want to print the output of the command "SELECT * FROM members;"
and output it into html, i tried

print $result; -- it gives me different output..

> Resource id #2


ty,
louie...

# PHP SCRIPT ###




", mysql_result($result,0,"ircname"));
printf("email: %s", mysql_result($result,0,"email"));
printf("realname: %s", mysql_result($result,0,"realname"));
printf("asl: %s", mysql_result($result,0,"asl"));
printf("info: %s", mysql_result($result,0,"info"));

print "";

?>





# PHP SCRIPT ###


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]