By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,722 Members | 1,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,722 IT Pros & Developers. It's quick & easy.

only one row

P: n/a
Does somone know why this script
gives me only one result like this:

i want to have something like that:
---------------
select * from firma where id_firma=1->1
select * from firma where id_firma=2->2
select * from firma where id_firma=3->3
select * from firma where id_firma=4->4

THE SCRIPT GIVES ME ONLY ONE ROW. WHY?

the result:
---------------

select * from firma where id_firma=1->1
---------------

the script code :
<?

$con = odbtp_connect( 'localhost','DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=c:\\baza\\baza.mdb;UID=admin;PWD=; ');
$zap_main="select id_firma from firma";
$exec_main=odbtp_query($zap_main);
while($wiersze=odbtp_fetch_assoc($exec_main))
{

$id=$wiersze['id_firma'];
echo $zap="select * from firma where id_firma=$id";
$wyko=odbtp_query($zap);
while($wiersz=odbtp_fetch_assoc($wyko))
{
echo "->".$wiersz['id_firma'];
}
}
?>
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Kalenzo wrote:
Does somone know why this script
gives me only one result like this:
Maybe there is an error in your SQL commands?

[snip] the script code :
<?

$con = odbtp_connect( 'localhost','DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=c:\\baza\\baza.mdb;UID=admin;PWD=; ');
### do some error checking
if (!$con) die('could not connect');
###
$zap_main="select id_firma from firma";
$exec_main=odbtp_query($zap_main);
### do some error checking
if (!$exec_main) die('error in query [' . $zap_main . ']');
###
while($wiersze=odbtp_fetch_assoc($exec_main))
{

$id=$wiersze['id_firma'];
echo $zap="select * from firma where id_firma=$id";
$wyko=odbtp_query($zap);
### do some error checking
if (!$wyko) die('error in query [' . $zap . ']');
###
while($wiersz=odbtp_fetch_assoc($wyko))
{
echo "->".$wiersz['id_firma'];
}
}
?>

--
USENET would be a better place if everybody read: | to email me: use |
http://www.catb.org/~esr/faqs/smart-questions.html | my name in "To:" |
http://www.netmeister.org/news/learn2quote2.html | header, textonly |
http://www.expita.com/nomime.html | no attachments. |
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.