[PHP-DB] RE: mysl_connect question

2003-04-05 Thread Dave Carrera
Did you
 
MysqlFLUSH PRIVILEGES;
?

http://www.ephgroup.com
Secure Hosting Accounts for everyone.  

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 05 April 2003 19:42
To: [EMAIL PROTECTED]
Subject: mysl_connect question 


When I use myssql to connect to a db with anything besides root I get an
error that I cannot connect.  I created a user that has access to one
databse called 'menu'. The user has SELECT, UPDATE, and DELETE
permissions for that database. 

I can connect on the command line: mysql-u newuser -p.  But no luck
using mysql_connect().

Anyone have this problem?


.T


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.465 / Virus Database: 263 - Release Date: 25/03/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.465 / Virus Database: 263 - Release Date: 25/03/2003
 


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



[PHP-DB] An interesting Apache Log to MySql ?

2003-03-29 Thread Dave Carrera
Hi All

I have been trying to find a way to write Apache Log data to a MySql db
via a pipe log directive.

So far I have this:

LogFormat %v:*:%B:*:%u:*:%f:*:%h:*:%a:*:%s:*:%{%Y-%m-%d
%H:%M:%S%z}t:*:%{Content-type:}o:*:%U:*:%{Referer}i:*:%{User-Agent}i:*:%
{cookie}n mysqllog

As my Logformat directive. It is delimited by :*:.

Now the log part I am having problems with.

CustomLog |/usr/local/bin/php phplog.php mysqllog

I was thinking that I should write in the phplog.php all the connection
stuff and load Logformat data in to it but I dont know where or how to
get the data. I dont want to write the log file then read it in as that
defeats the object I am looking to do.

I dont want to use mod_sql thing as I am not allowed to compile new
modules.

So I think I am asking what do I put into this:

$loaddata = mysql_query(insert into table ...)

To load the data from LogFormat.

If you can advise or help with this I will be most thank full.

Dave C
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 17/03/2003
 


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



[PHP-DB] Generate thumbnails from MySql database

2003-03-27 Thread Dave Carrera
Hi all

I have a database holding file locations of images on my system.

This works fine and shows them fine on a webpage.

I was wondering if it is possible to generate and automatic thumbnail
from the original image (all jpegs) so that I can click the thumbnail to
see the larger image. I know I can make a small image and a large images
and store and retrieve those  but I was just wondering if it is possible
to do auto thumbnails from the array of images.

Thanks for na advice in advance

Dave C

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 17/03/2003
 


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



[PHP-DB] Grabbing emails into MySql

2003-02-24 Thread Dave Carrera
Hi All

How would I go about grabbing ALL emails to a SMTP box and placing there
contents and heads (individual parts of the message) into a MySql
database.

I have a feeling its a file to array kind of thing or a fsock thing but
not sure.

I have never attempted this kind of thing so any examples, websites,
tips would be very much appreciated.

Thanks in advance for any assistance.

Dave Carrera

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.456 / Virus Database: 256 - Release Date: 18/02/2003
 


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



[PHP-DB] fgets find string help please

2003-02-11 Thread Dave Carrera
Hi all
 
I would like to find a string say “hello” from the result of my
fsockopen result.
 
I have searched all over for an answer but to no avail so I hand it over
to you clever people here.
 
The kind of result I want is if string excists the $result = 0 else
$result = 1
 
I can carry on from there….
 
while(!feof($socket)) {
   echo fgets($socket,128);
  }
  fclose($socket);
 
$socket is working and echoing a result.
 
Any help is very much appreciated
 
Dave Carrera

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003
 



[PHP-DB] My whois function help please

2003-02-08 Thread Dave Carrera
Hi All
 
I am so close yet so far.
 
I have made this function to do a whois lookup then return a list of the
results from two whois servers.
 
What I cant get to work is the list of results, the bit echoed at the
end.
 
If any one of you kind people could show me where I have gone wrong I
would very much appreciate it.
 
Once I have this working I will place it on my site to download in case
anyone else could use it. :-)
 
As always thank you very much in advance.
 
Yours truly,
Dave Carrera
 
-- Start of My Whois Function --
 
Function DomLookUp($domain){

$name = $_POST[domain];

$name_arr[] = $name.com;
$name_arr[] = $name.net;
$name_arr[] = $name.org;
$name_arr[] = $name.co.uk;
$name_arr[] = $name.me.uk;
$name_arr[] = $name.plc.uk;
$name_arr[] = $name.ltd.uk;
$name_arr[] = $name.org.uk;

$c = count($name_arr);
for($i=0; $i $c;$i++){
if($i = 2){

$lineNumber = 8;
$fp = fsockopen (whois.crsnic.net, 43, $errno, $errstr, 30) or
die($errno: $errstr);
fputs($fp, $name_arr[$i]\n);
while (!feof($fp)) {
$serverReturn = fgets($fp, 2048);
$x++;
if ($x == $lineNumber) {
$line = $serverReturn;
}
}
fclose($fp);
$token = strtok($line, );
if ($token == 'No') {
$result .= Not Available;
} else {
$result .= Avaliable;
}
   return $result;

  }

  }
if($i 2){

   $lineNumber = 2;
$fp = fsockopen (whois.nic.uk, 43, $errno, $errstr, 30) or
die($errno: $errstr);
fputs($fp, $name_arr[$i]\n);
while (!feof($fp)) {
$serverReturn = fgets($fp, 2048);
$x++;
if ($x == $lineNumber) {
$line = $serverReturn;
}
}
fclose($fp);
$token = strtok($line, );
if ($token == 'No') {
$result .= Not Available;
} else {
$result .= Avaliable;
}
return $result;

  }
 }



if(isset($_POST[domain])){
 $answer = DomLookUp($domain);
 $reply .= $answer;
 echo $reply;
}

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.445 / Virus Database: 250 - Release Date: 21/01/2003
 



[PHP-DB] Array Issue help please

2003-01-20 Thread Dave Carrera
Hi All
I have nearly got this working but it dose not seem to loop though or
return the result
 
I have done something wrong and I ask one of you coders that are much
cleverer that I to glance over my code to see the obvious mistake / s.
 
Thank you in advance for any help
 
Dave Carrera
 
// Start of my code
 
if(isset($_POST[domain])){
$uswhois = whois.networksolutions.com;
$ukwhois = whois.nic.uk;
$arr =
array(.co.uk,.org.uk,.plc.uk,.ltd.uk,.me.uk,.com,.net,.or
g);
echo Top Level Domains: br /br /;
 $domname = $_POST[domain];
  while(list(,$tld)=each($arr)) {
   if(($tld == .com) || ($tld == .net) || ($tld == .org)){
   $whois = $uswhois;
   $linenumber = 8;
   }
   else
   {
   $whois = $ukwhois;
   $linenumber = 2;
   }
   $stld = $domname$tld to $whois using line $linenumberbr /;
   echo $stld;
   for($i=0;$i=count($arr);$i++){
 $fp = fsockopen ($whois, 43, $errno, $errstr, 30) or die($errno:
$errstr);
fputs($fp, $domname$tld\n);
while (!feof($fp)) {
$serverReturn = fgets($fp, 2048);
$x++;
if ($x == $lineNumber) {
$line = $serverReturn;
}
}
fclose($fp);
$token = strtok($line, );
if ($token == 'No') {
$result = 0;
} else {
$result = 1;
}
return $result;
}
$answer = $result;
   if(isset($answer)) {
 $checkeddom .= img src=\./img/x.jpg\ border=\0\nbsp;font
color=red$_POST[domain]$tld/fontbr /;
   } else {
 $checkeddom .= img src=\./img/tick.jpg\
border=\0\nbsp;font color=green$_POST[domain]$tld/b/fontbr
/;
   }
 }
 
}
//End of my code
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 10/01/2003
 



[PHP-DB] Array help please

2003-01-19 Thread Dave Carrera
Hi All
I am trying to create a tld lookup script for uk and main us domains.
 
I have success by creating multiple function hardcode the whois server
and tld but I would love to be able to make an array of tlds then step
through the array to check availability of domain.
 
Example
 
$arr = array(‘.co.uk’,’.com’,’.net’,’.me.uk’);
 
How do I step though one at a time and give a viewable result?
 
I know I have to check the value of the array and assign the relevant
whois server. How do I do that?
 
Any help, guidance, code examples will be very much appreciated.
 
Thank you in advance as always
 
Dave Carrera

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 10/01/2003
 



[PHP-DB] Make new linux user accounts with pjp /mysql

2002-12-14 Thread Dave Carrera
Hi All
I think this may be a bit of topic but here goes.
I would like to know what logic is needed to create a new user on a
Linux box
Once this user has completed a sign up.
I want to create my own php / mysql driven webhost control panel which
allows
 
Creation of vhost in http.conf
Creation of user account
Creation of a MySql db for that user
Creation of pops for that users
 
Just like some other Host CP's I have seen.
 
Maybe store info in a db for users to be able to edit / add services.
 
Any thoughts, examples, warnings, advice as always appreciated.
 
This will be running on a LINUX box if that make a difference.
 
Thank you in advance and again sorry if its slightly of topic.
 
Dave C



[PHP-DB] MySql Statement inside a function?

2002-10-18 Thread Dave Carrera
Hi All

I have created a function and insde that function it dose a standard
select, fetch_arry, while loop.

I get a error from mysql saying not a vaild resource but if I take the
statemnet out of the function all works fine and dandy.

Are there things I should be aware of when trying to include mysql
statements inside a function?

I have include my code here if it helps.

function getnames(){
 $gnlistsql = select name from $tbn2;
 $gnlistres = mysql_query($gnlistsql);
 while($nlist = mysql_fetch_array($gnlistres)){
 $nlistop = option value=\$nlist[name]\$nlist[name]/option;
 $nlistsel = select name=\getname\$nlistop/select;
 echo $nlistsel;
 }
}

There error is reported back in the while line...

Any help or advice is appreciated as always.

P.S reason for the fuction is that I will call the select a name list a
few times so I thought of making it a function then calling it when
needed.

Thank You

Dave C


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




[PHP-DB] Showing multiple option list from db query?

2002-10-03 Thread Dave Carrera

Hi All

I have a database (mysql) that has some rows entered.

Format:
Name | Desription | catid

This has some info in it like this

Joe Man 1
Jack Man 1
Jacky Female 2
Emily Female 2

What I am trying to do is create dynamically created select lists so
that all with catid 1 are in the fisrt select list and all with catid 2
are in a separate second list and so on.

I have it nearly working but the first list gives the cadid 1 result the
second gives catid 1 and catid 2 result and so on.

So how would I split the results?

As always I thank anyone who helps me with this issue fully in advance.

Dave C


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




[PHP-DB] Writing to files (db related) ish

2002-09-25 Thread Dave Carrera

Hi All

I know how to open, read  write to files using Php.

But how can you write some content to a particular place in a file,
Not the start or end but say the middle some where.

Example:

Basic html file

html
head
title/title
/head
body

Write my stuff here!!!

/body
/html

This eventually will relate to a db so I hope its not completely of
topic.

Sorry if it is.

Web resources, examples, tutorials gratefully received.

Thanks in advance

Dave C


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




[PHP-DB] Form Error Checking ?

2002-08-27 Thread Dave Carrera

Hi All

I am very fed up and confused to why some simple form error checking is
not working.

All I want to do is check if a field has something in it the its ok else
show error.

I have a fields in my form that is for people to upload an image.

I have tried this.

If(!$_POST[img]){
Do something
}

Or this

If(!$_FILE[img]){
Do something
}

Or this

If(empty($_POST[img])){
Do something
}

Or this

If(empty($_FILE[img])){
Do something
}

Or this

If(!isset($_POST[img])){
Do something
}

Or this

If(!isset($_FILE[img])){
Do something
}

And many other permiatations of these functions but to no avail. All I
get is my error msg whether or not the field has anyhting in it or
nothing but never the desired affect.

Its got to be something to do with global vars on switch as if I swith
it off and go back to just calling the var it works a treat.

This needless to say is giving me a headache as it is vital that I check
the form before posting.

So any help or guidence will be very much appreciated.

Yes I have checked php.net and various other doc sites, just in case
anyone says check the docs.

Hope your all well

Dave C


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




[PHP-DB] Select * from t1.id where not equal to t2.id ???

2002-08-03 Thread Dave Carrera

High all
 
I cant seem to get this sql working.
 
I am trying to pull everything from table 1 (t1) where t1.id is not
equal to table 2 (t2) id
 
I cant find examples anywhere.
 
Any help or guidance with this as always is very much appreciated.
 
Thanks in Advance
 
Dave C



[PHP-DB] Multiple select ?

2002-08-01 Thread Dave Carrera

Hi All
I have a situation where I need to do select on my mysql db.

Here is what I am trying to do

Select * from table_name where col1=1 and col2=1 and col3=0

But this refuses to work.

If I change the above to this.

Select * from table_name where col1=1 OR col2=1 and col3=0

What I get is all rows whether or not col3 is 0 or 1.

I am confused ☹

Any help or guidance is very much appreciated.

Thanks in advance

Dave C


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




[PHP-DB] Header problem

2002-07-15 Thread Dave Carrera

Hi All
 
My isp decided to upgrade to 4.2.1 without letting us know?
 
So recoded scripts with new $_VARS in place but one thing refuses to
work
 
I have in my script a call to header location.
 
header( Location: ./file.php);
 
Works on my system but not on theirs
 
I have 4.21 also.
 
Is there anything new with header location that I haven't heard of?
 
Any help is most appreciated.
 
Dave C



[PHP-DB] RE:using rand() in multiple insert ?

2002-07-06 Thread Dave Carrera

Hi All 
I worked it out.
 
If you would make use of this kind of thing email me and I will gladly
give the code example.
 
Thanks Anyway
 
Dave C



[PHP-DB] making sub dirs ?

2002-06-16 Thread Dave Carrera

Hi All

I have been hunting the answer to this for ages now and hope one of you
clever prople could help.

I wish to create a subdirectory in my images directory using my visitors id
number.

So i have an /img dir for all images and wish to create a directory based on
clients id num from db and then transfer thier uploaded image to thier newly
created directory.

I am using php4.2 apache 1.3+

I thank you in advance for any help.

Dave C


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




[PHP-DB] Array_rand issue...

2002-05-31 Thread Dave Carrera

Hi All

I have a fuctioning array of about 20 items.
What i would like to do is display 3 items from the array randomly and be
able to place the output anywhere on the screen.

I have looked at array_rand and associated functions at php.net and are
currently playing with the code to see if i can make it work but some
guidence in this matter would be very much appreciated.

Thank you in advance

Dave C


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




[PHP-DB] sql statement via var

2002-05-26 Thread Dave Carrera

Hi All

I am trying to load a mysql statement which i have tested and know to work
from a var in my script.

It is a create table statement.

I have a good connection as a table list shows tables.

I tried to echo my var but no joy

Any ideas?

Thanks in Advance

Dave C


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




[PHP-DB] Sql from file

2002-05-26 Thread Dave Carrera

Hi All

I have a working mysql statement that i would like to load from a file using
my php script

It first drops table if excists
then creates table
then loads sample data

I have tried many different ways but no success :-(

Any help or ideas would be most appreciated

I have a good db connection of which a can echo what i want.

Thank you for any help in advance

Dave C


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




Re: [PHP-DB] db sql issue from var

2002-05-26 Thread Dave Carrera








  Hi Rasmus
  
  Ithink it an issue with including multiple sql commands in one 
  var...
  
  as i see it...:
  
  the drop table bit is one coomand and the create table is one 
  command.
  
  When i run these with or with the seperating ; it comes back with the 
  mysql error.
  
  What i am trying to do is in thery simple.
  
  Dump structure and dat from a table with drop table command to a .txt 
  file
  
  then load it back in via my script.
  
  I have tried infile, file() and straight forward global var to no 
  avail.
  
  4 hours of searching the net has'nt yeild any working light on this 
  issue and i am confident this is not rocket science just me giong about it 
  the wrong way.
  
  The load from file would be the best result for me.
  
  Any pointer and or code example would be most appreiciated.
  
  Thank You
  
  Dave C
  
  ---Original Message---
  
  
  From: Rasmus Lerdorf
  Date: Sunday, May 26, 
  2002 16:20:39
  To: Dave Carrera
  Cc: php List
  Subject: Re: [PHP-DB] 
  db sql issue from var
  Well, where is your ';'? At the end of the statement? You 
  don'tterminate queries with semi colons when talking directly to the 
  database.Just remove it.-RasmusOn Sun, 26 May 2002, 
  Dave Carrera wrote: Hi All I have found the 
  problem from my last post and need to know how to solve 
  it. Example sql var: $sql When i 
  run the script i get Mysql error near ';' create 
  table.. So how do i run this command from my script to 
  include the ; as part of the sql. phpmyadmin copes 
  with this ok so it must be able to be done. Thanks for any 
  help in advance Dave C -- 
  PHP Database Mailing List (http://www.php.net/) To 
  unsubscribe, visit: http://www.php.net/unsub.php.





	
	
	
	
	
	
	




 IncrediMail - Email has finally evolved - 
Click 
Here



[PHP-DB] setcookie warning?

2002-05-23 Thread Dave Carrera

I get this warning with setcookie

Warning: setcookie() expects parameter 3 to be long, string given

But the cookie works ok

this is the line setting the cookie

setcookie(selarea,$gotarea,/ );

any ideas

i am using php 4.2

Thanks in advance
Dave C


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




[PHP-DB] refreshing an array

2002-05-23 Thread Dave Carrera

Hi All
Thanks for the answer about the cookie issue.

I have an array gather from a mysql db, which make a list to show clients no
prob.

You click on a message in the list sent by my clients customers and answer
this message. No Prob there.

But when i echo this list on the confirm reply page so they can get the next
meesage it still shows the one just answered to.

So how can i refresh this list.

It work as it is which shows a message when replied and then my client
clicks on get new messages but not when i call it on the replied page.

All to save one click.

All help and guidence is most appreciated

Dave C


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




[PHP-DB] Easy one for you guru's :-)

2002-05-11 Thread Dave Carrera

Hi All

 

Can someone breakdown the logic of adding and subtracting products to a
shopping cart using sessions.

 

I can't quite get the logic so something in plain English would help
very much.

 

Any helpful advice, pointers or even code examples are very much
appreciated.

 

Thank you fully in advance for any help you may give.

 

Dave C




[PHP-DB] Re: php-db Digest 1 May 2002 19:24:34 -0000 Issue 1181

2002-05-02 Thread Dave Carrera

Hi Frank,

Thank you for the help and example you included in your reply.

With the help gained by all that answered I concocted this work around which
works perfectly.

I have included the code to help anyone else who needs this kind of result.
It has two table references

the first gets admin data and the seconds uses the admin data to reference
the 2nd table for all instances.


-- My Code Snippet -
$whichadminsql = select id, user from $tbn;

$whichadminres = mysql_query($whichadminsql);

while($adname = mysql_fetch_array($whichadminres)){

$adid = $adname[id];

$adnm = $adname[user];

$query = select count(admin_id) as Admin1 from $tbn3 where admin_id=$adid
;

$result = mysql_query($query);

$object = mysql_fetch_object($result);

$Admin[$i] = $object - Admin1;

$adminstatsshow .= $adnm has $Admin[$i] posts.br;

}

// Variables used are specific to my tables and needs and will need changing
to your suit your needs.

-- End My Code Snippet -

Once again Thank you





Frank Flynn [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi Dave,

 The easiest, most direct, ANSI - SQL way to do what you ask is:

 SELECT count(*) as num_posts, Admin_id
   FROM your_table_Name
   WHERE optional but you could narrow the results here
   GROUP BY Admin_id
   ORDER BY Admin_id

 This will give you:

 num_posts  Admin_id
 -  
   3 1
   4 2
   5 3

 And naturally you can do whatever you like with these values in your PHP
 code.  The only potential got ya is if you had an Admin_id 4 who had no
 records you would not get 0, 4 you would not get a row for 4 at all.
There
 is a way around.  Ask me if you need it.

 Also GROUP BY has it's own kind of WHERE clause called HAVING.  The WHERTE
 clause operates on the raw data (like any other query) but HAVING works on
 the aggregate functions (like count, min, max, ave) so in this example we
 could add this line right after the GROUP BY:
   HAVING count(*)  4
 This would make the query only return the 5, 3 row.

 Good Luck,
 Frank

 On 5/1/02 12:24 PM, [EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:

  From: Dave Carrera [EMAIL PROTECTED]
  Date: Wed, 1 May 2002 13:02:51 +0100
  To: [EMAIL PROTECTED]
  Subject: Count and group ?
 
  Hi All
 
 
 
  I have added a row to my table which inputs which admin user has amended
  a record in a table on my db.
 
 
 
  I have this working but what I would like to do is count how many
  instances of the admin id I have stored.
 
 
 
  So if my list looks like this..
 
 
 
  Admin_id
 
  1
 
  2
 
  2
 
  2
 
  3
 
  3
 
  3
 
  3
 
  3
 
  2
 
  1
 
  1
 
  Then the result I would like to display is this..
 
 
 
  Admin (1) = 3 posts
 
  Admin (2) = 4 posts
 
  Admin (3) = 5 posts
 
 
 
  Basically displaying the total post each admin has made
 
 
 
  Any help or guidance is very appreciated and thank you in advance
 
 
 
  Dave Carrera
 
  Php Developer
 
  http://davecarrera.freelancers.net
 
  http://www.davecarrera.com
 
 




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




[PHP-DB] Count and group ?

2002-05-01 Thread Dave Carrera

Hi All

 

I have added a row to my table which inputs which admin user has amended
a record in a table on my db.

 

I have this working but what I would like to do is count how many
instances of the admin id I have stored.

 

So if my list looks like this..

 

Admin_id

1

2

2

2

3

3

3

3

3

2

1

1

Then the result I would like to display is this..

 

Admin (1) = 3 posts

Admin (2) = 4 posts

Admin (3) = 5 posts

 

Basically displaying the total post each admin has made

 

Any help or guidance is very appreciated and thank you in advance

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 




[PHP-DB] htaccess quick ?

2002-04-08 Thread Dave Carrera

Hi All

 

I want to make this htaccess file

 

Allow to www.domain.com/admin

Allow ip number1

Allow ip number2

Allow ip number3

Allow ip number4

Deny everyone else

On error go to a 404 page of my own making.

 

How do I do that?

 

As always your help and pointers are most appreciated.

 

P.S got the restrict by ip number sorted I think..

 

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 




[PHP-DB] Apology for htaccess post

2002-04-08 Thread Dave Carrera

Hi All

 

I accidentally posted a topic concerning htaccess in this list.

 

In my rush I posted to this list which was not intentional. 

 

I humbly apologize for this and will try to slow down in the future

And check to where I am posting.

 

I am sorry if this caused any annoyance to any user of this list.

 

P.S found the answer to this issue.

 

 

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 




[PHP-DB] Keep state of a selected field?

2002-04-06 Thread Dave Carrera

Hi All

 

I have a dynamic drop down list that work perfectly.

But what I would like to do is when a user selects where to got

That the selection is shown on the next page as the selected item.

And if they change this selection that it is then shown as the selected
item.

 

Any pointers of ideas are appreciated as always.

 

At the moment I am trying this:

 

If(isset($selection)){

$selected =option selected=\selected\
value=\$selection\$selection/option;

}

else

{

whatever.

}

 

then echoing result on page.

 

The variables shown are not the ones being used, just shown for
displaying the way I am trying at the moment.

 

Keep happy

 

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 




[PHP-DB] Please help count ?

2002-04-04 Thread Dave Carrera

Hi All

 

I have a variable returned by my application.

 

For clarity it is a post code so result could be

 

EX3 T56 or BG56 G67 or CA2 123

 

But I only need the first bit of the postcode to continue my search.

 

How do I set my var to only include the first bit of the postcode.

 

It is returned in the format shown, so my question might be how I read
only the first bit before the space.

 

I fully appreciate any kind of help with this and as always thank you in
advance for any help.

 

 

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 




[PHP-DB] saving details problem (big)

2002-04-04 Thread Dave Carrera

Hi all

I am making use of AFD postcode lookup application.

 

What it dose is ask for your postcode and returns your address.

You may have seen this around the web..

 

Well my problem is that I have added 3 extra fields 

 

Name, email, phone number

 

And I need to save this info.

 

I have tried sessions and cookies but have just noticed

That the form action is a cgi file on the afd server. Thus this is
stopping me

Saving info.

 

Any ideas on how I can save the info.

 

I am in a back to the wall situation so any pointer and guidance is

Most appreciated.

 

P.S Had it work all fine and dandy when I added the extra info after
postcode lookup but customer insisted he wants it this way round.
Customers...

(cant live with them, cant live without them...)

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 




[PHP-DB] Pop up are you sure...

2002-04-01 Thread Dave Carrera

Hi All

 

How do you do this?

 

On click of button to delete a record make a popup yes / no box appear.
On yes then do it else stop.

 

Is it possible to do with out using JS?

 

Thanks for any pointers or code in advance.

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 




Re: [PHP-DB] Pop up are you sure...

2002-04-01 Thread Dave Carrera

Hi all,

 

Thank you all for you advice.

 

I am aware of the two ways of achieving the required result ie: JS and
extra button built into my script.

 

But wouldn't it be nice to have a class or function we could all use
built in to php that would let us do this.

 

C,C++,Delphi and JS allow you to do this.

 

I have come across various probs with JS on client systems so I shy away
from it.

 

Again thank you all for your advice.

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 




[PHP-DB] Very wierd problem ;-(

2002-03-27 Thread Dave Carrera

Hi All

 

I will try and explain as clearly as I can

 

I have a message board type of script.

 

User logs in = no prob

User posts message = No prob can see message on db and retrieve a list
of new posts.

 

Now the prob.

 

I am to reply to the message via an admin area by selecting the message
fron a generated list abd click on get message and it should give back
what was said.

 

When I log in and or create a new user and leave a message I can get all
the details and send a reply.

 

But when I try and get back the details of a message that someone else
has left I cant get the message and cant reply.

 

Got me foxed.

 

What could I be doing wrong?

 

Any ideas as always appreciated.

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 




[PHP-DB] A text file include ?

2002-03-25 Thread Dave Carrera

Hi All,

 

I know how to include the contents of a test file into my app.

 

But at the moment I have to type in p/p tags to make in render
properly.

 

Is there a way of reading the contents and dynamically creating
paragraph breaks or line breaks?

 

 

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 




[PHP-DB] 2 related ?'s email users

2002-03-25 Thread Dave Carrera

Hi All

 

I hope you can shed some light on the logic behind these 2 issues.

 

1)   How do I make an email verify type of thing? So user enter
there email address as part of the sign up process and we send an email
to that address. That bit I've got. But how do you check the reply to
the address stored and then activate the account. It's a for online
support manager im writing hence the importance of a verified email
address.

2)   Suggest a Username? I have seen some places that when you put
in an onscreen name and click send it checks against the list of
usernames already stored and if it matches it comes back an error saying
that username already exists but how about this one, which is the name
you chose plus a incremental number. So visitor puts in say Fred but
Fred exists and so does Fred up to Fred19. How do I check this and offer
Fred20 as a suggestion.

 

I hope someone can help with this.

 

As always I thank you in advance of any help, code samples or pointers.

 

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 




[PHP-DB] How to add 2 years to todays date ?

2002-03-17 Thread Dave Carrera

Hi All
I think the subject line says it all.
 
How to add 2 years to today's date ?
 
Any helps as always most appreciated.
 
 
 
Dave Carrera
Php Developer
http://davecarrera.freelancers.net
http://www.davecarrera.com
 
 



[PHP-DB] I have a in my db ?

2002-03-06 Thread Dave carrera

Hi All

 

I think this has something to do with either

 

Stripslashes or Addslashes but which one. And where do I use it.

 

I have a product that has a  in the name and I have created a drop down
list from the names.

 

I cant get it to reg the name. all it reg is 15 instead of th full name
which is 15 lcd Monitor.

 

How do I get past this issue

 

The php manual has no usage examples relevant to my needs.

 

Please help

 

Dave c




[PHP-DB] Shopping Cart ?

2002-02-24 Thread Dave Carrera

Hi All,

I am developing a shopping cart for a customer. No Prob there.

Is there any info around, or can someone supply, on how to

Link the buy button to a ccp.

I think what I mean is the customer has no credit card processor at the
moment

So I want to be flexible with the buy button links ( I think...).

Is there some kind of code example for this.

As Always thank you in advance for any snippets of wisdom.

Dave Carrera
Php / MySql Development
Web Design
Site Marketing
http://www.davecarrera.com
 



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




[PHP-DB] How do I add multiple var to a if clause ?

2002-02-21 Thread Dave Carrera

Hi All

If($var == 1,2,3){
}
This is wrong so what is the right way.

I am try to find out a if var equals either 1 2 or 3 do something type
thing but cant find answers anywhere

Thanks in Advance

Dave Carrera
Php / MySql Development
Web Design
Site Marketing
http://www.davecarrera.com
 



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




[PHP-DB] I cant get the logic for this...

2002-02-18 Thread Dave Carrera

Hi all,

I want to display return results from my query (which works fine)
In I tidy way on screen.

So my result returns say seven results, I have a table, and I want to
show
3 results per row of the table... I.e.:

Table
TR
TD = result1 /TD  TD result2 /TD TD = result3 /TD
/TD
/TR
TR
TD = result4 /TD  TD result5 /TD TD = result6 /TD
/TD
/TR
TR
TD = result7 /TD  TD resultempty /TD TD = resultempty /TD
/TD
/TR
/table

The last two td in row 3 are empty because result found 7 results.

This cant be fixed so echo statements wont work as the result could
Be 3 or 10 or 56 or whatever.

As Always your help and or guidance in this matter is appreciated.

Dave Carrera
Php / MySql Development
Web Design
Site Marketing
http://www.davecarrera.com
 



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




[PHP-DB] RE: I cant get the logic for this...

2002-02-18 Thread Dave Carrera

Firstly thanks to everyone who have supplied various way to implement
the issue I was having.

Unfortunately I cant seem to get any one of them to function correctly

I have included my code to see if someone can help adjusting it.

I think I am going wrong in where I am putting the count var.

You may notice I am using the var $v1list. this is so I can display the
output in suitable place on screen.

The code I have included makes my 7 selected items go straight across
the page(obviously) hence the need to
Block it of with some kind of count function.

Thank you for any help or advice

Dave C
CODE HERE--
if(ISSET($category)){

 $viewsql = select * from $tbn2 where catid = \$category\ ;
 $viewres = @mysql_query($viewsql, $con) or die (Cant get details.
Please report this to the website administrator);
 $num_rows = mysql_num_rows($viewres);
 while( $v1rows = mysql_fetch_array($viewres) ){ 
 $name2 = $v1rows[name];
 $id2 = $v1rows[catid];
 $simg = $v1rows[smallimg];
 $v1list .=td$name2/bra href
=\./viewdetails.php?pcategory=$id2pname=$name2\img src=$simg
border=0/a/td;

}
}

Dave Carrera
Php / MySql Development
Web Design
Site Marketing
http://www.davecarrera.com
 



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




[PHP-DB] Session confusion :-(

2002-02-16 Thread Dave Carrera

Hi All

I am send variable values via set links i.e.:

http://domian_name.com/page.php?category=1

http://domian_name.com/page.php?category=2

http://domian_name.com/page.php?category=3

Etc etc

The value is sent to a session. THIS WORKS BUT.

If I click on the first link session variable category is set to 1.

But if I then click on the send , third, forth or whatever link
Session variable is still set to 1.

I have tried

If(ISSET($category)){
Unset($category);
Session_register(category) // hoping it would accept the new sent value.
}

No Go

Can anyone throw some light on this please.

As Always I am grateful for any pointers or exampled help

:-)

Dave Carrera
Php / MySql Development
Web Design
Site Marketing
http://www.davecarrera.com
 



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




[PHP-DB] Deleting from a select list ? :-(

2002-02-14 Thread Dave Carrera

Hi All,
I have this code creating a list in a select box.

All works ok, I get my list BUT and a NIG BUT.

When I select an item to delete it only ever deletes from the last
record to the top.

Err why ?

I think all my code is in the right order but obviously not.

Can anyone throw some light on this.

As always thanks for past and future help

Dave C :-)

--MY CODE STARTS HERE ---

$deloptions_sql = select * from $tbn2;
$delresult = mysql_query($deloptions_sql, $con) or die(error:
.mysql_error());
$delrows = mysql_num_rows($delresult); 
for ($i = 0; $i  $delrows; $i++) {
$listdelrows = mysql_fetch_array($delresult); 
$name2 = $listdelrows[name];
$id2 = $listdelrows[id];
$del_list .=option name=\delprod\
value=\$id2\$name2/option;
}

if($delproduct){
$del_sql =delete from $tbn2 where id = '$id2' and name =
'$name2';
$del_res = mysql_query($del_sql,$con) or die (Unable to Delete
Product);
$delproductmsg = Deleted $name2 from $p_cat_name;
}
--ENDS HERE---
Dave Carrera
Website Designer
http://www.davecarrera.com
 



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




[PHP-DB] A while loop prob ?

2002-02-13 Thread Dave Carrera

Hi All

What have I done wrong here.

3 yes 3 hours I have been plaing with this loop.

All it shows is the last record in my db.

It should show and record containing any string in the search.

Error works

Please help I beg you...

As always thank you for any help

Dave C

- My Code Starts Here 

if ($submit){
if($search == ){
$error1 = font color=redNo Records found. Please use at least
1 character in search box/font;
}
else
{
$srchsql = select * from $tbn where name like \%$search%\ ;
$srchresult = mysql_query($srchsql, $con);
$name =$srchrow['name'];
$details =$srchrow['details'];
$price =$srchrow['price'];
$imgloc =$srchrow['imgloc'];
while (list($name, $details, $price, $imgloc)
=mysql_fetch_array($srchresult)){

$display_srch_rows =
trtd$imgloc/tdtd$name/tdtd$details/tdtd$price/td/tr
;
}
}
}

Dave Carrera
Website Designer
http://www.davecarrera.com
 



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




[PHP-DB] Select rows where ?

2002-02-12 Thread Dave Carrera

Hi All
How do I select the rows that DO NOT contain a certain character.

I.e. : select * from tablename where field dose not contain A

Any pointers as always appreciated.

davec

Dave Carrera
Website Designer
http://www.davecarrera.com
 



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




[PHP-DB] Counting db generate links

2002-02-05 Thread Dave Carrera

Hi All
How do I count how many time a certain link generated in part from my db
has been click so that I can show this number to my visitors as some
kind of hit list, top 10 etc:

I thank you in advance for any help


Dave Carrera
Website Designer
http://www.davecarrera.com
 



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




[PHP-DB] Selct show certain num records ?

2002-01-30 Thread Dave Carrera

Hi All

I know this has been covered here before but can someone please remind
me how to selct just the 5 latest records in my db and show them in list
form.

Just like phpbuilder.com dose

I thank you in advance for repeating this information.

Dave C :-)



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Recalculation ?

2002-01-18 Thread Dave Carrera

Hi All,

I have create a page to calculate qtys and show totals.
This works fine, except that I change a qty the change is not registered and
calculate from the old value.

I am using sessions and have try a loop of
if($qty == $qty){
than calc stuff here}
else{
session_unset($qty);
session_register($qty);
calc stuff here
}

And have tried other ways but to no avail.

Can someone throw any light on this.

As always any help is appreciated.

Dave C




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Reading and Writing ?

2002-01-17 Thread Dave Carrera

Hi All

How can I read the contents of 1 file then Write those contents to a
newfile?

This is baffling me.

I Know about fopen,fread,fwrite but cant seem to get the logical steps clear
in my head.

As always any help or pointers given are most appreciated.

Yours

Dave C



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] A local file copy question

2002-01-15 Thread Dave Carrera

I am trying to copy a file on my system from one local place to the path of
my script.

So...

FILE TO COPY = c:\dir\filename.php

COPY TO = ../dir/filename.php

I need to work out how to determin the local path of my script thus allowing
my script to know where ../dir is relitive to. I Think

I can not fix the scripts path as i dont know where people un zip the script
to on thier local system.

Any help or guidence as aways, is most appreiciated.

Yours

Dave C

The two rules for success are:
1. Never tell them everything you know.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Create Table from a file in php

2002-01-11 Thread Dave Carrera

Hi All

I want to create a table from a file that contains the sql to create the
table.

I have checked Mysql.com and have seen how to do it from telnet, but i want
to do it from a php script.

Can anyone please help.

Thanks in Advance

Dave C

The two rules for success are:
1. Never tell them everything you know.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] adding $ to my file

2002-01-08 Thread Dave Carrera

Hi All

I am trying to add this to a file on my system

$var = $string_submited_by_form

All i get when i run the script is an input to my file like this

= string_submited_by_form

whithou the $var at the beging

Can anyone please help.

Thanks in Advance

Dave C

The two rules for success are:
1. Never tell them everything you know.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] I think i saw this somewhere....

2002-01-06 Thread Dave Carrera

Hi All

I think i saw a php script somewhere on my web travels, that allows you to
include
sub domain reg to your web site.

it allowed you to offer

http://yourname.choiceofdomainname.com

so the visitor can have thier name in front of a domain name reged to our
webspace.

If i remeber right, it had a mysql db in the background.

Is this kind of thing available or did i dream it.

As always any pointers of advice is welcome

Dave C

The two rules for success are:
1. Never tell them everything you know.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] product selection from url ?

2001-12-30 Thread Dave Carrera

Hi All

Seasons greetings and a Happy new year.

How do i selct from my MySql dbase a specfic product from a issued url ie:

http://www.domain-name.com/products/?pid=1234

I have seen this done on other sites

The idea is to issue a url to my site with the pid so that people who cklick
on it only see that specific product.

Any help is apprieciated

Keep happy and well

Dave C

The two rules for success are:
1. Never tell them everything you know.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] How do i search my database...

2001-11-10 Thread Dave Carrera

Hi All,
I have a database with only three fields

FIELD 1
FIELD 2
FIELD 3

I want the user to input into FIELD 3, and then my script to go of to my
database and see if it finds a match or something like the input and display
it to the screen.

Please help as i can't seem to get my brain around this

Thanks in Advance


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Step through an array

2001-09-09 Thread Dave Carrera

Hi all

I have a list of images that i way to step through at 5 second intervals.

I think i need to create a timed loop.

So i have a list of images:

image01
image02
image03
etc:

I want to be able to have the script start at image01 and wait 5 seconds
then goto image02 and so on.

Any ideas or pointers would of grate help

Thanks in advance

Dave C


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] A timed refresh ?

2001-09-02 Thread Dave Carrera

Hi All,
Could someone please point me to somewhere or give pointers of guidance, to
a way of solving this issue.

I have an array of which shows an image in a place on my page which shows
the next on the list when the page refreshes, this works fine.

What I want to do is have the image refresh on a 5 second timed interval.

So:

I have a list of images i.e..:

image_1.gif
image_2.gif
image_3.gif

Which I want to refresh every 5 seconds

As always I Thank you for any help in advance.

Yours

Dave C


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] counting and displaying a how many figure

2001-08-04 Thread Dave Carrera

Hi All

I would like to know how to count how many downloads of a file I have on my
site is downloaded and display something like  file.name downloaded 
times on my page.

I have this idea using mysql db.

table files

ID int autoincrment,

file_name,

URL,

I believe this would utilise something like the count() function but I
haven't used this yet

Thanks for any help or guidance in this matter.

Dave C ;-)


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]