List Info

Thread: New to PHP and MySQL... a few problems with my first script.




New to PHP and MySQL... a few problems with my first script.
user name
2006-05-16 02:31:28
I am wondering if it has to do with the fact that I am
learning from a
book made in 2002 and using PHP 5 and MySQL 5.

<html>
<head>

</head>
<body>

<?
	$mysql =
mysql_connect("localhost","cwrinn",
"password") or die('Unable
to Authenticate to ODBC'.mysql_error());
	mysql_select_db(snapon_dev, $mysql) or die('Error
Selecting
Database'.mysql_error());
	$result = mysql_query("select * from branch limit
0,30", $mysql) or
die('Error querying database'.mysql_error());

	while ($row = mysql_fetch_row($result))
	{
		 for ($i=0; $i<mysql_num_fields($result); $i++)
		 	echo $row[$i] . " ";

		echo "\n";
	}
	mysql_close($connection);
?>
</body>
</html>


Any ideas?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "PHP & MySQL" group.
To post to this group, send email to phpmysqlgooglegroups.com
To unsubscribe from this group, send email to
phpmysql-unsubscribegooglegroups.com
For more options, visit this group at http://groups
.google.com/group/phpmysql
-~----------~----~----~----~------~----~------~--~---

New to PHP and MySQL... a few problems with my first script.
user name
2006-05-20 17:26:20
c.wrinngmail.com wrote:
> 	while ($row = mysql_fetch_row($result))
> 	{
> 		 for ($i=0; $i<mysql_num_fields($result); $i++)
> 		 	echo $row[$i] . " ";
>
> 		echo "\n";
> 	}

I'm not sure if this will actually output what you want. I
tend to use
this code for a similar operation:

   while($row = mysql_fetch_array($result, MYSQL_NUM))
    {
          list($type, $your, $column, $names, $here) = $row;

              echo "Enter your $variables here or
whatever";
   }

X-Google-Language: ENGLISH,ASCII-7-bit
Received: by 10.11.53.63 with SMTP id b63mr87178cwa;
        Sat, 20 May 2006 10:26:20 -0700 (PDT)
X-Google-Token: MRdKiQwAAACiYI-d4QyHwuGGWMVydu2v
Received: from 129.11.102.132 by
j55g2000cwa.googlegroups.com with HTTP;
	Sat, 20 May 2006 17:26:20 +0000 (UTC)
From: "Matt" <guitarromanticgmail.com>
To: "PHP & MySQL" <phpmysqlgooglegroups.com>
Subject: Re: New to PHP and MySQL... a few problems with my
first script.
Date: Sat, 20 May 2006 10:26:20 -0700
Message-ID: <1148145980.046474.126520j55g2000cwa.googlegroups.com>
In-Reply-To: <1147746688.671530.143290j33g2000cwa.googlegroups.com>
References: <1147746688.671530.143290j33g2000cwa.googlegroups.com>
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-GB; rv:1.8.0.3) Gecko/20060426
Firefox/1.5.0.3,gzip(gfe),gzip(gfe)
Mime-Version: 1.0
Content-Type: text/plain

c.wrinngmail.com wrote:
> 	while ($row = mysql_fetch_row($result))
> 	{
> 		 for ($i=0; $i<mysql_num_fields($result); $i++)
> 		 	echo $row[$i] . " ";
>
> 		echo "\n";
> 	}

I'm not sure if this will actually output what you want. I
tend to use
this code for a similar operation:

   while($row = mysql_fetch_array($result, MYSQL_NUM))
    {
          list($type, $your, $column, $names, $here) = $row;

              echo "Enter your $variables here or
whatever";
   }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "PHP & MySQL" group.
To post to this group, send email to phpmysqlgooglegroups.com
To unsubscribe from this group, send email to
phpmysql-unsubscribegooglegroups.com
For more options, visit this group at http://groups
.google.com/group/phpmysql
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )