Re: [PHP] Problems with $_POST

2004-01-21 Thread Reidar Solberg
Thank you all for answers - I've got one problem less!!!

- Reidar

"Binay" <[EMAIL PROTECTED]> skrev i melding
news:[EMAIL PROTECTED]
Hi

What is the primary key in your tble? Using tht primary key check for
duplicate entry... Theres no way u can change the posted data ... so even if
u reset $_POST['submit']  after the insert operation is done, next time u
refresh it will be set and hence will duplicate...so check for duplicate
entries urself only based on primary key or unique values in ur table.

Hope this helps

Cheers
Binay

U wrote..
<
I have a FORM for entering data into a DB.

I use:
...
...
if ($_POST['submit'] == 'Register') {
...
code for INSERT into DB.

This works OK, but if I REFRESH the page, it  duplicates the "dataset" in
the table.

How can I reset  $_POST['submit']  so it don't make this happen?

Rgds
Reidar Solberg
>

-- 
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] Problems with $_POST

2004-01-21 Thread Reidar Solberg
I have a FORM for entering data into a DB.

I use:
...
...
if ($_POST['submit'] == 'Register') {
...
code for INSERT into DB.

This works OK, but if I REFRESH the page, it  duplicates the "dataset" in
the table.

How can I reset  $_POST['submit']  so it don't make this happen?

Rgds
Reidar Solberg

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



[PHP] Accessing .bat file from PHP

2003-11-30 Thread Reidar Solberg
I want to start a .bat file on my local pc from my webpage -  to download
some .txt files.
I run PHP in my webpage - how can I make contact with the .bat file? Anyone
tried this?

Reidar Solberg

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



[PHP] Re: Oh why won't it work

2003-10-27 Thread Reidar Solberg
Without going too deep into your code, I think I see (parts of) your
problem.

In a nearly similar case, I used this code to deal with the problem.


// This  example is putting the data from a table into a 2-dimentional
array:

// When using  mysql_data_seek() you have all the selections from the
query in an array, an you can point to which row you want at any time.
// Remember: the rowpointer "row_num"  starts at 0 and runs to "max_rows" -
1.

 $query = "SELECT *.

 $max_rows = mysql_num_rows($result);
 $row = mysql_fetch_array($result);
  $row_num = 0;
  $ix = 0;
  while ($row_num <= $max_rows-1) {
  mysql_data_seek($result,$row_num);
   $row = mysql_fetch_array($result);
   $ix++;
   $array[$ix] [1]= $row[1];
   $array[$ix] [2]= $row[2];
   $array[$ix] [3]= $row[3];
  $row_num++;
  }

Hopes this helps a bit.

Regards
Reidar Solberg

"Tom Wollaston" <[EMAIL PROTECTED]> skrev i melding
news:[EMAIL PROTECTED]
> I am having problems sorting stuff into an array. It doesn't seem to work
> quite how everything I read says it should. It is probably my
understanding
> of it but either way I don't really know whats going on.
>
> I am trying to put everything out of a table into an array so I can call
up
> the individual rows by a sequential number and then the information in
each
> row by a colume heading. so for the name value in row 1 I want to have
> $null[1][name].
>
> The purpose of this is to amke a menu system where it automatically sorts
> the rows into the relevent order. The parentid associates a row with
another
> to signify that it comes under that menu heading. I want it to have 3
> levels, so I have included 3 loops all looking for data whos parent id is
> the same as the previous ones id. If that makes any sence.
>
> But when I run this script, it looses the first row and doesn't really
> output anything logical. For now I have commented out 2 of the loops to
try
> and make it easier to see where I have gone wrong.
>
> To see what output I get http://www.busc.net/bristol/website/admin.php is
> the code that I have included underneath.
>
> Thanks
>
> 
> 
> Bristol University Skiclub Admin Section
> 
> 
>
> 
> 
>   
> 
>   include "includes/constants.php";
>
>  $link = @mysql_connect($DB_server, $DB_user, $DB_pwd) or die ("Could not
> connect");
>  @mysql_select_db($DB_user) or die ("Could not select database");
>  $n = 1;
>  $null=getinfo('0');
>
>  for ($i=1; $i<=sizeof($null); $i++);
>   {
>   print_r($null);
>  /* print $nul[$i]['name'];
>   $j=$null[$i]['id'];
>   /*$fisrt=getinfo["1"];
>for ($k=1; $k<=sizeof($first); $k++);
> {
> echo $first[$k]['name'];
> $l=$first[$k]['id'];
> $second=getinfo['$m'];
>  for ($m=1; $m<=sizeof($second); $m++);
>  {
>  echo $second[$m]['name'];
>  }
> }*/
>   }
>?>
>   
>  
>  
>   
> 
> 
> 
>  function getinfo($pid)
> {
>  $query = "SELECT name,parentid FROM ubsc_menu WHERE parentid='$pid' ORDER
> BY parentid";
>  $result = mysql_query ($query) or die ("Query failed");
>  $row=mysql_fetch_array($result,MYSQL_ASSOC);
>
>
>  while ($row=mysql_fetch_array($result,MYSQL_ASSOC))
>  {
>
>   foreach ($row as $colname => $value)
>   {
>$array[$n][$colname] = $value;
>   }
>   $n++;
>  }
>  return $array;
>
> }
> ?>

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



[PHP] Array in SQL-table

2003-10-23 Thread Reidar
I want to store an ARRAY in a SQL-table but don't know how to define it in
the table. The PHP-stuff is working OK but the "DB-thing" isn't.

Anyone tried this? Hopefully it is

Reidar Solberg

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



[PHP] test

2003-10-22 Thread Reidar
Just testing prior problems

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