[PHP] mysql

2002-11-25 Thread Adrian Partenie
Hello, 

1.How many tables can be created inside a database? There is a maximum number?
2.Is it possible to erase a table?

Thanks, 
Adrian


[PHP] calling a php function

2002-11-26 Thread Adrian Partenie
Hello,

Can I call a php function using forms in the same way as I do for a javascript 
function? (in the same page, not with php_self).







.



Thanks, Adrian


[PHP] mysql, php, checkbox

2002-11-28 Thread Adrian Partenie


Hello, 

I'm displaying the content of a mysql table with autoincrement index. I want to be 
able to select the each row from the table using the check boxes. In order to do that, 
i want to assign to each checkbox the name=index of selected row. 
I assign to the checkboxes the value of selected id, but I can't retreiveit later for 
further processing. My code looks like this

 $query = "SELECT * FROM reclamatie";
$result = mysql_query($query) or die("Query failed");

/* Printing results in HTML */
 
 echo ""; 
echo "IDSubjectOpenClose"; 

 while($row = MySQL_fetch_array($result)) { 
 echo  ""; // ??
echo "{$row['id']}"; //for other purposes, it works fine
echo "{$row['subject']}"; 
echo "{$row['open']}";
   echo "{$row['close']}";
} 
echo ""; 

Any sugestions if i want to use forms, something like








Thanks, Adrian


Re: [PHP] mysql, php, checkbox

2002-12-03 Thread Adrian Partenie
 It works, but just for the first row selected from the table. I think that
the problem is that the checkboxes are declared inside a while loop. If i
declare manually all checkboxes it works. Any ideas ? Or maybe I'm doing
something wrong?



echo  "";
echo "";


/* Connecting, selecting database */
$link = mysql_connect("localhost", "root", "adrian")
or die("Could not connect");
print "Connected successfully";
mysql_select_db("menagerie") or die("Could not select database");

/* Performing SQL query */
$query = "SELECT * FROM reclamatie";
$result = mysql_query($query) or die("Query failed");

/* Printing results in HTML */

 echo "";
echo
"IDSubjectOpenClose";

 while($row = MySQL_fetch_array($result)) {
 echo  "";
echo "{$row['id']}";
echo "{$row['subject']}";
echo "{$row['open']}";
   echo "{$row['close']}";
}
echo "";

  /* Free resultset */
mysql_free_result($result);

/* Closing connection */
mysql_close($link);

echo "";
?>
###
//selectare.php  (just displays the id's of selected checkboxes)


//$useri=$_POST['useri'];
$ids=$_POST['ids'];

reset($ids);
while (list ($key, $value) = each ($ids)) {
echo "$value\n";
}
?>
#

As I said, when I select the first checkbox, I get the id, but when I select
any other checkbox, I get the errors
PHP Notice:  Undefined index:  ids in selectare.php
PHP Warning:  Variable passed to each() is not an array or object in
selectare.php





- Original Message -
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "'Adrian Partenie'" <[EMAIL PROTECTED]>; "'php'"
<[EMAIL PROTECTED]>
Sent: Thursday, November 28, 2002 5:54 PM
Subject: RE: [PHP] mysql, php, checkbox


> > I'm displaying the content of a mysql table with autoincrement index.
> I
> > want to be able to select the each row from the table using the check
> > boxes. In order to do that, i want to assign to each checkbox the
> > name=index of selected row.
> > I assign to the checkboxes the value of selected id, but I can't
> > retreiveit later for further processing. My code looks like this
> >
> >  $query = "SELECT * FROM reclamatie";
> > $result = mysql_query($query) or die("Query failed");
> >
> > /* Printing results in HTML */
> >
> >  echo "";
> > echo
> >
> "IDSubjectOpenClose >"
> > ;
> >
> >  while($row = MySQL_fetch_array($result)) {
> >  echo  " > name=\"{$row['id']}\">"; // ??
>
> It looks like your naming it as a number, which won't work for PHP. You
> want to name all of your checkboxes the same, with a [] on the name to
> make the results an array in PHP.
>
> ... name="id[]" value="{$row['id']}"
>
> Then, you'll have $_POST['id'][x] as an array in PHP. Only the
> checkboxes that were selected will be in the array, from zero to however
> many were checked. The value of $_POST['id'][x] will be whatever was in
> the value="..." part of the HTML checkbox...
>
> ---John Holmes...
>
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] mysql, php, checkbox

2002-12-05 Thread Adrian Partenie

Indeed, now it works, I put the form tag by mistake...
Thanks,
Adrian

- Original Message -
From: "rija" <[EMAIL PROTECTED]>
To: "Adrian Partenie" <[EMAIL PROTECTED]>
Sent: Tuesday, December 03, 2002 11:30 PM
Subject: Re: [PHP] mysql, php, checkbox


> There are  tags around  What are
they
> supposed to do?
> I think your problem lies there, because ids[] belong to this new form not
> to the first one and then ids[] cannot be set.
>
> Secondly,  method='post' inside  does nothing.
>
> Hope that helps.
>
> - Original Message -
> From: "Adrian Partenie" <[EMAIL PROTECTED]>
> To: "php" <[EMAIL PROTECTED]>
> Sent: Wednesday, December 04, 2002 4:50 AM
> Subject: Re: [PHP] mysql, php, checkbox
>
>
> > It works, but just for the first row selected from the table. I think
that
> > the problem is that the checkboxes are declared inside a while loop. If
i
> > declare manually all checkboxes it works. Any ideas ? Or maybe I'm doing
> > something wrong?
> >
> >
>

> > 
> > echo  "";
> > echo "";
> >
> >
> > /* Connecting, selecting database */
> > $link = mysql_connect("localhost", "root", "adrian")
> > or die("Could not connect");
> > print "Connected successfully";
> > mysql_select_db("menagerie") or die("Could not select database");
> >
> > /* Performing SQL query */
> > $query = "SELECT * FROM reclamatie";
> > $result = mysql_query($query) or die("Query failed");
> >
> > /* Printing results in HTML */
> >
> >  echo "";
> > echo
> >
>
"IDSubjectOpenClose";
> >
> >  while($row = MySQL_fetch_array($result)) {
> >  echo  " > name=\"ids[]\" value=\"{$row['id']}\">";
> > echo " > target=\"lowerframe\">{$row['id']}";
> > echo "{$row['subject']}";
> > echo "{$row['open']}";
> >echo "{$row['close']}";
> > }
> > echo "";
> >
> >   /* Free resultset */
> > mysql_free_result($result);
> >
> > /* Closing connection */
> > mysql_close($link);
> >
> > echo "";
> > ?>
> > #######
> > //selectare.php  (just displays the id's of selected checkboxes)
> >
> >
> > //$useri=$_POST['useri'];
> > $ids=$_POST['ids'];
> >
> > reset($ids);
> > while (list ($key, $value) = each ($ids)) {
> > echo "$value\n";
> > }
> > ?>
> > #
> >
> > As I said, when I select the first checkbox, I get the id, but when I
> select
> > any other checkbox, I get the errors
> > PHP Notice:  Undefined index:  ids in selectare.php
> > PHP Warning:  Variable passed to each() is not an array or object in
> > selectare.php
> >
> >
> >
> >
> >
> > - Original Message -
> > From: "John W. Holmes" <[EMAIL PROTECTED]>
> > To: "'Adrian Partenie'" <[EMAIL PROTECTED]>; "'php'"
> > <[EMAIL PROTECTED]>
> > Sent: Thursday, November 28, 2002 5:54 PM
> > Subject: RE: [PHP] mysql, php, checkbox
> >
> >
> > > > I'm displaying the content of a mysql table with autoincrement
index.
> > > I
> > > > want to be able to select the each row from the table using the
check
> > > > boxes. In order to do that, i want to assign to each checkbox the
> > > > name=index of selected row.
> > > > I assign to the checkboxes the value of selected id, but I can't
> > > > retreiveit later for further processing. My code looks like this
> > > >
> > > >  $query = "SELECT * FROM reclamatie";
> > > > $result = mysql_query($query) or die("Query failed");
> > > >
> > > > /* Printing results in HTML */
> > > >
> > > >  echo "";
> > > > echo
> > > >
> > >
"IDSubjectOpenClose > > >"
> > > > ;
> > > >
> > > >  while($row = MySQL_fetch_array($result)) {
> > > >  echo  " > > > name=\"{$row['id']}\">"; // ??
> > >
> > > It looks like your naming it as a number, which won't work for PHP.
You
> > > want to name all of your checkboxes the same, with a [] on the name to
> > > make the results an array in PHP.
> > >
> > > ... name="id[]" value="{$row['id']}"
> > >
> > > Then, you'll have $_POST['id'][x] as an array in PHP. Only the
> > > checkboxes that were selected will be in the array, from zero to
however
> > > many were checked. The value of $_POST['id'][x] will be whatever was
in
> > > the value="..." part of the HTML checkbox...
> > >
> > > ---John Holmes...
> > >
> > >
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] php, frames

2002-11-16 Thread Adrian Partenie
Hello,
I could use some help. 


I have two framed pages, upperframe.html and lowerframe.html.  In upper frame.html:

echo ""; 
echo "IDSubjectOpenClose"; 
while($row = MySQL_fetch_array($result)) { 
echo ""; 
echo "{$row['id']}"; ??
echo "{$row['subject']}"; 
echo "{$row['open']}";
echo "{$row['close']}"; 
} 
echo "";

I display the content of the main table, which has an autoincrement index. For every 
index I have another table, something like  tableID. What I want is to press on  the 
id from a row in upperframe table and to display in lowerframe the tableID. How can I 
do that? 



Thanks a lot, 

Adrian



[PHP] php, forms, mysql

2002-11-18 Thread Adrian Partenie
Hello,
I could use some help. 


I have two framed pages, upperframe.html and lowerframe.html.  In upper frame.html:

echo ""; 
echo "IDSubjectOpenClose"; 
while($row = MySQL_fetch_array($result)) { 
echo ""; 
echo "{$row['id']}"; ??
echo "{$row['subject']}"; 
echo "{$row['open']}";
echo "{$row['close']}"; 
} 
echo "";

I display the content of the main table, which has an autoincrement index. For every 
index I have another table, something like  tableID. What I want is to press on  the 
id from a row in upperframe table and to display in lowerframe the tableID. How can I 
do that? 



Thanks a lot, 

Adrian