[PHP] inserting an auto incemented column in table already created

2005-04-29 Thread Ross Hulford
Hi,

I have a table with 15 columns or so that has been inherited from an older 
db and am trying to insert an auto increment column  (in mysql) without 
having to number it manually. This is fine when I add new colums via a form 
but the old entries have a null value

Alternatively It has been converted from Excel soif anyone knows how to do 
it that way that would help.I never use Excel so have no clue about it.


R. 

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



[PHP] password Boxes

2005-03-14 Thread Ross Hulford
Does anyone know how to change the style of password boxes so when the 
characters are entered an asterisk appears rather that a smal circle?

Or is this just determed by the OS and uncangable with CSS or Javascript of 
PHP?


R. 

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



[PHP] passing variables between pages without sessions

2005-03-13 Thread Ross Hulford
I am creating a form but instead of having a long form I want to break it 
down into a few stages but need to pass the variables bewteen the pages.

I have done this before using sessions but would like to know if there is an 
alternative way to do this?

R. 

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



[PHP] eregi expression for checking a domain

2005-03-13 Thread Ross Hulford
Does anyone know a working eregi expression for determining a domain is 
valid? don't need the http:// just looking for www.thedomain.com

cheers,


R. 

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



[PHP] showing an image with php

2005-03-11 Thread Ross Hulford
I want to asssign an image to a variable and show it if certain conditions 
are met. E.g


If condition is met

{
$myimage= retrieve image (images/myimage.jpg)
 echo $myimage
}

Have not used image creation before with php just dipping my toe in the 
water.

Thanks


R. 

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



Re: [PHP] incrementing a number from a text file

2005-03-11 Thread Ross Hulford
I am just going to adda auto incrementing DB filed and get the numbers that 
way. Seems the best way.


Kim Madsen [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 10, 2005 10:14 PM
To: Ross Hulford
Cc: php-general@lists.php.net
Subject: Re: [PHP] incrementing a number from a text file

 I want to read a number from an external (txt) file and increment it.then
 save the number back on the text file.
 I know this is possible but want a simple amd economical way to do this.

 That's what you *THINK* you want to do :-)

 But what happens when *TWO* users hit that same script at exactly the same
 time.

snip

 This is why so many early hit counter scripts back in the day were
 always getting messed up and reset to 0.

Don´t increase if counter is not read?

 What you really want, almost for sure, is an SQL database with sequences

I try NOT to use databases if not nessecary

 You *can* use http://php.net/flock, but even that is a Bad Idea, because
 flock under Un*x is self-imposed -- If some *other* program/script/user
 decides not change that file and doesn't use flock, well, they're not
 STOPPED from doing that.

Poor programming?

 flock is therefore all too subject to human fallibility when you re-work,
 re-write, or add more code to your system.

Every code is... if You don´t use Your head, the outcome will be...?

If U no nothing about SQL, I use a database to a counter, I get a piece of 
code from a friend alter table counter auto_increment = 1; and I´m curious 
to see, what it does?

Or better: I put my query in a link like a 
href=db.php?q=select+*+from+customersshow customers/a and I´ve got NO 
clue about the settings in the mysql db, so this gets funny
a href=db.php?q=delete+from+customersshow customers/a
a href=db.php?q=drop+table+customersshow customers/a

*whistle*

This _was_ an issue in a company I worked for, along with queries like:

Select blablabla FROM t1,t2,t3
WHERE customers LIKE '%$s%'
OR name LIKE '%$s%'
OR domain LIKE '%$s%'
OR email LIKE '%$s%'
OR log LIKE '%$s%'
AND t1.id = t2.t1_id
AND t1.id = t3.t1_id

Horror!

Kind regards
Kim Madsen 

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



[PHP] incrementing a number from a text file

2005-03-09 Thread Ross Hulford
I want to read a number from an external (txt) file and increment it.then 
save the number back on the text file.
I know this is possible but want a simple amd economical way to do this.

Thanks,


Ross 

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



[PHP] using lists in php and sending

2005-03-08 Thread Ross Hulford
I have a list in php where the user can select 1 or more (rooms book in a 
bb). The following code is part of the form.

select name=rooms size=7 multiple
  option value=Single StandardSingle 
Standard/option
  option value=Single EnSuiteSingle 
EnSuite/option
  option value=Double EnSuiteDouble 
EnSuite/option
  option value=Twin En SuiteTwin En 
Suite/option
  option value=Family StandardFamily 
Standard/option
  option value=Family EnSuiteFamily 
EnSuite/option
  option value=Tripple EnSuiteTripple 
EnSuite/option
/select


And then I send using the mail() functin in PHP using the following code but 
the selected rooms do not display. I know it must be an array of sorts 
please help!!!


msg .= First Name: $firstname \n; $msg .= Second name: $surname \n;
$msg .= Email Address: $email \n; $msg .= Telephone: $telephone \n; $msg 
.= Arrival Date: $arrival \n;
$msg .= Departure Date: $depart \n; $msg .= $adults   Adults  and   $kids 
Children will be staying \n;
$msg .= We will require the following rooms   $rooms\n;
$msg .= Message: $addinfo \n;
$msg .= -\n\n; 

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



[PHP] A more ecconomical way with control statements??

2005-03-07 Thread Ross Hulford
if (empty($samosa)){
// do nothing

}

else {

setcookie(cookie[samosa], $samosa);

}


if (empty($pakora)){
// do nothing

}

else {

setcookie(cookie[pakora], $pakora);

}


It goes on like this for the whole menu I am looking for a more effiecient 
way to do this. The inputs are text boxes taking values from 0-9.

Thanks



Ross 

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



[PHP] using javascript within php

2005-03-07 Thread Ross Hulford
I want to set focus on a text area with javascript if the entry by the user 
is not what I want.

This is what i have so far.
?php

if (isset($submitted){

if(empty($name)) {
$fname_error =  *Please Enter your firstname or initial;
//the code to set focus to the textbox should go here
}

}

?

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



[PHP] call anchor from php

2005-03-07 Thread Ross Hulford
Is it possible to call a named anchor from within a php script?? I need my 
page to go to the point in the page where the form is and bypass all the 
rubbish.

Thanks y'all 

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



[PHP] Expression for deleting all cookies

2005-02-04 Thread Ross Hulford
Is there a single bit of code for scrubbing all the cookies or do I have to 
do setcookie (name, ) for all of them?? 

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



[PHP] check server status...please help

2005-01-26 Thread Ross Hulford
I want to write a script that will check if the server is down if it is I 
want to redirect the user to another site, the backup server.

Similarly I want users who go on to the seondary site when the main server 
is UP to be redirected to the main site.

Can this be done using PHP. If not can you point me in the right direction?

Kind regards,


Ross Hulford 

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



[PHP] Textarea and Php

2005-01-18 Thread Ross Hulford
Is there a way to add and remove lines of text to a textarea inside a form?


Thanks


Ross 

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



[PHP] Javascript newsgroup

2005-01-17 Thread Ross Hulford
Hi,

I need to find a good Javascript newsgroup.

Thanks,

Ross 

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



[PHP] Liveticker problem

2004-12-21 Thread Ross Hulford
Her is the code (not mine) what I am trying to so is cut out all the header 
info that is included in the message as shown here 
http://supercool-74.com/sms/liveticker.php

The message is supposed to be terminated by the xx string which is defined 
in config.php but it just continues and prints all the header info too.

-
?php

include (config.php);

$mbox = imap_open ({.$pop3_server./pop3:110}INBOX,$mailbox,$password);

$headers = imap_headers ($mbox);
$max = count($headers);

include (head.php);

echo table border=\0\ cellspacing=\30\ cellpadding=\0\\n;

for ($i = $max; $i  0; $i--)

{

 $header = imap_header ($mbox,$i);
 $from = $header-from;
 $email = $from[0]-mailbox.@.$from[0]-host;
 $date = $header-date;
 $date = split( ,$date);
$structure = imap_fetchstructure ($mbox,$i);
$encoding = $structure-encoding;

 if ($endword)
 {
  $end = strpos(imap_body ($mbox,$i),$endword);
 }

 if ($startword)
 {
  $beginning = ereg($startword,imap_body ($mbox,$i));
  $start = strpos(imap_body ($mbox,$i),$startword);
  if ($end)
  {
   $body = substr(imap_body 
($mbox,$i),$start+strlen($startword),$end-$start-strlen($endword));
  }
  else
  {
   $body = substr(imap_body ($mbox,$i),$start+strlen($startword));
  }
 }

 else
 {
  $beginning = true;

  if ($end)
  {
   $body = substr(imap_body ($mbox,$i),0,$end);
  }
  else
  {
   $body = imap_body ($mbox,$i);
  }
 }

 if (in_array ($email,$allowed_senders)  $beginning)
 {
  if ($date[1] == 1){$date[1]=01;}
 elseif ($date[1] == 2){$date[1]=02;}
 elseif ($date[1] == 3){$date[1]=03;}
 elseif ($date[1] == 4){$date[1]=04;}
 elseif ($date[1] == 5){$date[1]=05;}
 elseif ($date[1] == 6){$date[1]=06;}
 elseif ($date[1] == 7){$date[1]=07;}
 elseif ($date[1] == 8){$date[1]=08;}
 elseif ($date[1] == 9){$date[1]=09;}

 if ($date[2] == Jan){$date[2]=01;}
 elseif ($date[2] == Feb){$date[2]=02;}
 elseif ($date[2] == Mar){$date[2]=03;}
 elseif ($date[2] == Apr){$date[2]=04;}
 elseif ($date[2] == May){$date[2]=05;}
 elseif ($date[2] == Jun){$date[2]=06;}
 elseif ($date[2] == Jul){$date[2]=07;}
 elseif ($date[2] == Aug){$date[2]=08;}
 elseif ($date[2] == Sep){$date[2]=09;}
 elseif ($date[2] == Oct){$date[2]=10;}
 elseif ($date[2] == Nov){$date[2]=11;}
 elseif ($date[2] == Dec){$date[2]=12;}

 // Decode quoted printable and base64 encoding and coding HTML special 
charakters

if ($encoding == 4)
 {
  $body = htmlentities(quoted_printable_decode($body), ENT_QUOTES);
 }
 elseif ($encoding == 3)
 {
  $body = htmlentities(base64_decode($body), ENT_QUOTES);
 }
 else
 {
  $body = htmlentities($body, ENT_QUOTES);
 }

 // Line breaks

 $body = eregi_replace(\*br,\nbr,$body);

 echo tr\n;
 echo td nowrap valign=\top\b.$date[0]. 
.$date[1]...$date[2]...$date[3].br\n.$date[4]./b/td\n;
 echo td valign=\top\+++ .$body. +++/td\n/tr\n;

 $beginning = false;

}
}

echo /table\n;



// Copyright reference must not be removed:

?

table border=0 cellspacing=0 cellpadding=0
  tr
td width=50nbsp;/td
tdnbsp;/td
  /tr
/table

?php

imap_close ($mbox);

// Link to admin page

echo pnbsp;/p;
echo pa href=\admin.php\= Admin/a/p;

include (foot.htm); 

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



[PHP] inserting html within a mail body

2004-12-06 Thread Ross Hulford
Hi,


I am using the mail() function in php andI am looking for a quick and easy 
way to make the mail_body of an auto response email with HTML tags in it so 
I can add some style to it.

Are the use of CSS tags possible too?


Any suggestions will be much appreciated


Ross 

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



[PHP] UNDEFINED VARIABLE ON LOCALHOST

2004-11-29 Thread Ross Hulford
I have a porblem with undefined variables on loacalhost. Any ideas why? I 
have turned registed variables on.


R. 

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



Re: [PHP] UNDEFINED VARIABLE ON LOCALHOST

2004-11-29 Thread Ross Hulford
It was my error reporting.forgot I replaced my ini file.
John Nichel [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Ross Hulford wrote:
 I have a porblem with undefined variables on loacalhost. Any ideas why? I 
 have turned registed variables on.


 R.

 Without seeing any code, I'm going to guess that you haven't defined a 
 variable before trying to use it.  Wanna make it go away?  Turn off 
 'notices' in your error reporting, or make sure your variables are defined 
 before you try to use them.

 -- 
 John C. Nichel
 ÜberGeek
 KegWorks.com
 716.856.9675
 [EMAIL PROTECTED] 

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



[PHP] cannot send mail through localhost

2004-11-29 Thread Ross Hulford
I am trying to test my form locally, however it doesn't get picked up  my
mailbox.

The form is fine and I even set the access in IIS to 127.0.0.1 so the relay
error is not a porblem anymore. This must be a setup problem.

The mail is a standard mailform. I just use IIS thought a mail server is in
place when Iinstalled it.

I get no errors. Telnet is working on port 23 microsofts esmtp service
ready...


Do I have to start the mail server as a service? If so how do Ido this?


Ross


Help please,


Ross

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



[PHP] mysql_fetch_assoc(): 3 is not a valid MySQL result resource

2004-10-31 Thread Ross Hulford
My page displays the first result and then I get the following 
error.

Warning: mysql_fetch_assoc(): 3 is not a valid MySQL result resource in 
c:\inetpub\wwwroot\testy\Untitled-1.php on line 29



Please help.

R.


my code.



?php require_once('Connections/ross.php'); ?
?php
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_ross, $ross);
$query_Recordset1 = SELECT portfolio.location_name FROM portfolio;
$query_limit_Recordset1 = sprintf(%s LIMIT %d, %d, $query_Recordset1, 
$startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $ross) or 
die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

mysql_free_result($Recordset1);
?
?php echo $totalRows_Recordset1 ?
?php do { ?
p?php echo $row_Recordset1['location_name']; ?/p
?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?

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



[PHP] code problem

2004-10-31 Thread Ross Hulford
This is my code...

?php require_once('Connections/ross.php'); ?
?php
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_ross, $ross);
$query_Recordset1 = SELECT portfolio.location_name FROM portfolio;
$query_limit_Recordset1 = sprintf(%s LIMIT %d, %d, $query_Recordset1,
$startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $ross) or
die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

mysql_free_result($Recordset1);
?
?php echo $totalRows_Recordset1 ?
?php do { ?
p?php echo $row_Recordset1['location_name']; ?/p
?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?






It displays one result then thows up the following error




Warning: mysql_fetch_assoc(): 3 is not a valid MySQL result resource in
c:\inetpub\wwwroot\testy\Untitled-1.php on line 29 

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