[PHP-DB] Need Help with 2 MYSQL Table

2015-04-24 Thread Guru
Hi All,

Hope everyone is doing well. I need some help regarding a project. I have a
huge list of customers in a ledger in a mysql table (Table A). And in
another table I have their names and their ID number (Table B). What I want
is when I click on a customer name from Table A,  I want php to pull out
the data of that particular customer  from Table B, and show it in a
formatted tabular manner. Please help me with this.

-- 

*Best,*



*Gu®uCEO  Founder at,www.skynetwebservices.in http://www.myshopads.com*


[PHP-DB] Need help with SQL Query

2012-04-13 Thread Rikin Parekh
Suppose I have a *BOOKS* table like the one given below:

 ISBN   |  Book Title  |  Author Name

  1   Jungle bookSam
  2   Princess Diary  Joe
  3   Titanic  Sam
  4   House  Joe
  5   Scary Movie Rick
  6   Wonders  Harry
  7   Java   Rick


I am trying to write a query which will give the *total number of book
titles written by each author*. The final result should be like

Author NameCount
  Sam2
  joe   2
  Rick2
  Harry  1

Can someone help me with this ?? I have tried

Select Author Name, COUNT(Book_Title) as Count
From Books
Group By (Author Name)

Will this above query work fine and give the results as shown?

Thank you in advance

Rikin


Re: [PHP-DB] Need help with updating existing mysql records with something else

2011-11-12 Thread tamouse mailing lists
2011/11/11 Amit Tandon att...@gmail.com:
 U can update the record with following

 ===
 $result = mysql_query(UPDATE  tax set mwool40_
 totqty = $res, $connection) or die(error
 updating database);

Won't this update every row in the table?

I think you'd want:

$result = mysql_query(UPDATE tax SET mwool40_totqty = $res
WHERE id=.$res['id'],$connection) or die(blah blah);

Where id is the identifier of the current record you're looking at
(however you've done that).

 if (mysql_affected_rows($connection) != 1 (/* no of rows that should be
 updated */)
 {
 die(Update problem) ;
 }

 The only issue is the where condition that you would put in the query
 UPDATE  tax set mwool40_totqty = $res where ...

^This. Don't leave this out.

 
 regds
 amit

 The difference between fiction and reality? Fiction has to make sense.


 2011/11/11 Guru™ nagendra802...@gmail.com

 Hi All,

 I want to update an existing mysql record with another value after
 calculating it. Below is the code.

 ?php
 $connection = mysql_connect(localhost, root, ) or die(Error
 connecting to database);
 mysql_select_db(maha, $connection);
 $result = mysql_query(SELECT * FROM tax, $connection) or die(error
 querying database);
 $i = 0;
 while($result_ar = mysql_fetch_assoc($result)){
 ?
 tr ?php if($i%2 == 1){ echo class='body2'; }else{echo
 class='body1';}?
 td
 ?php
 $res=$result_ar['mwool40_totqty']-10;
 echo $res;
 ?/td
 /tr
 ?php
 $i+=1;
 }
 ?


 I want to append the $mwool40_totqty value with the calculated one $res.
 Let say initially the value of $mwool40_totqty is 50. and after calculation
 its value became 40, then the code should edit/alter/update the value in
 mysql table with integer 40. Please help me with this.


 --
 *Best,
 *
 *Guru™*



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



[PHP-DB] Need help with updating existing mysql records with something else

2011-11-10 Thread Guru™
Hi All,

I want to update an existing mysql record with another value after
calculating it. Below is the code.

?php
$connection = mysql_connect(localhost, root, ) or die(Error
connecting to database);
mysql_select_db(maha, $connection);
$result = mysql_query(SELECT * FROM tax, $connection) or die(error
querying database);
$i = 0;
while($result_ar = mysql_fetch_assoc($result)){
?
tr ?php if($i%2 == 1){ echo class='body2'; }else{echo
class='body1';}?
td
?php
$res=$result_ar['mwool40_totqty']-10;
echo $res;
?/td
/tr
?php
$i+=1;
}
?


I want to append the $mwool40_totqty value with the calculated one $res.
Let say initially the value of $mwool40_totqty is 50. and after calculation
its value became 40, then the code should edit/alter/update the value in
mysql table with integer 40. Please help me with this.


-- 
*Best,
*
*Guru™*


Re: [PHP-DB] Need help with updating existing mysql records with something else

2011-11-10 Thread Amit Tandon
Dear Guru

U can update the record with following

===
$result = mysql_query(UPDATE  tax set mwool40_
totqty = $res, $connection) or die(error
updating database);

if (mysql_affected_rows($connection) != 1 (/* no of rows that should be
updated */)
{
die(Update problem) ;
}

The only issue is the where condition that you would put in the query
UPDATE  tax set mwool40_totqty = $res where ...

regds
amit

The difference between fiction and reality? Fiction has to make sense.


2011/11/11 Guru™ nagendra802...@gmail.com

 Hi All,

 I want to update an existing mysql record with another value after
 calculating it. Below is the code.

 ?php
 $connection = mysql_connect(localhost, root, ) or die(Error
 connecting to database);
 mysql_select_db(maha, $connection);
 $result = mysql_query(SELECT * FROM tax, $connection) or die(error
 querying database);
 $i = 0;
 while($result_ar = mysql_fetch_assoc($result)){
 ?
 tr ?php if($i%2 == 1){ echo class='body2'; }else{echo
 class='body1';}?
 td
 ?php
 $res=$result_ar['mwool40_totqty']-10;
 echo $res;
 ?/td
 /tr
 ?php
 $i+=1;
 }
 ?


 I want to append the $mwool40_totqty value with the calculated one $res.
 Let say initially the value of $mwool40_totqty is 50. and after calculation
 its value became 40, then the code should edit/alter/update the value in
 mysql table with integer 40. Please help me with this.


 --
 *Best,
 *
 *Guru™*



[PHP-DB] Need Help with Search Engine

2011-06-28 Thread Guru™
Hi All,

I coded a search engine which is pretty good on its own terms. I have
functions and conditions for blank entries or any SQL injection. However I
have a problem. When a user start search he uses words like in, for, the,
at, on etc... For example: Hotels in India or Car for rent etc.. How will I
ignore these words and take just the main words? Please help me.

-- 
*Best,
*
*Guru™*


[PHP-DB] Need Help with PHP Mails

2011-04-04 Thread Guru™
Hi All,

I have this HTML form


style type=text/css
!--
.style14 {font-size: 24px
}
.style14 {font-size: 12px}
--
/style
table width=788 border=0 align=center
  tr
td width=1023form method=post action=
  table width=648 height=133 border=0 align=center
cellpadding=0 cellspacing=0 bordercolor=#00
tr
  td width=132 height=44 valign=middlediv
align=rightstrongYour Name/strong/div/td
  td width=491 valign=middleinput name=party_name
type=text size=50 //td
/tr
tr
  td valign=middlediv align=rightstrongContact
Numbers/strong/div/td
  td height=38 valign=middlep align=left
input name=contact_nos type=text size=50 /
span class=style14(please specify STD code)/span/p/td
/tr
tr
  td valign=middlediv
align=rightstrongEmail/strongstrong /strong/div/td
  td height=33 valign=middleinput name=email type=text
size=50 //td
/tr
  /table
  p align=center
input type=submit value=submit name=submit
  /p
/form/td
  /tr
/table





What I want is when the user click on the submit button the data from this
form should directly comes to my email. I tried mail function but not
working for me. I just need these 3 fields in my mail. Please help me with
this.

-- 
*Best,
*
*Guru™*


Re: [PHP-DB] Need Help with PHP Mails

2011-04-04 Thread Will Lunden
Hi Guru,

Have you already made the php script that includes the mail function? If
there is an error in your php that is preventing the mail function from
working properly, I or someone else may be able to help you correct it if
you were to send the php you have written so far.

-Will
2011/4/4 Guru™ nagendra802...@gmail.com

 Hi All,

 I have this HTML form


 style type=text/css
 !--
 .style14 {font-size: 24px
 }
 .style14 {font-size: 12px}
 --
 /style
 table width=788 border=0 align=center
  tr
td width=1023form method=post action=
  table width=648 height=133 border=0 align=center
 cellpadding=0 cellspacing=0 bordercolor=#00
tr
  td width=132 height=44 valign=middlediv
 align=rightstrongYour Name/strong/div/td
  td width=491 valign=middleinput name=party_name
 type=text size=50 //td
/tr
tr
  td valign=middlediv align=rightstrongContact
 Numbers/strong/div/td
  td height=38 valign=middlep align=left
input name=contact_nos type=text size=50 /
span class=style14(please specify STD code)/span/p/td
/tr
tr
  td valign=middlediv
 align=rightstrongEmail/strongstrong /strong/div/td
  td height=33 valign=middleinput name=email type=text
 size=50 //td
/tr
  /table
  p align=center
input type=submit value=submit name=submit
  /p
/form/td
  /tr
 /table




 

 What I want is when the user click on the submit button the data from this
 form should directly comes to my email. I tried mail function but not
 working for me. I just need these 3 fields in my mail. Please help me with
 this.

 --
 *Best,
 *
 *Guru™*



Re: [PHP-DB] Need Help with PHP Mails

2011-04-04 Thread Guru™
Hi Will,

Below is my final PHP code, and its working now. However this is just a
small piece of the form that I have created. In my original form I have more
then 50 fields and variables. Now I am not sure how to expand this code
having all 50 fields. Can the mail function will take that much fields?

?php

if(isset($_POST['submit'])) // submit button clicked
   {

$party_name = isset($_POST['party_name'])? $_POST['party_name']:null;
$contact_no = isset($_POST['contact_no'])? $_POST['contact_no']:null;
$pemail = isset($_POST['pemail'])? $_POST['pemail']:null;


$mymail = nagendra802...@gmail.com;


 if(mail($mymail, New contact info submitted!,Party: {$party_name}
Contact:  {$contact_no}Email: {$pemail}))
  {


 echo 'Mail sent!br /';
  }
  }





?


Re: [PHP-DB] Need Help with PHP Mails

2011-04-04 Thread Will Lunden


Hi Guru,

Glad to hear it's working! Yes the mail function will be able to  
handle all the fields, it should be as simple as repeating what you've  
already done for all of the remaining fields


- Will

On Apr 4, 2011, at 1:09 PM, Guru™ nagendra802...@gmail.com wrote:


Hi Will,

Below is my final PHP code, and its working now. However this is  
just a small piece of the form that I have created. In my original  
form I have more then 50 fields and variables. Now I am not sure how  
to expand this code having all 50 fields. Can the mail function will  
take that much fields?


?php

if(isset($_POST['submit'])) // submit button clicked
   {

$party_name = isset($_POST['party_name'])? $_POST['party_name']:null;
$contact_no = isset($_POST['contact_no'])? $_POST['contact_no']:null;
$pemail = isset($_POST['pemail'])? $_POST['pemail']:null;


$mymail = nagendra802...@gmail.com;


 if(mail($mymail, New contact info submitted!,Party:  
{$party_name}  Contact:  {$contact_no}Email: {$pemail}))

  {


 echo 'Mail sent!br /';
  }
  }





?




[PHP-DB] Need help with an extra backslash

2011-03-01 Thread nagendra prasad
Hi All,

I have a list of product in which WIRE MESH 24G X 3/4 is one of them. When
I am trying to print the same its coming like WIRE MESH 24G X 3/4\. I want
to remove the extra \ backslash from the result page. Please help me with
this.

Best,
Guru.


Re: [PHP-DB] Need help with an extra backslash

2011-03-01 Thread Design in Motion Webdesign

Try the stripslashes() function.

See on http://php.net/manual/en/function.stripslashes.php for details.

Best regards.
Steven



Hi All,

I have a list of product in which WIRE MESH 24G X 3/4 is one of them. 
When
I am trying to print the same its coming like WIRE MESH 24G X 3/4\. I 
want
to remove the extra \ backslash from the result page. Please help me 
with

this.

Best,
Guru.




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



[PHP-DB] Need Help with database output

2010-08-28 Thread nagendra prasad
Hi All,

I have a database and I want to show it in 3 columns Like

Col1   Col2 Col3
data1   data2   data3
data4   data5   data5
   ...


I tired using table but its not working. Please help me.

Best,
guru.


Re: [PHP-DB] Need help with HTML form errors

2010-07-05 Thread Jesus
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 07/04/2010 02:55 PM, Jesus wrote:
 On 07/04/2010 03:30 AM, nagendra prasad wrote:
 Hi All,

 I have this php form that I have inserted in the result page.


 

  form action=index.php method=post
 table class=bd border=0 cellspacing=1 cellpadding=4
 tr

 tdb/bnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;/td

  tdinput type=text name=filter value=?php echo $filter
 ?/td are you missing ; on this line after echo statement
 should be ?php echo $filter; ?

 tdinput type=text name=filter value=?php echo
 $filter
 ?/td



Forgiveness was a little confused about this, sometimes I get error by
not giving ; but this is not the case my apologies
Regards

- -- 
ヘスス   アルベルト
Nobody wants to say how this works.  Maybe nobody knows
 VIDEOADAPTOR SECTION  on xorg.conf manual
へすす   あるべると
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJMMkOCAAoJECo0S+stWdOCV38IAK2wQtS6DYUW6sYRJQPymFVY
7F1w1G+dfJP75+0d4GXPB8k616YaJyIkipOBgOxTkAfS94nooF2F3f3n84YlnZCs
rcjLSfvK3PMUi4TVYWAu5g3wtJQH0Lp/2DvNr9u136ZyZmx2470ILF/aGTKf52wK
3Xyvk8173D2fNsSvNzbYCtS5zeZRuASNnd1q9T8oenc7ATrHCoWlJSakAZWvI5u9
tzAmeg1eECajdk/3ev/flX1KVt94zvvmY+iugEbqpoNbIDi1Fu4LfGOc+I6qJ3aR
H9M7tDuAXDmZ8yy6cyjmWfaMWVEgv7ekF/5Mj1Jk6GCiFeoO/LWTM+ObfER7ObA=
=y1uL
-END PGP SIGNATURE-


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



[PHP-DB] Need help with HTML form errors

2010-07-04 Thread nagendra prasad
Hi All,

I have this php form that I have inserted in the result page.


form action=index.php method=post
table class=bd border=0 cellspacing=1 cellpadding=4
tr
tdb/bnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;/td
tdinput type=text name=filter value=?php echo $filter ?/td
tdinput type=submit name=action value=Search/td

tdselect name=filter_field style=width:100px;
option value=All Fields/option
option value=?php echo Type ??php if ($filterfield == type) { echo
selected; } ??php echo htmlspecialchars(Type) ?/option
option value=?php echo Name ??php if ($filterfield == name) { echo
selected; } ??php echo htmlspecialchars(Name) ?/option
option value=?php echo Date ??php if ($filterfield == date) { echo
selected; } ??php echo htmlspecialchars(Date) ?/option
option value=?php echo Size ??php if ($filterfield == size) { echo
selected; } ??php echo htmlspecialchars(Size) ?/option

/select/td

/tr


/table

hr size=1 noshade

***

The above code is giving me the following errors:

br / bNotice/b:  Undefined variable: filter in
bC:\wamp\www\5_Final\index.php/b on line b228/bbr /

Notice: Undifined Variable: filterfield in c:\wamp\www\5_final\index.php on
line 233  Type
Notice: Undifined Variable: filterfield in c:\wamp\www\5_final\index.php on
line 234  Name
Notice: Undifined Variable: filterfield in c:\wamp\www\5_final\index.php on
line 235  Date
Notice: Undifined Variable: filterfield in c:\wamp\www\5_final\index.php on
line 236  Size



*Please help me with these errors.*


Re: [PHP-DB] Need help with HTML form errors

2010-07-04 Thread Kesavan Rengarajan

Hi,
Those are notices not warnings(meaning they can be ignored sometimes,  
search for error_reporting in the PHP manual).


In your example, if you do not wish ignore the notices, then  
initialize the different variables to some value.


Sent from my iPhone

On 04/07/2010, at 6:30 PM, nagendra prasad nagendra802...@gmail.com  
wrote:



Hi All,

I have this php form that I have inserted in the result page.

*** 
*** 
*** 
*** 
*** 
*** 
*** 
*** 
*** 
*

form action=index.php method=post
table class=bd border=0 cellspacing=1 cellpadding=4
tr
tdb/ 
b 
nbsp; 
nbsp; 
nbsp; 
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;/ 
td
tdinput type=text name=filter value=?php echo $filter ?/ 
td

tdinput type=submit name=action value=Search/td

tdselect name=filter_field style=width:100px;
option value=All Fields/option
option value=?php echo Type ??php if ($filterfield ==  
type) { echo

selected; } ??php echo htmlspecialchars(Type) ?/option
option value=?php echo Name ??php if ($filterfield ==  
name) { echo

selected; } ??php echo htmlspecialchars(Name) ?/option
option value=?php echo Date ??php if ($filterfield ==  
date) { echo

selected; } ??php echo htmlspecialchars(Date) ?/option
option value=?php echo Size ??php if ($filterfield ==  
size) { echo

selected; } ??php echo htmlspecialchars(Size) ?/option

/select/td

/tr


/table

hr size=1 noshade

*** 
*** 
*


The above code is giving me the following errors:

br / bNotice/b:  Undefined variable: filter in
bC:\wamp\www\5_Final\index.php/b on line b228/bbr /

Notice: Undifined Variable: filterfield in c:\wamp\www\5_final 
\index.php on

line 233  Type
Notice: Undifined Variable: filterfield in c:\wamp\www\5_final 
\index.php on

line 234  Name
Notice: Undifined Variable: filterfield in c:\wamp\www\5_final 
\index.php on

line 235  Date
Notice: Undifined Variable: filterfield in c:\wamp\www\5_final 
\index.php on

line 236  Size



*Please help me with these errors.*


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



Re: [PHP-DB] Need help with HTML form errors

2010-07-04 Thread Jesus
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 07/04/2010 03:30 AM, nagendra prasad wrote:
 Hi All,

 I have this php form that I have inserted in the result page.

 
 form action=index.php method=post
 table class=bd border=0 cellspacing=1 cellpadding=4
 tr
 tdb/bnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;/td
 tdinput type=text name=filter value=?php echo $filter ?/td
are you missing ; on this line after echo statement should be ?php
echo $filter; ?

 tdinput type=text name=filter value=?php echo $filter ?/td


- -- 
ヘスス   アルベルト
Nobody wants to say how this works.  Maybe nobody knows
 VIDEOADAPTOR SECTION  on xorg.conf manual
へすす   あるべると
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJMMOcjAAoJECo0S+stWdOC3Z4H/iP1ZdBfgYdo1cm0knlfDu2B
KxTBmKKY1VqO4975ZeL16DoR027CYUzfxLJhyU8x7VcKyTmnGhjSqIxOc/EZNlOV
SbO7Ugr6PDX5U4VUOf5HxDpZHy6gywQiL1g+rDOP6f2hRbRNH0+n3DoUJb7l752i
vmTqXiBboS38bYIIsOrSWIYgvu7Gl3036uL4DQ64L4jb4Vf9ykG+5uoazZUDGJ4E
zQ9R3TCOvbYIG8bb+sYN3brs792IwVyfSzn8uhYzWLZkFBwfOySVpiD+k9j4HFMy
XDf2pkCKJNyPb41LFfR4GbDNQusOO1S+XX91wF5neXc5KAmZRu1fMFp1wcZzJqk=
=T3VY
-END PGP SIGNATURE-


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



[PHP-DB] Need Help in Mysql database

2010-06-30 Thread nagendra prasad
Hi All,

I have a huge set of MP3 database. My problem is that when I try to search
in my database its getting very slow. I was wondering if I split that
database into 2 or more tables. Will this improve the speed of searching? Is
it the best solution for my problem or is their any other solution?

Best,
Guru.


Re: [PHP-DB] Need Help in Mysql database

2010-06-30 Thread Bastien Koert
On Wed, Jun 30, 2010 at 10:52 AM, nagendra prasad
nagendra802...@gmail.com wrote:
 Hi All,

 I have a huge set of MP3 database. My problem is that when I try to search
 in my database its getting very slow. I was wondering if I split that
 database into 2 or more tables. Will this improve the speed of searching? Is
 it the best solution for my problem or is their any other solution?

 Best,
 Guru.


What are you :

a) searching on
b) have mysql indeces on


Also have you run an explain plan on the query to see if its using any indexes?

-- 

Bastien

Cat, the other other white meat

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



[PHP-DB] Need Help in setting up a server

2010-06-27 Thread nagendra prasad
Hi All,

I need help in setting up a home server. I know the subject line looks like
an off topic but trust me its not. What I want is to set up a WAMP server
over the intranet. I have a laptop and 2 desktop. I want to set up a desktop
like a wamp server locally so that I can able to use or able to work from my
other systems as well locally. I hope  I made my point clear. If not please
do let me know.

Best,
Guru.


Re: [PHP-DB] Need Help in error msg

2010-06-14 Thread Bavithra R
hi..

Try to change the root password by System-administration-users and groups.
Unlock the key and double click the root.Change the root password and try
downloading again.I hope this works.

--Bavithra


[PHP-DB] Need Help in error msg

2010-05-18 Thread nagendra prasad
Hi All,

I am getting this error while tried to run a downloaded script in WAMP:

[1045] dbconn: mysql_connect: Access denied for user 'root'@'localhost'
(using password: YES)

Dose anyone know what exactly this means.

Best,
Guru.


Re: [PHP-DB] Need Help in error msg

2010-05-18 Thread Chaitanya Yanamadala
it means the root user password which u are using is the wrong one..

Chaitanya



On Tue, May 18, 2010 at 12:49 PM, nagendra prasad
nagendra802...@gmail.comwrote:

 Hi All,

 I am getting this error while tried to run a downloaded script in WAMP:

 [1045] dbconn: mysql_connect: Access denied for user 'root'@'localhost'
 (using password: YES)

 Dose anyone know what exactly this means.

 Best,
 Guru.



Re: [PHP-DB] Need Help in error msg

2010-05-18 Thread Artur Ejsmont
May also be granted rights to login from '%' which will resolve to any host
name except localhost.

On 18 May 2010 08:24, Peter Lind peter.e.l...@gmail.com wrote:

On 18 May 2010 09:19, nagendra prasad nagendra802...@gmail.com wrote:
 Hi All,

 I am getting t...
It means that either the password you're using is wrong or the user
doesn't have access to the DB server (the user doesn't exist or
doesn't have the proper rights).

Regards
Peter

--
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
/hype

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


[PHP-DB] Need help with linking

2010-02-03 Thread nagendra prasad
Hi All,

I have created a search engine for MP3 with mysql database. Now I want to
connect each search result with its respective info page which will consist
with name of the artist, size, year, and so on. Dose anyone knows how to do
it? I did created few static pages with all these info. But its impossible
to create for thousands of MP3s. Please help me.

Best,


-- 
Guru Prasad
Ubuntu Voice GTK+ Forum


[PHP-DB] Need Help with data sorting

2010-01-31 Thread nagendra prasad
Hi,

I have a database of MP3s in mysql and I have created a php search engine.
Now I want to sort it in ascending or descending order if user clicks on the
title of the table. For example if user want to arrange the table in
ascending or descending order by Name, Size, or by any other field. Also, I
am unable to arrange the table properly. Please help me?? Below is the
code.

Type = Rock, Pop etc.
Url = file url
Name= Name of the song
Size = size



?php


//get data
$button = $_GET['submit'];
$search = $_GET['search'];


$s = $_GET['s'];
if (!$s)
$s = 0;


$e = 30; // Just change to how many results you want per page


$next = $s + $e;
$prev = $s - $e;




 if (strlen($search)=2)
  echo Must be greater then 3 chars;
 else
 {
  echo br /tabletrtdfont face='sana-serif' size='10'font
color='blue' bMymp3/b/bfont face='sana-serif'
size='3'reg;/tdtdform action='search.php' method='GET'input
type='text' onclick=value='' size='50' name='search' value='$search' input
type='submit' name='submit' value='Search'/form/td/tr/table;

  //connect to database
  mysql_connect(localhost,root,);
  mysql_select_db(mp3);

   //explode out search term
   $search_exploded = explode( ,$search);

   foreach($search_exploded as $search_each)
   {

//construct query
$x++;
if ($x==1)
 $construct .= name LIKE '%$search_each%';
else
 $construct .=  OR name LIKE '%$search_each%';

   }

  //echo outconstruct
  $constructx = SELECT * FROM mp3 WHERE $construct;

  $construct = SELECT * FROM mp3 WHERE $construct ORDER BY se DESC LIMIT
$s,$e ;
  $run = mysql_query($constructx);

  $foundnum = mysql_num_rows($run);


  $run_two = mysql_query($construct);

  if ($foundnum==0)
   echo No results found for b$search/b;
  else
  {
   echo table bgcolor='#FF' width='100%' height='1px'br
//tabletable bgcolor='#f0f7f9' width='100%' height='10px'trtddiv
align='right'Showing 1-20 of b$foundnum/b results found for
b$search./b/div/td/tr/tablep;

   echo table bgcolor='#FF' width='100%' height='1px'br
//tabletable bgcolor='#f0f7f9' width='100%' height='10px'trtdfont
face='sana-serif' size='3'
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;Type
bnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
Name/b
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;  Size
/div/td/tr/tablep;

   while ($runrows = mysql_fetch_assoc($run_two))
   {
//get data
   $type = $runrows['type'];
   $date = $runrows['date'];
   $url = $runrows['url'];
   $name = $runrows['name'];
   $size = $runrows['size'];


   print 'table width=800 border=0 align=center ';

   print 'tdfont color=blue'.$type.'/font/td';


//print 'tdfont color=blue'.http://localhost/mymp3/.;a
herf='$url'$name.'/font/td';


print 'tdfont color=blue'.a href='$url'$name.'/font/td';


print 'tdfont color=blue'.$size.'/font/td';



  print '/tr';

  print '/tr';
print '/table';

  /* echo table width='300px' height='10px'
   h4 font color='blue'$type --   $name/fontbbrSize: $size
/b/abr /
  font color='00CC00'Date Added: $date/font/table/h4
   ;   */
   }
?

table width='100%'
tr
td
div align=center
brbr
?php
if (!$s=0)
 echo a href='search.php?search=$searchs=$prev'Prev/a;

$i =1;
for ($x=0;$x$foundnum;$x=$x+$e)
{


 echo  a href='search.php?search=$searchs=$x'$i/a ;


$i++;


}

if ($s$foundnum-$e)
  echo a href='search.php?search=$searchs=$next'Next/a;

}
}


?
/div
/td
/tr
/table

-- 
Guru Prasad
Ubuntu Voice GTK+ Forum


Re: [PHP-DB] Need Help with data sorting

2010-01-31 Thread Amit Tandon
Hello,

I a not clear why are u using so many tables, and also div's within the
table. Either use tableless (css tables ) or simply use table(preferably
one) without divs in it

regds
amit

The difference between fiction and reality? Fiction has to make sense.


On Sun, Jan 31, 2010 at 3:45 PM, nagendra prasad
nagendra802...@gmail.comwrote:

 Hi,

 I have a database of MP3s in mysql and I have created a php search engine.
 Now I want to sort it in ascending or descending order if user clicks on
 the
 title of the table. For example if user want to arrange the table in
 ascending or descending order by Name, Size, or by any other field. Also, I
 am unable to arrange the table properly. Please help me?? Below is the
 code.

 Type = Rock, Pop etc.
 Url = file url
 Name= Name of the song
 Size = size


 

 ?php


 //get data
 $button = $_GET['submit'];
 $search = $_GET['search'];


 $s = $_GET['s'];
 if (!$s)
 $s = 0;


 $e = 30; // Just change to how many results you want per page


 $next = $s + $e;
 $prev = $s - $e;




  if (strlen($search)=2)
  echo Must be greater then 3 chars;
  else
  {
  echo br /tabletrtdfont face='sana-serif' size='10'font
 color='blue' bMymp3/b/bfont face='sana-serif'
 size='3'reg;/tdtdform action='search.php' method='GET'input
 type='text' onclick=value='' size='50' name='search' value='$search'
 input
 type='submit' name='submit' value='Search'/form/td/tr/table;

  //connect to database
  mysql_connect(localhost,root,);
  mysql_select_db(mp3);

   //explode out search term
   $search_exploded = explode( ,$search);

   foreach($search_exploded as $search_each)
   {

//construct query
$x++;
if ($x==1)
 $construct .= name LIKE '%$search_each%';
else
 $construct .=  OR name LIKE '%$search_each%';

   }

  //echo outconstruct
  $constructx = SELECT * FROM mp3 WHERE $construct;

  $construct = SELECT * FROM mp3 WHERE $construct ORDER BY se DESC LIMIT
 $s,$e ;
  $run = mysql_query($constructx);

  $foundnum = mysql_num_rows($run);


  $run_two = mysql_query($construct);

  if ($foundnum==0)
   echo No results found for b$search/b;
  else
  {
   echo table bgcolor='#FF' width='100%' height='1px'br
 //tabletable bgcolor='#f0f7f9' width='100%' height='10px'trtddiv
 align='right'Showing 1-20 of b$foundnum/b results found for
 b$search./b/div/td/tr/tablep;

   echo table bgcolor='#FF' width='100%' height='1px'br
 //tabletable bgcolor='#f0f7f9' width='100%' height='10px'trtdfont
 face='sana-serif' size='3'

 nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;Type

 bnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
 Name/b

 nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;

 nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
 nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;  Size
 /div/td/tr/tablep;

   while ($runrows = mysql_fetch_assoc($run_two))
   {
//get data
   $type = $runrows['type'];
   $date = $runrows['date'];
   $url = $runrows['url'];
   $name = $runrows['name'];
   $size = $runrows['size'];


   print 'table width=800 border=0 align=center ';

   print 'tdfont color=blue'.$type.'/font/td';


//print 'tdfont color=blue'.http://localhost/mymp3/.;a
 herf='$url'$name.'/font/td';


print 'tdfont color=blue'.a href='$url'$name.'/font/td';


print 'tdfont color=blue'.$size.'/font/td';



  print '/tr';

  print '/tr';
 print '/table';

  /* echo table width='300px' height='10px'
   h4 font color='blue'$type --   $name/fontbbrSize: $size
 /b/abr /
  font color='00CC00'Date Added: $date/font/table/h4
   ;   */
   }
 ?

 table width='100%'
 tr
 td
 div align=center
 brbr
 ?php
 if (!$s=0)
  echo a href='search.php?search=$searchs=$prev'Prev/a;

 $i =1;
 for ($x=0;$x$foundnum;$x=$x+$e)
 {


  echo  a href='search.php?search=$searchs=$x'$i/a ;


 $i++;


 }

 if ($s$foundnum-$e)
  echo a href='search.php?search=$searchs=$next'Next/a;

}
 }


 ?
 /div
 /td
 /tr
 /table

 --
 Guru Prasad
 Ubuntu Voice GTK+ Forum



[PHP-DB] Need Help

2010-01-28 Thread nagendra prasad
Hi,

I have a database of MP3 and I have designed a PHP-Mysql search engine. I
want to break it down in pages like Google dose. What I mean is when I
search for a song it will show me some 100 song list but I want 20 songs per
page. So, is their any trick to do it?

Best,


-- 
Guru Prasad
Ubuntu Voice GTK+ Forum


Re: [PHP-DB] Need Help

2010-01-28 Thread Udhaya Kumar
Hi There
This is what you are looking for.

http://phpsense.com/php/php-pagination-script.html

Regards
udhay

On Fri, Jan 29, 2010 at 6:01 AM, nagendra prasad
nagendra802...@gmail.comwrote:

 Hi,

 I have a database of MP3 and I have designed a PHP-Mysql search engine. I
 want to break it down in pages like Google dose. What I mean is when I
 search for a song it will show me some 100 song list but I want 20 songs
 per
 page. So, is their any trick to do it?

 Best,


 --
 Guru Prasad
 Ubuntu Voice GTK+ Forum



Re: [PHP-DB] Need help in triggers

2009-10-05 Thread Samuel ROZE
What are you really want to do ? This is an exemple:

CREATE FUNCTION myfunction () RETURNS trigger AS $$
BEGIN
NEW.update_date = 'now'::date;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;

CREATE TRIGGER set_update_date AFTER INSERT ON matable FOR EACH ROW
EXECUTE PROCEDURE myfunction();

Le lundi 05 octobre 2009 à 14:36 +0530, Yogendra Kaushik a écrit :
 Hi all's
i am working on an application in which we are using PostgreSql as an
 database, i need to write trigger for my application. Can any one help me
 how can i write it.
  i have try to write it, but did not get success.
 


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



[PHP-DB] Need help with the code

2009-10-02 Thread nagendra prasad
Hi All,

I need some help with the below code. I have this login code with me and its
working fine with my *localhost 'WAMP' *server. But when I tried to run the
same script on my web host server its not working. Every time its giving me
the same message *please enter a username and a password* which is a
condition within the script.


?php
session_start();

$username = $_POST['username'];
$password = $_POST['password'];

 if ($username$password)

 {
$connect = mysql_connect(localhost, tutor_root, admin) or
die(couldn't connect);
mysql_select_db(tutor_register) or die(couldn't find db);


$query = mysql_query(SELECT * FROM register WHERE username ='$username');
$numrows = mysql_num_rows($query);
if ($numrows!=1)

{
//code to login

while ($row =mysql_fetch_assoc($query))
{
  $dbusername = $row['username'];
  $dbpassword=  $row['password'];

}
 //check to see if they match

 if ($username==$dbusername$password==$dbpassword)
 {
echo you are in a href='member.php'click/a here to enter the members
page;


$_SESSION['username']=$username;

 }
 else

 echo incorrect password;
}
else

die(That user dosen't exist);


}
  else
  die(pelase enter a username and a password);



?

-- 
Guru Prasad
Ubuntu Voice GTK+ Forum


Re: [PHP-DB] Need help with the code

2009-10-02 Thread Jason Gerfen

nagendra prasad wrote:

Hi All,

I need some help with the below code. I have this login code with me and its
working fine with my *localhost 'WAMP' *server. But when I tried to run the
same script on my web host server its not working. Every time its giving me
the same message *please enter a username and a password* which is a
condition within the script.


?php
session_start();

  

echo var_dump(print_r($_POST));

Are the $_POST['username'] and $_POST['password'] variables present? You 
didn't post any html form information so I think you could start there.

$username = $_POST['username'];
$password = $_POST['password'];

 if ($username$password)

 {
$connect = mysql_connect(localhost, tutor_root, admin) or
die(couldn't connect);
mysql_select_db(tutor_register) or die(couldn't find db);


$query = mysql_query(SELECT * FROM register WHERE username ='$username');
$numrows = mysql_num_rows($query);
if ($numrows!=1)

{
//code to login

while ($row =mysql_fetch_assoc($query))
{
  $dbusername = $row['username'];
  $dbpassword=  $row['password'];

}
 //check to see if they match

 if ($username==$dbusername$password==$dbpassword)
 {
echo you are in a href='member.php'click/a here to enter the members
page;


$_SESSION['username']=$username;

 }
 else

 echo incorrect password;
}
else

die(That user dosen't exist);


}
  else
  die(pelase enter a username and a password);



?

  



--
Jason Gerfen
Systems Administration/Web application development
jason.ger...@scl.utah.edu

Marriott Library
Lab Systems PC
295 South 1500 East
Salt Lake City, Utah 84112-0806
Ext 5-9810


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



Re: [PHP-DB] Need help with the code

2009-10-02 Thread nagendra prasad
OK so here is the form for the below code:

html

  form action='mem_login.php' method='POST'
Username: input type='text' name='username'br
Password: input type='password' name='password'br
input type='submit' value='Log in'


  /form
/html


Re: [PHP-DB] Need help with the code

2009-10-02 Thread Jason Gerfen

nagendra prasad wrote:

OK so here is the form for the below code:

html

  form action='mem_login.php' method='POST'
Username: input type='text' name='username'br
Password: input type='password' name='password'br
input type='submit' value='Log in'
   
   
  /form

/html


Did you try looking at the $_POST array data?

echo var_dump(print_r($_POST));


--
Jason Gerfen
Systems Administration/Web application development
jason.ger...@scl.utah.edu

Marriott Library
Lab Systems PC
295 South 1500 East
Salt Lake City, Utah 84112-0806
Ext 5-9810


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



Re: [PHP-DB] Need help with the code

2009-10-02 Thread nagendra prasad
Yes I did but still its not working on my web server however its working
fine with my WAMP server locally.



On Fri, Oct 2, 2009 at 9:17 PM, Jason Gerfen jason.ger...@scl.utah.eduwrote:

 nagendra prasad wrote:

 OK so here is the form for the below code:

 html

  form action='mem_login.php' method='POST'
Username: input type='text' name='username'br
Password: input type='password' name='password'br
input type='submit' value='Log in'
  /form
 /html

  Did you try looking at the $_POST array data?

 echo var_dump(print_r($_POST));


 --
 Jason Gerfen
 Systems Administration/Web application development
 jason.ger...@scl.utah.edu

 Marriott Library
 Lab Systems PC
 295 South 1500 East
 Salt Lake City, Utah 84112-0806
 Ext 5-9810




-- 
Guru Prasad
Ubuntu Voice GTK+ Forum


Re: [PHP-DB] Need help with the code

2009-10-02 Thread Jason Gerfen
Add this to your script and just copy and paste it back. Seriously, you 
are not going to get any help if you don't show anyone the output of 
your problem.


echo pre;
var_dump(print_r($_GET));
var_dump(print_r($_POST));
echo /pre;

If you are not getting anything in the post try changing the method of 
your html form to 'get' vs. 'post'

*IE: form method=get action=mem_login.php

And copy and paste the results so we can see where the problem is. If 
you are feeling weird about an authentication script contents then 
filter the data but don't just leave out parts of the output.


nagendra prasad wrote:
Yes I did but still its not working on my web server however its 
working fine with my WAMP server locally.




On Fri, Oct 2, 2009 at 9:17 PM, Jason Gerfen 
jason.ger...@scl.utah.edu mailto:jason.ger...@scl.utah.edu wrote:


nagendra prasad wrote:

OK so here is the form for the below code:

html

 form action='mem_login.php' method='POST'
   Username: input type='text' name='username'br
   Password: input type='password' name='password'br
   input type='submit' value='Log in'
 /form
/html

Did you try looking at the $_POST array data?


echo var_dump(print_r($_POST));


-- 
Jason Gerfen

Systems Administration/Web application development
jason.ger...@scl.utah.edu mailto:jason.ger...@scl.utah.edu

Marriott Library
Lab Systems PC
295 South 1500 East
Salt Lake City, Utah 84112-0806
Ext 5-9810




--
Guru Prasad
Ubuntu Voice GTK+ Forum



--
Jason Gerfen
Systems Administration/Web application development
jason.ger...@scl.utah.edu

Marriott Library
Lab Systems PC
295 South 1500 East
Salt Lake City, Utah 84112-0806
Ext 5-9810


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



Re: [PHP-DB] Need help with the code

2009-10-02 Thread Jason Gerfen
Maybe you should google for information regarding the php.ini and error 
reporting.

nagendra prasad wrote:

Yes I did but still its not working on my web server however its working
fine with my WAMP server locally.



On Fri, Oct 2, 2009 at 9:17 PM, Jason Gerfen jason.ger...@scl.utah.eduwrote:

  

nagendra prasad wrote:



OK so here is the form for the below code:

html

 form action='mem_login.php' method='POST'
   Username: input type='text' name='username'br
   Password: input type='password' name='password'br
   input type='submit' value='Log in'
 /form
/html

 Did you try looking at the $_POST array data?
  

echo var_dump(print_r($_POST));


--
Jason Gerfen
Systems Administration/Web application development
jason.ger...@scl.utah.edu

Marriott Library
Lab Systems PC
295 South 1500 East
Salt Lake City, Utah 84112-0806
Ext 5-9810






  



--
Jason Gerfen
Systems Administration/Web application development
jason.ger...@scl.utah.edu

Marriott Library
Lab Systems PC
295 South 1500 East
Salt Lake City, Utah 84112-0806
Ext 5-9810


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



Re: [PHP-DB] Need help in PHP file Management System

2009-09-23 Thread Vinay Kannan
Hi Nagendra,

Any progress on the task you were at?

On Fri, Sep 18, 2009 at 12:40 AM, nagendra prasad
nagendra802...@gmail.comwrote:

 Eric, I am new to file or content management. So, if possible can you send
 me few scripts or some links from where I can learn more about it?


 Best,




Re: [PHP-DB] Need help in PHP file Management System

2009-09-23 Thread nagendra prasad
Hi Vinay, Eric  Everyone,

Sorry, I was down with fever 'malaria' since last Friday. I was hospitalized
for 3 days. It will take more 2-3 days for me to start working again on my
project. Anyways till now I didn't get anything which will solve my issue.
Lets see if anyone comes with something new.

Best,


Re: [PHP-DB] Need help in PHP file Management System

2009-09-21 Thread Velen

Hi Nagendra,

I would save the uploaded file in a format like usernamefilename.ext

For each user you just need to sort the directory and look for file starting 
with username.


Hope this helps.

Velen

- Original Message - 
From: nagendra prasad nagendra802...@gmail.com

To: Vinay Kannan viny...@gmail.com
Cc: php-db@lists.php.net
Sent: Thursday, September 17, 2009 10:16 PM
Subject: Re: [PHP-DB] Need help in PHP file Management System



Thanks Vinay,

I think you are right. I thought about it but then server will have to
manage huge set of folders. I also thought that what if we give a unique 
ID
for each file for each user. So, when user wants to access his file the 
code

should first checks if the unique ID and the username is matched. I just
have a rough idea. If someone got my points please explain it to me. Am 
not

sure this may be a solution.

Guys plz help me

Best,




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



Re: [PHP-DB] Need help in PHP file Management System

2009-09-21 Thread Lester Caine

nagendra prasad wrote:

Eric, I am new to file or content management. So, if possible can you send
me few scripts or some links from where I can learn more about it?


Have a look at bitweaver ... http://bitweaver.org
What this does is creates a set of directories for storage, and under 
that one directory for each user, and stores all their files within 
their own base folder.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



[PHP-DB] Need help in PHP file Management System

2009-09-17 Thread nagendra prasad
Hi All,

I need help in PHP file management system. So, I am working on my project in
which user will upload a file on the server. I know how to upload a file on
server using PHP. But the problem is how to differentiate the different
uploaded files with different users. Please help me with this.

Best,

-- 
Guru Prasad
Ubuntu Voice GTK+ Forum


Re: [PHP-DB] Need help in PHP file Management System

2009-09-17 Thread Vinay Kannan
I would think, since you already have different users, so most probably you
would be getting them registered, so maybe at the time of the registration,
you could create folders for each user, and the files they upload would be
on to the folders with their username, the folder securities on the server
should be taken care of.

for instance, if the user is say, Vinay (thats me)

and ur website is www.abcdefg.com then when i register, it would create a
folder for me, so the url would be something like www.abcdefg.com/vinay, and
the files uploaded by me would be in the folder vinay, but the files would
be accesible to me alone, not the other visitors of the website.

Guys please correct me if I am wrong, but I think this is a good possible
way of doing it.


Thanks,
Vinay Kannan

On Thu, Sep 17, 2009 at 10:05 AM, nagendra prasad
nagendra802...@gmail.comwrote:

 Hi All,

 I need help in PHP file management system. So, I am working on my project
 in
 which user will upload a file on the server. I know how to upload a file on
 server using PHP. But the problem is how to differentiate the different
 uploaded files with different users. Please help me with this.

 Best,

 --
 Guru Prasad
 Ubuntu Voice GTK+ Forum



Re: [PHP-DB] Need help in PHP file Management System

2009-09-17 Thread nagendra prasad
Thanks Vinay,

I think you are right. I thought about it but then server will have to
manage huge set of folders. I also thought that what if we give a unique ID
for each file for each user. So, when user wants to access his file the code
should first checks if the unique ID and the username is matched. I just
have a rough idea. If someone got my points please explain it to me. Am not
sure this may be a solution.

Guys plz help me

Best,


Re: [PHP-DB] Need help in PHP file Management System

2009-09-17 Thread Eric

- Original Message - 
From: nagendra prasad nagendra802...@gmail.com
To: Vinay Kannan viny...@gmail.com
Cc: php-db@lists.php.net
Sent: Friday, September 18, 2009 2:16 AM
Subject: Re: [PHP-DB] Need help in PHP file Management System


 Thanks Vinay,
 
 I think you are right. I thought about it but then server will have to
 manage huge set of folders. I also thought that what if we give a unique ID
 for each file for each user. So, when user wants to access his file the code
 should first checks if the unique ID and the username is matched. I just
 have a rough idea. If someone got my points please explain it to me. Am not
 sure this may be a solution.

This may or may not need.

hash the file to prevent unauthenticated modified.
version controlling.
tagging 

pls correct me if I'am wrong !!!

- Eric

 
 Guys plz help me
 
 Best,


Re: [PHP-DB] Need help in PHP file Management System

2009-09-17 Thread nagendra prasad
Eric, I am new to file or content management. So, if possible can you send
me few scripts or some links from where I can learn more about it?


Best,


[PHP-DB] Need help-Send email

2009-09-11 Thread nagendra prasad
Hi All,

I want to send my sql database to the user email. But I don't have any Email
server or any email domain server. So, is their any way to use my localhost
to send emails to the user's email id. If it not possible is their a way
that I can use my Gmail to send an email through PHP?

Best,

-- 
Guru Prasad
Ubuntu Voice GTK+ Forum


[PHP-DB] Need Help in the below script

2009-09-04 Thread nagendra prasad
Hi all,

I am working on my project. I have to create a user  regestration page and a
login page. I am done with registration page but when I tried to code the
login page its not working. Below is the code. Please take a look at script
and let me know where am I going wrong.


?php

$username=$_POST['username'];
$password=$_POST['password'];

if($username$password)
{

$connect= mysql_connect(localhost,root,) or die(couldn't connect);

mysql_select_db(phplogin) or die(no db in the list);

$query = mysql_query(SELECT * FROM users WHEER username='$username');

$numrows = mysql_num_rows($query);


if ($numrows!=0)
{
echo user dosen't exist;
while ($row = mysql_fetch_assoc($query))
{
$dbusername = $row['username'];
$dbpassword = $row['password'];
}

if ($username==$dbusername  $password==$dbpassword)
{
echo you are in;
}
else
echo incorrent username and password;


else
die(user dosent exitst);

}

else

die(please enter a username and a password);
}


?



-- 
Guru Prasad
Ubuntu Voice GTK+ Forum


Re: [PHP-DB] Need Help in the below script

2009-09-04 Thread Patrick Price
It appears that you had a missing bracket or two and you had misspelled
'WHERE' in the query.

In your code you were checking if the username and password were correct
outside of the while loop.  Even though it can be uncommon, if you have
multiple users with the same username then you would only be checking the
last result, not each row.

I changed the query to make it simpler, if you check for the username and
password to match in the query, then you only have to check for the returned
rows to see if the correct username and password were used.

I added a second query to check if the username exists but the password was
wrong.  For security purposes when a login attempt fails, you should not
tell a user whether the username or password was correct, once they know
that one of their parameters was correct, it is much easier for them to hack
the other parameter

You also need to be concerned about SQL injection attacks, you should always
escape any data being used in a query.
http://us.php.net/manual/en/security.database.sql-injection.php


?php
$username = $_POST['username'];
$password = $_POST['password'];
if($username$password)
{
$connect= mysql_connect(localhost,root,) or die(couldn't connect);
 mysql_select_db(phplogin) or die(no db in the list);
// escape data to prevent SQL injection attacks
$username = mysql_real_escape_string($username);
 $password = mysql_real_escape_string($password);
$query = mysql_query(SELECT * FROM users WHERE username='$username' AND
password = '$password';);
 $numrows = mysql_num_rows($query);
if ($numrows == 1)
echo you are in;
 else
{
$username_result = mysql_query(SELECT * FROM users WHERE username =
'$username';);
 if(mysql_num_rows($username_result) == 0)
echo user does not exist;
 else
echo incorrent username and password;
}
}
else
die(please enter a username and a password);
?
Hope this helps.

Thanks,

patrick



On Fri, Sep 4, 2009 at 5:07 AM, nagendra prasad nagendra802...@gmail.comwrote:

 Hi all,

 I am working on my project. I have to create a user  regestration page and
 a
 login page. I am done with registration page but when I tried to code the
 login page its not working. Below is the code. Please take a look at script
 and let me know where am I going wrong.


 ?php

 $username=$_POST['username'];
 $password=$_POST['password'];

 if($username$password)
 {

 $connect= mysql_connect(localhost,root,) or die(couldn't connect);

 mysql_select_db(phplogin) or die(no db in the list);

 $query = mysql_query(SELECT * FROM users WHEER username='$username');

 $numrows = mysql_num_rows($query);


 if ($numrows!=0)
 {
 echo user dosen't exist;
 while ($row = mysql_fetch_assoc($query))
 {
 $dbusername = $row['username'];
 $dbpassword = $row['password'];
 }

 if ($username==$dbusername  $password==$dbpassword)
 {
 echo you are in;
 }
 else
 echo incorrent username and password;


 else
die(user dosent exitst);

 }

 else

 die(please enter a username and a password);
 }


 ?



 --
 Guru Prasad
 Ubuntu Voice GTK+ Forum



Re: [PHP-DB] Need Help in the below script

2009-09-04 Thread nagendra prasad
Hay Patrick,

Thanks so much. Its really working. You have saved my life.

Best,


Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1

2009-03-05 Thread chris smith
 Do you mean i am using 32bit PHP libraries? If so could you please let me
 know where to download 64bit PHP libraries. I tried over the net but i
 couldn't get it.

No, I meant this:

ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class:
ELFCLASS64

ld: fatal: file ext/libxml/.libs/libxml.o: wrong ELF class: ELFCLASS32

You can't (as far as I know) have some libraries that are 64 bit and
others that are 32.

It's either all 64, or all 32.

Your operating system should install one type or the other.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1

2009-03-05 Thread niranjan k
Hi Chris,

Thanks for your response.

Is there any way to find out which files are in 32 bit or 64 bit?

Regards,
Niranjan

--- On Thu, 3/5/09, chris smith dmag...@gmail.com wrote:
From: chris smith dmag...@gmail.com
Subject: Re: [PHP-DB] Need help in solving issues with configuration of  
php-5.2.8 with mysql-5.3.1
To: niranjan_...@yahoo.com
Cc: php-db@lists.php.net
Date: Thursday, March 5, 2009, 2:17 PM

 Do you mean i am using 32bit PHP libraries? If so could you please let me
 know where to download 64bit PHP libraries. I tried over the net but i
 couldn't get it.

No, I meant this:

ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class:
ELFCLASS64

ld: fatal: file ext/libxml/.libs/libxml.o: wrong ELF class: ELFCLASS32

You can't (as far as I know) have some libraries that are 64 bit and
others that are 32.

It's either all 64, or all 32.

Your operating system should install one type or the other.

-- 
Postgresql  php tutorials
http://www.designmagick.com/



  

Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1

2009-03-05 Thread Chris

niranjan k wrote:

Hi Chris,

Thanks for your response.

Is there any way to find out which files are in 32 bit or 64 bit?


If you're on a packaged system (redhat based inc. fedora, centos, rhel 
or debian based inc. ubuntu) you might be able to use rpm or dpkg or 
whatever your system provides. Other than that, no idea.


--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1

2009-03-04 Thread Chris

niranjan k wrote:

Hi Chris,

Thanks for the response.


1. I ran php configuration as below.

$./configure --with-apxs2=/usr/local/apache2/bin/apxs
--with-mysql=/apps/mysql/mysql

It went fine.


Chris  Are you sure? 


Yes it went fine.



2. While running make, i got following relink error.

ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class:
ELFCLASS64


Chris  Look at the path of the file it picked up - it found one in a
completely different location.

The path it has taken /usr/local/mysql/...
There is a soft link to /usr/local/mysql which points to /apps/mysql/mysql


and we're supposed to guess that? ;)

I guess you can't build 64 bit binaries with 32 bit libraries. The 
php-install list may have better suggestions but as far as I know you 
either have to use 64 bit (including libraries) or 32 bit - you can't 
mix  match.


--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1

2009-03-04 Thread niranjan k
Hi Chris,

Thanks for your response.

Do you mean i am using 32bit PHP libraries? If so could you please let me know 
where to download 64bit PHP libraries. I tried over the net but i couldn't get 
it.

Regards,
Niranjan

--- On Thu, 3/5/09, Chris dmag...@gmail.com wrote:
From: Chris dmag...@gmail.com
Subject: Re: [PHP-DB] Need help in solving issues with configuration of  
php-5.2.8 with mysql-5.3.1
To: niranjan_...@yahoo.com
Cc: php-db@lists.php.net
Date: Thursday, March 5, 2009, 3:01 AM

niranjan k wrote:
 Hi Chris,
 
 Thanks for the response.
 
 1. I ran php configuration as below.
 
 $./configure --with-apxs2=/usr/local/apache2/bin/apxs
 --with-mysql=/apps/mysql/mysql
 
 It went fine.
 
 Chris  Are you sure? 
 Yes it went fine.
 
 
 2. While running make, i got following relink error.
 
 ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF
class:
 ELFCLASS64
 
 Chris  Look at the path of the file it picked up - it found one in a
 completely different location.
 
 The path it has taken /usr/local/mysql/...
 There is a soft link to /usr/local/mysql which points to /apps/mysql/mysql

and we're supposed to guess that? ;)

I guess you can't build 64 bit binaries with 32 bit libraries. The
php-install list may have better suggestions but as far as I know you either
have to use 64 bit (including libraries) or 32 bit - you can't mix 
match.

-- Postgresql  php tutorials
http://www.designmagick.com/




  

[PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1

2009-03-03 Thread niranjan k
Hi,

I installed 64 bit MySQL-5.3.1 and i am in the process of installing php-5.2.8. 
While configuring php with mysql, getting following issues.

Issue:

1. I ran php configuration as below.

$./configure --with-apxs2=/usr/local/apache2/bin/apxs 
--with-mysql=/apps/mysql/mysql

It went fine.

2. While running make, i got following relink error.

ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class: 
ELFCLASS64
ld: fatal: File processing errors. No output written to 
.libs/libphp5.so
collect2: ld returned 1 exit status
*** Error code 
1
make: Fatal error: Command failed for target `libphp5.la'

I tried exporting CFLAGS as export CFLAGS=$CFLAGS -m64 so that gcc will use 
64 bit.
But i got following error at the time of make.

ld: fatal: file ext/libxml/.libs/libxml.o: wrong ELF class: ELFCLASS32
ld: 
fatal: File processing errors. No output written to 
.libs/libphp5.so
collect2: ld returned 1 exit status
*** Error code 
1
make: Fatal error: Command failed for target `libphp5.la'

I am not able to proceed with the installation of PHP due to above errors. I 
would appreciate if any one can help me in resolving the issue.

Please let me know if you need more details in solving the issue.

Regards,
Niranjan





  

Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1

2009-03-03 Thread chris smith
 1. I ran php configuration as below.

 $./configure --with-apxs2=/usr/local/apache2/bin/apxs
 --with-mysql=/apps/mysql/mysql

 It went fine.

Are you sure?

 2. While running make, i got following relink error.

 ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class:
 ELFCLASS64

Look at the path of the file it picked up - it found one in a
completely different location.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1

2009-03-03 Thread niranjan k
Hi Chris,

Thanks for the response.

 1. I ran php configuration as below.

 $./configure --with-apxs2=/usr/local/apache2/bin/apxs
 --with-mysql=/apps/mysql/mysql

 It went fine.

Chris  Are you sure? 

Yes it went fine.

 2. While running make, i got following relink error.

 ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class:
 ELFCLASS64

Chris  Look at the path of the file it picked up - it found one in a
completely different location.The path it has taken /usr/local/mysql/...
There is a soft link to /usr/local/mysql which points to /apps/mysql/mysql

Regards,
Niranjan

--- On Wed, 3/4/09, chris smith dmag...@gmail.com wrote:
From: chris smith dmag...@gmail.com
Subject: Re: [PHP-DB] Need help in solving issues with configuration of  
php-5.2.8 with mysql-5.3.1
To: niranjan_...@yahoo.com
Cc: php-db@lists.php.net
Date: Wednesday, March 4, 2009, 12:16 PM

 1. I ran php configuration as below.

 $./configure --with-apxs2=/usr/local/apache2/bin/apxs
 --with-mysql=/apps/mysql/mysql

 It went fine.

Are you sure?

 2. While running make, i got following relink error.

 ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class:
 ELFCLASS64

Look at the path of the file it picked up - it found one in a
completely different location.

-- 
Postgresql  php tutorials
http://www.designmagick.com/



  

Re: [PHP-DB] Need Help Compiling PHP5 With MS SQL Support

2006-07-05 Thread Riemer Palstra
On Mon, Jul 03, 2006 at 11:14:48AM -0400, Mike wrote:
 I am new to Linux and have NEVER compiled PHP. I have PHP 5 and need
 to compile it with MS SQL support. Per PHP docs, I installed FreeTDS
 and tested it and it works. Now I need to (re)compile PHP to get the
 support I need to access MS SQL databases. I am on a Ubuntu 6.06
 version of Linux.

Since you're on Ubuntu, I reckon this kind of explains what you want to
do (at least if you want to keep using Ubuntu packages):

http://panthar.org/2006/06/15/php-with-mssql-on-ubuntu-606/

(first hit on Google, btw)
-- 
Riemer PalstraAmsterdam, The Netherlands
[EMAIL PROTECTED]http://www.palstra.com/

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



[PHP-DB] need help on setting up tables for db (NFL Football)

2006-07-05 Thread Karl James
Team,

 

I was wondering if anybody can help me or guide me

On what tables to make. I want to do all the data entry

I just do not know what to do. It's for a fantasy football

League.

 

Here is my project! 

Let me know if anyone can help me directly, through

Email, AIM, or MSN.

 

http://www.theufl.com/ufl_project.htm

 

Your help would be greatly appreciated.

I would be using phpmyadim for this.

 

Karl James (TheSaint)
 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]

www.theufl.com

 

 



Re: [PHP-DB] need help on setting up tables for db (NFL Football)

2006-07-05 Thread Stut

Karl James wrote:

Team,


Heh!


I was wondering if anybody can help me or guide me
On what tables to make. I want to do all the data entry
I just do not know what to do. It's for a fantasy football
League.
 
Here is my project! 
Let me know if anyone can help me directly, through

Email, AIM, or MSN.
 
http://www.theufl.com/ufl_project.htm
 
Your help would be greatly appreciated.

I would be using phpmyadim for this.


Sure. How much do you pay?

-Stut

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



[PHP-DB] Need Help Compiling PHP5 With MS SQL Support

2006-07-03 Thread Mike
I am new to Linux and have NEVER compiled PHP. I have PHP 5 and need to
compile it with MS SQL support. Per PHP docs, I installed FreeTDS and tested
it and it works. Now I need to (re)compile PHP to get the support I need to
access MS SQL databases. I am on a Ubuntu 6.06 version of Linux.

Again, PLEASE keep in mind that I am new to all of this. I tread VERY softly
doing this! (I am on a VMWare virtual server and have made a clone drive as
a backup.)

Am I correct that my first step is to see what is already compiled into my
version of PHP using php -m? I have that list.

I assume that my next step is to get the PHP source for PHP 5.1.4.  From
here on I do not understand clearly by reading the docs I have searched for
on the Internet through Google. Is there a place that has a VERY clear, step
by step process to compile PHP?

Any and all help is GREATLY appreciated.

TIA.

Mike

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



Re: [PHP-DB] Need Help Compiling PHP5 With MS SQL Support

2006-07-03 Thread Chris

Mike wrote:

I am new to Linux and have NEVER compiled PHP. I have PHP 5 and need to
compile it with MS SQL support. Per PHP docs, I installed FreeTDS and tested
it and it works. Now I need to (re)compile PHP to get the support I need to
access MS SQL databases. I am on a Ubuntu 6.06 version of Linux.

Again, PLEASE keep in mind that I am new to all of this. I tread VERY softly
doing this! (I am on a VMWare virtual server and have made a clone drive as
a backup.)

Am I correct that my first step is to see what is already compiled into my
version of PHP using php -m? I have that list.

I assume that my next step is to get the PHP source for PHP 5.1.4.  From
here on I do not understand clearly by reading the docs I have searched for
on the Internet through Google. Is there a place that has a VERY clear, step
by step process to compile PHP?


The install file in the tarball is pretty good.

Basically:

./configure --with-all-of-your-options

when that finishes,

make

when that finishes,

make install

once that's complete, you should just be able to restart your webserver.


http://www.designmagick.com/article/3/Starting-Out/Installing-PHP

a very very basic guide to what to do.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP-DB] Need help with delete and modify functions on a form.

2005-10-17 Thread Juan Stiller
Hi, i ´ve got a php page that shows records from a
database (mysql), basically the php code retrieve info
from the database and display it, and with some htm i
´ve made a table to show the recods, i need to add
several things to the page, but i´ve no idea how to...

A) I need to add a modify command
B) A delete command.

C) If its possible i would like to add radio buttons
on each record, so people can mark and delete more
than one message at a time.

Can anyone help me with the php code or recommend a
good tutorial to doing this changes??


Thanks in advance.
Juan.
 







___ 
1GB gratis, Antivirus y Antispam 
Correo Yahoo!, el mejor correo web del mundo 
http://correo.yahoo.com.ar 

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



RE: [PHP-DB] Need help with delete and modify functions on a form.

2005-10-17 Thread Bastien Koert

something like this example (http://www.weberdev.com/get_example-4085.html)?

Bastien


From: Juan Stiller [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Need help with delete and modify functions on a form.
Date: Mon, 17 Oct 2005 13:04:51 -0300 (ART)

Hi, i ´ve got a php page that shows records from a
database (mysql), basically the php code retrieve info
from the database and display it, and with some htm i
´ve made a table to show the recods, i need to add
several things to the page, but i´ve no idea how to...

A) I need to add a modify command
B) A delete command.

C) If its possible i would like to add radio buttons
on each record, so people can mark and delete more
than one message at a time.

Can anyone help me with the php code or recommend a
good tutorial to doing this changes??


Thanks in advance.
Juan.








___
1GB gratis, Antivirus y Antispam
Correo Yahoo!, el mejor correo web del mundo
http://correo.yahoo.com.ar

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



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



RE: [PHP-DB] Need help with delete and modify functions on a form.

2005-10-17 Thread Juan Stiller

 --- Bastien Koert [EMAIL PROTECTED] escribió:

 something like this example
 (http://www.weberdev.com/get_example-4085.html)?
 
 Bastien
 

Thanks Bastien, that would do the job, ill study it to
adapt it to my needs.

Another thing, i have some flash buttons, (im ussing
dreamweaver), so once the records are displayed, user
can filter the info lets say choosing the lastname
filed, as its a precompiled button i only can specify
a link.

I saw once that with php you can specify pure code on
the link funcion is there any chance to specify in the
link section the filter code? like:

SELECT * from mydatabase where lastname = 'john'???

i think it was a way but i can´t find it now??

Also, do you have any experience with checkbox on a
form, i mean some tut??

Thanks. 

Juan. 







___ 
1GB gratis, Antivirus y Antispam 
Correo Yahoo!, el mejor correo web del mundo 
http://correo.yahoo.com.ar 

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



RE: [PHP-DB] Need help with a tricky query

2005-05-20 Thread Murray @ PlanetThoughtful
 I'm trying to write a query that pulls details on a game record, as well
 as
 the officials assigned to the game (up to 4 officials may be assigned to
 each game, but that's not always the case).
 
 Game details are in the games table, and assignments are in the
 games_referees table (which I alias as referee,ar1,ar2, and fourth).
 
 Ultimately, I want all the games for a given date, and the referees
 assigned
 to them.  Below is the query I'm working with so far.  In its current
 state,
 it returns results only when a full crew is assigned to the game (referee,
 ar1,ar2, fourth).  The query is below:
 
 SELECT g. * , concat( ref.fname,  ' ', ref.lname )  AS ref, concat(
 ar1.fname,  ' ', ar1.lname )  AS ar1, concat( ar2.fname,  ' ', ar2.lname )
 AS ar2, concat( fourth.fname,  ' ', fourth.lname )  AS fourth
 FROM ( ( ( ( ( ( ( ( games g
 RIGHT  OUTER  JOIN games_referees ref_ass ON ( g.id = ref_ass.gnum )  )
 RIGHT  OUTER  JOIN people ref ON ( ref.login = ref_ass.referee )  )
 RIGHT  OUTER  JOIN games_referees ar1_ass ON ( g.id = ar1_ass.gnum )  )
 RIGHT  OUTER  JOIN people ar1 ON ( ar1.login = ar1_ass.referee )  )
 RIGHT  OUTER  JOIN games_referees ar2_ass ON ( g.id = ar2_ass.gnum )  )
 RIGHT  OUTER  JOIN people ar2 ON ( ar2.login = ar2_ass.referee )  )
 RIGHT  OUTER  JOIN games_referees fourth_ass ON ( g.id = fourth_ass.gnum )
 )
 RIGHT  OUTER  JOIN people fourth ON ( fourth.login = fourth_ass.referee )
 )
 WHERE ref_ass.position =1 AND ar1_ass.position =2 AND ar2_ass.position =3
 AND fourth_ass.position =4 AND g.date =  '2004-09-25'
 
 Any help would be greatly appreciated.

Hi Andy,

If no-one manages to find a solution for you right away, could you please
supply some pseudo-data from the tables you are working with. Also, which db
server application and version are you working with?

I'm sure a solution can be found, but I for one would be closer to helping
you find it if I had a better idea of the structure of the tables involved
and the data they contain.

Regards,

Murray

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



Re: [PHP-DB] Need help with a tricky query

2005-05-20 Thread Brent Baisley
First, your design could be better. You are storing the same data 
(referee) in multiple columns. More on that later.

I think the problem with your query is that you are using RIGHT OUTER 
JOINS when you can and should be using LEFT JOINS. You want to make 
sure you are always keeping the games regardless of the number of refs 
you find, so you left join the other tables to the games table. 
Basically saying keep the table on the left intact. I think that's what 
you are trying to do with the RIGHT OUTER JOIN. Try changing all your 
RIGHT OUTER to LEFT.

Now, on to your design. You should just have one column for the 
referee. Your queries will be easier and faster and you won't have a 
limit to the number of referees you can have assigned. In your design, 
you will need to modified the table structure every time you need to 
support an extra ref. Plus, you have empty spaces in table when you 
have less than 4 refs. And what if you want to find out which games a 
ref is assigned to? You need to query 4 columns.
You can use the GROUP_CONCAT function to get everything in one row.

On May 19, 2005, at 8:35 PM, Andy Green wrote:
I'm trying to write a query that pulls details on a game record, as 
well as
the officials assigned to the game (up to 4 officials may be assigned 
to
each game, but that's not always the case).

Game details are in the games table, and assignments are in the
games_referees table (which I alias as referee,ar1,ar2, and fourth).
Ultimately, I want all the games for a given date, and the referees 
assigned
to them.  Below is the query I'm working with so far.  In its current 
state,
it returns results only when a full crew is assigned to the game 
(referee,
ar1,ar2, fourth).  The query is below:

SELECT g. * , concat( ref.fname,  ' ', ref.lname )  AS ref, concat(
ar1.fname,  ' ', ar1.lname )  AS ar1, concat( ar2.fname,  ' ', 
ar2.lname )
AS ar2, concat( fourth.fname,  ' ', fourth.lname )  AS fourth
FROM ( ( ( ( ( ( ( ( games g
RIGHT  OUTER  JOIN games_referees ref_ass ON ( g.id = ref_ass.gnum )  )
RIGHT  OUTER  JOIN people ref ON ( ref.login = ref_ass.referee )  )
RIGHT  OUTER  JOIN games_referees ar1_ass ON ( g.id = ar1_ass.gnum )  )
RIGHT  OUTER  JOIN people ar1 ON ( ar1.login = ar1_ass.referee )  )
RIGHT  OUTER  JOIN games_referees ar2_ass ON ( g.id = ar2_ass.gnum )  )
RIGHT  OUTER  JOIN people ar2 ON ( ar2.login = ar2_ass.referee )  )
RIGHT  OUTER  JOIN games_referees fourth_ass ON ( g.id = 
fourth_ass.gnum )
)
RIGHT  OUTER  JOIN people fourth ON ( fourth.login = 
fourth_ass.referee )  )
WHERE ref_ass.position =1 AND ar1_ass.position =2 AND ar2_ass.position 
=3
AND fourth_ass.position =4 AND g.date =  '2004-09-25'

Any help would be greatly appreciated.
Thank
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Need help with a tricky query

2005-05-20 Thread Murray @ PlanetThoughtful
  SELECT g. * , concat( ref.fname,  ' ', ref.lname )  AS ref, concat(
  ar1.fname,  ' ', ar1.lname )  AS ar1, concat( ar2.fname,  ' ', ar2.lname
 )
  AS ar2, concat( fourth.fname,  ' ', fourth.lname )  AS fourth
  FROM ( ( ( ( ( ( ( ( games g
  RIGHT  OUTER  JOIN games_referees ref_ass ON ( g.id = ref_ass.gnum )  )
  RIGHT  OUTER  JOIN people ref ON ( ref.login = ref_ass.referee )  )
  RIGHT  OUTER  JOIN games_referees ar1_ass ON ( g.id = ar1_ass.gnum )  )
  RIGHT  OUTER  JOIN people ar1 ON ( ar1.login = ar1_ass.referee )  )
  RIGHT  OUTER  JOIN games_referees ar2_ass ON ( g.id = ar2_ass.gnum )  )
  RIGHT  OUTER  JOIN people ar2 ON ( ar2.login = ar2_ass.referee )  )
  RIGHT  OUTER  JOIN games_referees fourth_ass ON ( g.id = fourth_ass.gnum
 )
  )
  RIGHT  OUTER  JOIN people fourth ON ( fourth.login = fourth_ass.referee
 )
  )
  WHERE ref_ass.position =1 AND ar1_ass.position =2 AND ar2_ass.position
 =3
  AND fourth_ass.position =4 AND g.date =  '2004-09-25'
 
  Any help would be greatly appreciated.
 
 Hi Andy,
 
 If no-one manages to find a solution for you right away, could you please
 supply some pseudo-data from the tables you are working with. Also, which
 db
 server application and version are you working with?
 
 I'm sure a solution can be found, but I for one would be closer to helping
 you find it if I had a better idea of the structure of the tables involved
 and the data they contain.

One relatively simple way of dealing with a situation like this, presuming
that your tables look something like:

[games]
Recid, gameid, gamedesc, gamedate
1, 1, 'Game 1', '2005-01-01 00:00:00'
2, 2, 'Game 2', '2005-01-01 00:00:00'
3, 3, 'Game 3', '2005-01-02 00:00:00'
4, 4, 'Game 4', '2005-01-03 00:00:00'

[refs]
Recid, gameid, refname
1, 1, 'ref 1'
2, 1, 'ref 2'
3, 1, 'ref 3'
4, 2, 'ref 4'
5, 2, 'ref 5'
6, 2, 'ref 6'
7, 2, 'ref 7'
8, 3, 'ref 1'
9, 3, 'ref 7'
10, 3, 'ref 8'
11, 4, 'ref 8'

...would be to use the following query:

select g.gameid, g.gamedate, g.gamedesc, group_concat(r.refname order by
r.refname) from games g join refs r on g.gameid = r.gameid group by r.gameid

This makes use of mysql's group_concat() aggregate function to produce a
recordset like:

Gameid, gamedate, gamedesc, reflist
1, '2005-01-01 00:00:00', 'Game 1', 'ref 1,ref 2,ref 3'
2, '2005-01-01 00:00:00', 'Game 2', 'ref 4,ref 5,ref 6,ref 7'
3, '2005-01-02 00:00:00', 'Game 3', 'ref 1,ref 7,ref 8'
4, '2005-01-03 00:00:00', 'Game 4', 'ref 8'

Then you would simply use PHP's explode() function on the reflist field of
each record to populate an array with the names of the referees of each
game.

Note: I believe group_concat() is specific to MySQL and is only available in
versions 4.1.x and above.

Hope this is of some help.

Murray

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



[PHP-DB] Need help with a tricky query

2005-05-19 Thread Andy Green
I'm trying to write a query that pulls details on a game record, as well as
the officials assigned to the game (up to 4 officials may be assigned to
each game, but that's not always the case).

Game details are in the games table, and assignments are in the
games_referees table (which I alias as referee,ar1,ar2, and fourth).  

Ultimately, I want all the games for a given date, and the referees assigned
to them.  Below is the query I'm working with so far.  In its current state,
it returns results only when a full crew is assigned to the game (referee,
ar1,ar2, fourth).  The query is below:

SELECT g. * , concat( ref.fname,  ' ', ref.lname )  AS ref, concat(
ar1.fname,  ' ', ar1.lname )  AS ar1, concat( ar2.fname,  ' ', ar2.lname )
AS ar2, concat( fourth.fname,  ' ', fourth.lname )  AS fourth
FROM ( ( ( ( ( ( ( ( games g
RIGHT  OUTER  JOIN games_referees ref_ass ON ( g.id = ref_ass.gnum )  )
RIGHT  OUTER  JOIN people ref ON ( ref.login = ref_ass.referee )  )
RIGHT  OUTER  JOIN games_referees ar1_ass ON ( g.id = ar1_ass.gnum )  )
RIGHT  OUTER  JOIN people ar1 ON ( ar1.login = ar1_ass.referee )  )
RIGHT  OUTER  JOIN games_referees ar2_ass ON ( g.id = ar2_ass.gnum )  )
RIGHT  OUTER  JOIN people ar2 ON ( ar2.login = ar2_ass.referee )  )
RIGHT  OUTER  JOIN games_referees fourth_ass ON ( g.id = fourth_ass.gnum )
)
RIGHT  OUTER  JOIN people fourth ON ( fourth.login = fourth_ass.referee )  )
WHERE ref_ass.position =1 AND ar1_ass.position =2 AND ar2_ass.position =3
AND fourth_ass.position =4 AND g.date =  '2004-09-25'

Any help would be greatly appreciated.

Thank

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



[PHP-DB] Need help with MySQL query

2004-03-05 Thread Mikhail U. Petrov
Hi!
I need help with simple mysql query.
I have table:
program{
program_id,
partner_id
}
partner{
partner_id,
parnter_name
}
how I can get number of distinct partner_id's where program_id in (
bla bla bla)?
Best wishes,
Mikhail U. Petrov.

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



Re: [PHP-DB] Need help with MySQL query

2004-03-05 Thread Viorel Dragomir

- Original Message - 
From: Mikhail U. Petrov [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 05, 2004 11:38 AM
Subject: [PHP-DB] Need help with MySQL query


 Hi!
 I need help with simple mysql query.
 I have table:
 program{
 program_id,
 partner_id
 }
 partner{
 partner_id,
 parnter_name
 }
 how I can get number of distinct partner_id's where program_id in (
 bla bla bla)?

select distinct a.partner_id, a.partner_name
from partner a, program b
where a.partner_id = b.partner_id
and b.partner_id in (1, 2, 3)

 Best wishes,
 Mikhail U. Petrov.
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP-DB] Need help with MySQL query

2004-03-05 Thread Viorel Dragomir




 
 - Original Message - 
 From: Mikhail U. Petrov [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, March 05, 2004 11:38 AM
 Subject: [PHP-DB] Need help with MySQL query
 
 
  Hi!
  I need help with simple mysql query.
  I have table:
  program{
  program_id,
  partner_id
  }
  partner{
  partner_id,
  parnter_name
  }
  how I can get number of distinct partner_id's where program_id in (
  bla bla bla)?
 
 select distinct a.partner_id, a.partner_name
 from partner a, program b
 where a.partner_id = b.partner_id
 and b.partner_id in (1, 2, 3) 

sorry for the last line...
and b.program_id in (1, 2, 3)

 
  Best wishes,
  Mikhail U. Petrov.
  
  -- 
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re[2]: [PHP-DB] Need help with MySQL query

2004-03-05 Thread Mikhail U. Petrov
Hi!
Sorry for disturbing, but, at first, this solution isn't right and,
second, I have solved this problem yet. count (distinct blablabla)
is turned to be right.
But thanks...
Hello Viorel,

Friday, March 5, 2004, 12:42:51 PM, you wrote:


VD - Original Message - 
VD From: Mikhail U. Petrov [EMAIL PROTECTED]
VD To: [EMAIL PROTECTED]
VD Sent: Friday, March 05, 2004 11:38 AM
VD Subject: [PHP-DB] Need help with MySQL query


 Hi!
 I need help with simple mysql query.
 I have table:
 program{
 program_id,
 partner_id
 }
 partner{
 partner_id,
 parnter_name
 }
 how I can get number of distinct partner_id's where program_id in (
 bla bla bla)?

VD select distinct a.partner_id, a.partner_name
VD from partner a, program b
VD where a.partner_id = b.partner_id
VD and b.partner_id in (1, 2, 3)

 Best wishes,
 Mikhail U. Petrov.
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 




-- 
Best regards,
 Mikhailmailto:[EMAIL PROTECTED]

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



[PHP-DB] Need help replacing one record

2004-01-09 Thread Jeroen Wasteels
Is there a way to change the information in one record of a database, for
example the password, without having to open the entire row, delete it, and
then add it with $row_data[name] and all and the $newpass as changed
password?

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



RE: [PHP-DB] Need help replacing one record

2004-01-09 Thread Humberto Silva

$result=mysql_query(UPDATE tablename SET userpwd='$newpass' WHERE
username='$name');


-Original Message-
From: Jeroen Wasteels [mailto:[EMAIL PROTECTED] 
Sent: sexta-feira, 9 de Janeiro de 2004 18:24
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Need help replacing one record


Is there a way to change the information in one record of a database,
for example the password, without having to open the entire row, delete
it, and then add it with $row_data[name] and all and the $newpass as
changed password?

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

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



RE: [PHP-DB] Need help replacing one record

2004-01-09 Thread Hutchins, Richard
If I understand your question correctly, an UPDATE query should be all you
need.

UPDATE tablename SET columname='value' WHERE someid='somenum';

I'm assuming you don't have the MySQL doc. Check mysql.com for the docs for
your version of the server.

Rich Hutchins, CIW Professional
Sr. Technical Writing Administrator
Getinge USA
1777 E. Henrietta Rd.
Rochester NY 14623
585-272-5072
www.getingeusa.com



 -Original Message-
 From: Jeroen Wasteels [mailto:[EMAIL PROTECTED]
 Sent: Friday, January 09, 2004 1:24 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Need help replacing one record
 
 
 Is there a way to change the information in one record of a 
 database, for
 example the password, without having to open the entire row, 
 delete it, and
 then add it with $row_data[name] and all and the $newpass as changed
 password?
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP-DB] need help with a query

2004-01-02 Thread Kirk Babb
 RE c1: I do not know how I was going to record the records of one team vs
 another in a specific series.  That is a very good point and I don't have
an
 answer.

I realize this is getting more OT, but if anyone has a nice table structure
for handling team v. team series stats I'd like to hear it.

Thanks,

Kirk

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



[PHP-DB] need help with a query

2003-12-31 Thread Kirk Babb
If (in MySQL) I have to select 'playerID' from the table soccer.players
based on lname='smith', fname='john', and dob='1988-12-02' and THEN update
soccer.teams 'coachID' equal to the result of the select statement, can I do
it all in one query?

Or must I let my PHP script execute a select, grab the result, and then run
the update statement?

The scenario is this: I've just created the player record in soccer.players
(it's an adult league, so a player could also be the coach) and need to grab
that playerID to insert into the coachID section of  soccer.teams.

Here's the definitions for my tables if it would help you follow my question
(with thanks to Micah for the structural assistance):
divisions
Table comments : league division names with identifier

  Field Type Null Default
  divisionID   int(11) No
  division_name   varchar(15) No

players
Table comments : player registration and statistical info

  Field Type Null Default
  playerID   int(11) No
  lname   varchar(20) No
  fname   varchar(20) No
  teamID   int(11) No  0
  dob   date No  -00-00
  address   varchar(40) No
  telephone   int(9) No  2147483647
  email   varchar(40) No
  sex   enum('m', 'f') No  m
  yellow   int(2) No  0
  red   int(2) No  0
  disc_notes   text Yes  NULL
  goals_scored   int(2) No  0
  own_goals   int(2) No  0

teams
Table comments : Team registration and statistical info

  Field Type Null Default
  teamID   int(11) No
  team_name   varchar(20) No
  pwd   varchar(7) No
  coachID   int(11) No  0
  divisionID   int(11) No  0
  paid   enum('y', 'n') No  n
  pmnt_notes   text Yes  NULL
  win   int(2) No  0
  loss   int(2) No  0
  tie   int(2) No  0
  goals_for   int(2) No  0
  goals_against   int(2) No  0


Thanks for your help!

Kirk

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



Re: [PHP-DB] need help with a query

2003-12-31 Thread Mihail Bota
I do not think it is going to work, you may want to stick with the PHP
script. MySQL says that is going to enable subqueries from version 4.1 and
the most recent release is 4.0.16 or 4.0.17.

A question and 2 comments:
q: the teams are fixed within league?
c1: it is not clear how you record the goals of a team against of another.
2. you may want to check the sizes of some fields; some are too big, or
too small.

Mihai
On Wed, 31 Dec 2003, Kirk Babb wrote:

 If (in MySQL) I have to select 'playerID' from the table soccer.players
 based on lname='smith', fname='john', and dob='1988-12-02' and THEN update
 soccer.teams 'coachID' equal to the result of the select statement, can I do
 it all in one query?

 Or must I let my PHP script execute a select, grab the result, and then run
 the update statement?

 The scenario is this: I've just created the player record in soccer.players
 (it's an adult league, so a player could also be the coach) and need to grab
 that playerID to insert into the coachID section of  soccer.teams.

 Here's the definitions for my tables if it would help you follow my question
 (with thanks to Micah for the structural assistance):
 divisions
 Table comments : league division names with identifier

   Field Type Null Default
   divisionID   int(11) No
   division_name   varchar(15) No

 players
 Table comments : player registration and statistical info

   Field Type Null Default
   playerID   int(11) No
   lname   varchar(20) No
   fname   varchar(20) No
   teamID   int(11) No  0
   dob   date No  -00-00
   address   varchar(40) No
   telephone   int(9) No  2147483647
   email   varchar(40) No
   sex   enum('m', 'f') No  m
   yellow   int(2) No  0
   red   int(2) No  0
   disc_notes   text Yes  NULL
   goals_scored   int(2) No  0
   own_goals   int(2) No  0

 teams
 Table comments : Team registration and statistical info

   Field Type Null Default
   teamID   int(11) No
   team_name   varchar(20) No
   pwd   varchar(7) No
   coachID   int(11) No  0
   divisionID   int(11) No  0
   paid   enum('y', 'n') No  n
   pmnt_notes   text Yes  NULL
   win   int(2) No  0
   loss   int(2) No  0
   tie   int(2) No  0
   goals_for   int(2) No  0
   goals_against   int(2) No  0


 Thanks for your help!

 Kirk

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



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



Re: [PHP-DB] need help with a query

2003-12-31 Thread Kirk Babb

Mihail Bota [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I do not think it is going to work, you may want to stick with the PHP
 script. MySQL says that is going to enable subqueries from version 4.1 and
 the most recent release is 4.0.16 or 4.0.17.

 A question and 2 comments:
 q: the teams are fixed within league?
 c1: it is not clear how you record the goals of a team against of another.
 2. you may want to check the sizes of some fields; some are too big, or
 too small.

 Mihai

Thanks, Mihail. I'm using PHP 4.3.3 and MySQL 4.0.15-standard (stuck with
what my ISP is providing).

RE q: I don't understand your question.  Do you mean, the teams are fixed
for each season?  The answer is yes.

RE c1: I do not know how I was going to record the records of one team vs
another in a specific series.  That is a very good point and I don't have an
answer.

RE c2: I'll check the field sizes, thanks.

Regards,

Kirk

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



[PHP-DB] Need help!!!

2003-12-12 Thread irinchiang


Hi..

Anyone can help me with this script???I kept getting error saying i did not 
define the variable $tutor_id and whenever I define it as $tutor_id = $_POST
['tutor_id'], I got error saying there was an Undefined index!
What was exactly the problem??
Need help desperately , greatly appreciate any suggestions/help/solutions 
given...

---

===edit.php 
 
$dsn = mysql://root:[EMAIL PROTECTED]/tb1; 
$db = DB::connect ($dsn); 

   if (DB::isError ($db)) 
   die ($db-getMessage()); 

$action = $_GET[action]; 

if($action == delete) 
{ 
$sql = mysql_query (DELETE FROM tutor WHERE tutor_id='$tutor_id'); 
} 

if($action == edit) 
{ 
$sql = mysql_query (SELECT * FROM tutor WHERE tutor_id 
='$tutor_id');**ERROR HERE!!* 

$row = mysql_fetch_array($sql); 

echo form name=\edit_tutor\ method=\post\ action=\edit2.php\; 
echo Tutor ID : .$row['tutor_id'].br; 
echo input type=\hidden\ name=\tutor_id\ value=\.$row 
['tutor_id'].\; 
echo Name : input name=\tutor_name\ type=\text\ value=\.$row 
['tutor_name'].\br; 
echo Contact No : input type=\text\ name=\tutor_contact\ value=\.$row 
['tutor_contact'].\br; 
echo E-mail : input type=\text\ name=\tutor_email\ value=\.$row 
['tutor_email'].\br; 
echo Profile : input type=\text\ name=\tutor_profile\ value=\.$row 
['tutor_profile'].\br; 
echo input type=\submit\ name=\Submit\ value=\Update\; 
echo /form; 

} 
? 

$result = $db-query($sql); 

if( DB::isError($result) ) { 
die ($result-getMessage()); 
} 
---


Irin.

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



RE: [PHP-DB] Need help!!!

2003-12-12 Thread Griffiths, Daniel
how are you getting the $tutor_id var?, in your script you are using $action = 
$_GET[action]; so you will need to define $tutor_id like $tutor_id = 
$_GET['tutor_id'], or just use $_GET['tutor_id'].

a form can only put variables in the POST array OR the GET array, and if your using 
hyperlinks to access this script then they will of course be GET vars. 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 12 December 2003 09:38
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Need help!!!




Hi..

Anyone can help me with this script???I kept getting error saying i did not 
define the variable $tutor_id and whenever I define it as $tutor_id = $_POST
['tutor_id'], I got error saying there was an Undefined index!
What was exactly the problem??
Need help desperately , greatly appreciate any suggestions/help/solutions 
given...

---

===edit.php 
 
$dsn = mysql://root:[EMAIL PROTECTED]/tb1; 
$db = DB::connect ($dsn); 

   if (DB::isError ($db)) 
   die ($db-getMessage()); 

$action = $_GET[action]; 

if($action == delete) 
{ 
$sql = mysql_query (DELETE FROM tutor WHERE tutor_id='$tutor_id'); 
} 

if($action == edit) 
{ 
$sql = mysql_query (SELECT * FROM tutor WHERE tutor_id 
='$tutor_id');**ERROR HERE!!* 

$row = mysql_fetch_array($sql); 

echo form name=\edit_tutor\ method=\post\ action=\edit2.php\; 
echo Tutor ID : .$row['tutor_id'].br; 
echo input type=\hidden\ name=\tutor_id\ value=\.$row 
['tutor_id'].\; 
echo Name : input name=\tutor_name\ type=\text\ value=\.$row 
['tutor_name'].\br; 
echo Contact No : input type=\text\ name=\tutor_contact\ value=\.$row 
['tutor_contact'].\br; 
echo E-mail : input type=\text\ name=\tutor_email\ value=\.$row 
['tutor_email'].\br; 
echo Profile : input type=\text\ name=\tutor_profile\ value=\.$row 
['tutor_profile'].\br; 
echo input type=\submit\ name=\Submit\ value=\Update\; 
echo /form; 

} 
? 

$result = $db-query($sql); 

if( DB::isError($result) ) { 
die ($result-getMessage()); 
} 
---


Irin.

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

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



RE: [PHP-DB] Need help!!!

2003-12-12 Thread irinchiang


Yes I'm using a hyperlink to access this page (see below)
echo tda href=\edit.php?id=.$row
[tutor_id].action=edit\Modify/a/td;

and so I defined my variable $tutor_id as $tutor_id = $_GET['tutor_id'];
but i still got the error: Undefined index: tutor_id 
in /usr/local/apache/htdocs/tutor/edit.php 

WHat could be the problem?;(


---

how are you getting the $tutor_id var?, in your script you are using $action 
= $_GET[action]; so you will need to define $tutor_id like $tutor_id = $_GET
['tutor_id'], or just use $_GET['tutor_id']. 

a form can only put variables in the POST array OR the GET array, and if your 
using hyperlinks to access this script then they will of course be GET vars. 

-Original Message- 
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 12 December 2003 09:38 
To: [EMAIL PROTECTED] 
Subject: [PHP-DB] Need help!!! 




Hi.. 

Anyone can help me with this script???I kept getting error saying i did not 
define the variable $tutor_id and whenever I define it as $tutor_id = $_POST 
['tutor_id'], I got error saying there was an Undefined index! 
What was exactly the problem?? 
Need help desperately , greatly appreciate any suggestions/help/solutions 
given... 

---
 

===edit.php 
 
$dsn = mysql://root:[EMAIL PROTECTED]/tb1; 
$db = DB::connect ($dsn); 

   if (DB::isError ($db)) 
   die ($db-getMessage()); 

$action = $_GET[action]; 

if($action == delete) 
{ 
$sql = mysql_query (DELETE FROM tutor WHERE tutor_id='$tutor_id'); 
} 

if($action == edit) 
{ 
$sql = mysql_query (SELECT * FROM tutor WHERE tutor_id 
='$tutor_id');**ERROR HERE!!* 

$row = mysql_fetch_array($sql); 

echo form name=\edit_tutor\ method=\post\ action=\edit2.php\; 
echo Tutor ID : .$row['tutor_id'].br; 
echo input type=\hidden\ name=\tutor_id\ value=\.$row 
['tutor_id'].\; 
echo Name : input name=\tutor_name\ type=\text\ value=\.$row 
['tutor_name'].\br; 
echo Contact No : input type=\text\ name=\tutor_contact\ value=\.$row 
['tutor_contact'].\br; 
echo E-mail : input type=\text\ name=\tutor_email\ value=\.$row 
['tutor_email'].\br; 
echo Profile : input type=\text\ name=\tutor_profile\ value=\.$row 
['tutor_profile'].\br; 
echo input type=\submit\ name=\Submit\ value=\Update\; 
echo /form; 

} 
? 

$result = $db-query($sql); 

if( DB::isError($result) ) { 
die ($result-getMessage()); 
} 
---
 


Irin. 

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



[PHP-DB] Need HELP with UPDATE DELETE

2003-12-11 Thread irinchiang

Hi all, 

Right now I'm trying to do a UPDATE and DELETE queries using the following 
code below: But i kept getting error 
Undefined variable: tutor_id in /usr/local/apache/htdocs/tutor/edit.php on 
line .
Didn't I defined my variable $tutor_idI thought I have...
Anyone can help???
Thanks in advance =)

Below is a snip of my code :

---
===edit.php

$dsn = mysql://root:[EMAIL PROTECTED]/tb1;
$db = DB::connect ($dsn);

   if (DB::isError ($db))
   die ($db-getMessage());

$action = $_GET[action];

if($action == delete)
{
$sql = mysql_query (DELETE FROM tutor WHERE tutor_id='$tutor_id');
}

if($action == edit)
{
$sql = mysql_query (SELECT * FROM tutor WHERE tutor_id 
='$tutor_id');**ERROR HERE!!*

$row = mysql_fetch_array($sql);

echo form name=\edit_tutor\ method=\post\ action=\edit2.php\;
echo Tutor ID : .$row['tutor_id'].br;
echo input type=\hidden\ name=\tutor_id\ value=\.$row
['tutor_id'].\;
echo Name : input name=\tutor_name\ type=\text\ value=\.$row
['tutor_name'].\br;
echo Contact No : input type=\text\ name=\tutor_contact\ value=\.$row
['tutor_contact'].\br;
echo E-mail : input type=\text\ name=\tutor_email\ value=\.$row
['tutor_email'].\br;
echo Profile : input type=\text\ name=\tutor_profile\ value=\.$row
['tutor_profile'].\br;
echo input type=\submit\ name=\Submit\ value=\Update\;
echo /form;

}
?

$result = $db-query($sql);

if( DB::isError($result) ) {
die ($result-getMessage());
}

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



[PHP-DB] Need help with queries

2003-10-30 Thread Shiloh Madsen
I need some help with some join queries im working on and was wondering if
someone might be able to give me some help with them. Kinda lookiin for more
real time discussion, so if you feel like givin me some help, hit me on IM.

AIM: lumerian3
Yahoo: lumerian1
MSN: [EMAIL PROTECTED]
ICQ: 76145844

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



Re: [PHP-DB] Need help with queries

2003-10-30 Thread Filip de Waard
On Fri, 2003-10-31 at 01:23, Shiloh Madsen wrote:
 I need some help with some join queries im working on and was wondering if
 someone might be able to give me some help with them. Kinda lookiin for more
 real time discussion, so if you feel like givin me some help, hit me on IM.

Hi,

If you want real time discussion use IRC. #php on freenode is nice, but
the #php channel on OFTC is a little more cosy (and non-freenode :P).

Regards,

Filip de Waard

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



[PHP-DB] Need help Get/send Variabel to another window

2003-10-10 Thread agus supriatna
Dear all

I have two page one as main and secon as child, now I have problem how to
send variable/data to main page from child

thanks in advance
asupna

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



[PHP-DB] Need help with a OpenLink ODBC driver error again

2003-10-06 Thread Don Myers
Ok this time I checked the SQL select syntax! So I hope it's not something
that easy again (Well actually easy would be nice)

The other day I Posted a email question about getting a 37000 sql error but
my sql syntax was wrong. Yes I felt stupid but this time I corrected the
syntax and I am still getting an error but, the error is that the web
browser times-out trying to get the page. (Nothing displayed and a browser
error

Could not open the page ³http://127.0.0.1/tests/odbc.php² because Safari
could not load any data for this location.

I get the same type of thing with Internet Explorer.

Here is a recap.

I am using iodbc from openlink on OS X and everything seems fine. I can get
and display tables with:

$results = odbc_tables($conn) or die(P.odbc_errormsg());
odbc_result_all($results) or die(ppulling result error);

(full syntax below)

But when I switch to

$results = odbc_exec($conn,$sql) or die(p captured .odbc_errormsg());
odbc_result_all($results) or die(ppulling result error);

I get an:
Could not open the page ³http://127.0.0.1/tests/odbc.php² because Safari
could not load any data for this location.

Any ideas? Why tables work but SQL Select doesn't?

Also I have a 5 user openlink license. how do I reset the connections after
I get 5 errors because I think the connections are not dropped when PHP gets
an error? The only way I can get to 5 lic. Limit to reset is to restart os
x? Sudo apachectl restart doesn't seem to work either?

Full Syntax:

? 
odbc_close_all();

putenv(DYLD_LIBRARY_PATH=/usr/lib/libiodbc.dylib);
putenv(ODBCINSTINI=/Library/ODBC/odbcinst.ini);
putenv(ODBCINI=/Library/ODBC/odbc.ini); //odbc.ini contains your DSNs.

$dsn=DSNname; // this is a valid DSN ’ can be tested in odbctest
$user=name; 
$password=password;
$sql=SELECT * FROM tblDepartments;

$conn=odbc_connect($dsn,$user,$password) or die (pcouldn't
connect);

echo connected to DSN: $dsn;
echo BRbSQL:/b $sqlBR;

//$results = odbc_exec($conn,$sql) or die(p captured .odbc_errormsg());
$results = odbc_tables($conn) or die(P.odbc_errormsg());

odbc_result_all($results) or die(ppulling result error);


echo closing connection $conn;
odbc_close($conn);
odbc_close_all();
?

Don Myers

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



RE: [PHP-DB] Need help with a OpenLink ODBC driver error again

2003-10-06 Thread Jacob A. van Zanen
Hi

Does the query return data when executed not through a browser but
directly on the database? 
If yes, how much time does it take to return the data. I believe default
time out for apache is 30 seconds. 
So maybe it's a webserver setting that needs to be increased.



Jack


-Original Message-
From: Don Myers [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 06, 2003 3:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Need help with a OpenLink ODBC driver error again 


Ok this time I checked the SQL select syntax! So I hope it's not
something that easy again (Well actually easy would be nice)

The other day I Posted a email question about getting a 37000 sql error
but my sql syntax was wrong. Yes I felt stupid but this time I corrected
the syntax and I am still getting an error but, the error is that the
web browser times-out trying to get the page. (Nothing displayed and a
browser error

Could not open the page ³http://127.0.0.1/tests/odbc.php² because
Safari could not load any data for this location.

I get the same type of thing with Internet Explorer.

Here is a recap.

I am using iodbc from openlink on OS X and everything seems fine. I can
get and display tables with:

$results = odbc_tables($conn) or die(P.odbc_errormsg());
odbc_result_all($results) or die(ppulling result error);

(full syntax below)

But when I switch to

$results = odbc_exec($conn,$sql) or die(p captured
.odbc_errormsg());
odbc_result_all($results) or die(ppulling result error);

I get an:
Could not open the page ³http://127.0.0.1/tests/odbc.php² because
Safari could not load any data for this location.

Any ideas? Why tables work but SQL Select doesn't?

Also I have a 5 user openlink license. how do I reset the connections
after I get 5 errors because I think the connections are not dropped
when PHP gets an error? The only way I can get to 5 lic. Limit to reset
is to restart os x? Sudo apachectl restart doesn't seem to work either?

Full Syntax:

? 
odbc_close_all();

putenv(DYLD_LIBRARY_PATH=/usr/lib/libiodbc.dylib);
putenv(ODBCINSTINI=/Library/ODBC/odbcinst.ini);
putenv(ODBCINI=/Library/ODBC/odbc.ini); //odbc.ini contains your DSNs.

$dsn=DSNname; // this is a valid DSN ’ can be tested in odbctest
$user=name; 
$password=password;
$sql=SELECT * FROM tblDepartments;

$conn=odbc_connect($dsn,$user,$password) or die (pcouldn't
connect);

echo connected to DSN: $dsn;
echo BRbSQL:/b $sqlBR;

//$results = odbc_exec($conn,$sql) or die(p captured
.odbc_errormsg()); $results = odbc_tables($conn) or
die(P.odbc_errormsg());

odbc_result_all($results) or die(ppulling result error);


echo closing connection $conn;
odbc_close($conn);
odbc_close_all();
?

Don Myers

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

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



[PHP-DB] need help with repeated regions

2003-07-27 Thread Alberto
Plz could some one help me how to create an horizontal repeated region in a
php page using a mysql database for showing thumbnail without using a
expensive plugin such like MXlooper for dreamweaver MX. plz sent me help
over mail [EMAIL PROTECTED] thx



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



[PHP-DB] Need help on query

2003-06-26 Thread Gezeala 'Eyah' Bacuño II
Dear all,

I have 2 tables product_customer and product_price

product_customer

prod_cust_idprod_cust_product_idprod_cust_customer_id
1   1   1
2   2   1
3   3   1
4   1   2
product_price

prod_price_id   prod_price_prod_cust_id prod_price_unitpriceprod_price_currency_id 
 prod_price_effective_date
1   1   1.23456 2  
 6/30/2003
2   1   1.12346 3  
 5/9/2003
3   4   0.23456 3  
 5/21/2003
4   4   1.45678 3  
 6/26/2003
Column prod_price_prod_cust_id of product_price table references 
prod_cust_id of product_customer table..

I have this query :

SELECT prod_price_prod_cust_id, prod_price_id, prod_price_unitprice, 
prod_price_effective_date
FROM product_price
WHERE prod_price_prod_cust_id in (1,4)
GROUP BY prod_price_prod_cust_id, prod_price_id, prod_price_unitprice, 
prod_price_effective_date
HAVING MAX(prod_price_effective_date) = current_date

Which returns :

prod_price_prod_cust_id prod_price_id   prod_price_unitprice
prod_price_effective_date
1   2   1.12346 5/9/2003
4   3   0.23456 5/21/2003
4   4   1.45678 6/26/2003
What I intend to get is the maximum prod_price_effective_date for each 
prod_price_prod_cust_id.
The second row should not be included in the output since 6/26/2003 is 
greater than 5/21/2003 .

My target output is this :

prod_price_prod_cust_id prod_price_id   prod_price_unitprice
prod_price_effective_date
1   2   1.12346 5/9/2003
4   4   1.45678 6/26/2003
Any suggestions on how I can arrive with these output??

Help is greatly appreciated..TIA!

Marie Gezeala M. Bacuño II
Information Systems Department
Your choice: the red pill or the blue pill.

_
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail

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


Fwd: Re: [PHP-DB] need help with foreach()

2003-03-10 Thread David Rice
Here is the complete function I am using.
I returned, for testing i commented out the foreach loop and returned 
$staff, then $tips both arrays returned NULL when i did a 
var_dump(pointvalue($startdate));

can anyone see how this could be solved?

Cheers,
dave
==
function pointvalue($start){
	$query = SELECT * FROM Tips WHERE date = $start and date = ($start + 
INTERVAL 6 DAY) ;
	$result = mysql_query($query);
	while($row = mysql_fetch_array($result)){
	$date = $row[Date];
		$tips[$date] = $row[TotalTips];
	}
	$query = SELECT * FROM Rota WHERE date = $start and date = ($start + 
INTERVAL 6 DAY) ;
	$result = mysql_query($query);
	while ($row = mysql_fetch_array($result)){
		$date = $row[Date];
		if (isset($staff[$date])){

			$staff[$date] = $staff[$date] + 1;

}
else{
$staff[$date] = 1;
}
}
return $staff;
}
_
Use MSN Messenger to send music and pics to your friends 
http://messenger.msn.co.uk

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


Re: Fwd: Re: [PHP-DB] need help with foreach()

2003-03-10 Thread Jason Wong
On Monday 10 March 2003 17:56, David Rice wrote:
 Here is the complete function I am using.
 I returned, for testing i commented out the foreach loop and returned
 $staff, then $tips both arrays returned NULL when i did a
 var_dump(pointvalue($startdate));

I haven't been following this thread so I'm not sure what your objective is. 
But ...


 function pointvalue($start){
   $query = SELECT * FROM Tips WHERE date = $start and date = ($start +
 INTERVAL 6 DAY) ;
   $result = mysql_query($query);
   while($row = mysql_fetch_array($result)){
   $date = $row[Date];

You should really be using:

   $date = $row['Date'];

Also what is $date supposed to be storing? Each iteration of the while-loop 
it's being overwritten with the 'latest' date.

   $tips[$date] = $row[TotalTips];

As above you should put single-quotes around your array subscripts.

   }
   $query = SELECT * FROM Rota WHERE date = $start and date = ($start +
 INTERVAL 6 DAY) ;
   $result = mysql_query($query);
   while ($row = mysql_fetch_array($result)){
   $date = $row[Date];

Again, see above comments.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
You can observe a lot just by watching.  -- Yogi Berra
*/


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



[PHP-DB] need help with foreach()

2003-03-09 Thread David Rice
Okay, i have two arrays, $tips and $staff

$tips has a key date (which is the date of the first day of the week, the 
second result in the array has the key of the second day of the week etc... 
) and the value is a floating point decimal.

$staff also has a key date and the value is an integer, the number of 
staff working in one day.

To find out the ammount of tips every staff member is to get we have to 
divide the value of $tips by the value of $staff (when the dates are the 
same)

what i was trying  to get this to work is below,

any help would be great,
cheers
dave
=
foreach($tips as $key = $value){

		$pointvalue[$key] = $value / current($staff) ;

next($staff);
}
_
Express yourself with cool emoticons http://messenger.msn.co.uk
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] need help with foreach()

2003-03-09 Thread David Rice
Hey thank's for the ideas but  neither of them work, doh...

Okay fredrik I know your idea won't work cos list only works with numericaly 
indexed arrays, both the arrays that i am using are indexed by date.
(it produces a parse error when run)
=
while(list($d, $t) = each($tips)){
  $res = $t / $staff[$d];
  // Do what you need with $res ...
}
=

Janet your idea i would have thought would work but i can't get it to, 
for some reason

whenever I run the script it just gives me...
Warning:  Invalid argument supplied for foreach() in 
/home/filterseveuk/public_html/project/tips.php on line 56
Not sure as to what it is talking abotu here as far as I know, this should 
work.

=
foreach($tips as $key = $value){
    $pointvalue[$key] = $value / $staff[$key] ;

 }

==

Does anyone else have a solution!?
Cheers,
Dave


In a message dated 3/9/2003 2:07:26 PM Pacific Standard Time, 
[EMAIL PROTECTED] writes:



Okay, i have two arrays, $tips and $staff

$tips has a key date (which is the date of the first day of the week, the
second result in the array has the key of the second day of the week etc...
) and the value is a floating point decimal.
$staff also has a key date and the value is an integer, the number of
staff working in one day.
To find out the ammount of tips every staff member is to get we have to
divide the value of $tips by the value of $staff (when the dates are the
same)
what i was trying  to get this to work is below,

any help would be great,
cheers
dave
=
foreach($tips as $key = $value){

    $pointvalue[$key] = $value / current($staff) ;

    next($staff);
    }


_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://messenger.msn.co.uk

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


Re: [PHP-DB] need help with foreach()

2003-03-09 Thread Fredrik de Vibe
[EMAIL PROTECTED] (David Rice) writes:
 Hey thank's for the ideas but  neither of them work, doh...
 Okay fredrik I know your idea won't work cos list only works with
 numericaly indexed arrays, both the arrays that i am using are indexed
 by date.

You really had me wondering there for a moment. I've done this dozens
of times and list() does work with other than numerical values.

 (it produces a parse error when run)

Ok, I hadn't tested the code. For some reason you have to group $t /
$staff[$d] in parantheses, why I really don't know, it shouldn't be
necessary.

 =
 while(list($d, $t) = each($tips)){
   $res = ($t / $staff[$d]);
  ^   ^
   // Do what you need with $res ...
 }
 =

The code below is tested and works.
---
$tips = array(foo = bar,
  bar = foo);

$staff = array(foo = foobar,
   bar = barfoo);

while(list($d, $t) = each($tips)){
  printf(%s - %s - %sbr\n, $d, $t, $staff[$d]);
}


-- 
--Fredrik
New systems generate new problems.

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



Re: [PHP-DB] need help with foreach()

2003-03-09 Thread Jason Wong
On Monday 10 March 2003 08:10, David Rice wrote:
 Hey thank's for the ideas but  neither of them work, doh...

 Okay fredrik I know your idea won't work cos list only works with
 numericaly indexed arrays, both the arrays that i am using are indexed by
 date. (it produces a parse error when run)

Parse error simply means the code has a syntax error. Not necessarily that the 
idea doesn't work.

 Janet your idea i would have thought would work but i can't get it to,
 for some reason

 whenever I run the script it just gives me...
 Warning:  Invalid argument supplied for foreach() in
 /home/filterseveuk/public_html/project/tips.php on line 56
 Not sure as to what it is talking abotu here as far as I know, this should
 work.

 =
 foreach($tips as $key = $value){

 $pointvalue[$key] = $value / $staff[$key] ;

  }

What does print_r($tips) give you? While you're at it do a var_dump($tips) as 
well.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Too cool to calypso,
Too tough to tango,
Too weird to watusi
-- The Only Ones
*/


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



[PHP-DB] Need help with php and apache

2003-03-06 Thread Stephen K Knight
I am currently running on a Windows Box the OS is ME
I have installed apache 2.0.44 and I have downloaded the newest PHP download
for windows.
I have read the configuration manual repeatedly for getting the php into the
apache httpd.conf doc file. but I still cannot get php to be recognized.

Can anyone help me with this?


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



[PHP-DB] need help with fetching a result using a function

2003-03-02 Thread David Rice
I am trying to write a few functions for a project i need to do for school, 
this function should return all the inactive, or active users (1 or 0 
staffstatusid) as an array for creating a drop down menu.

Now when i perform the following code (yes it is included in a script that 
connects to the databas i am using) it returns the following error.

Warning:  Supplied argument is not a valid MySQL result resource in 
/home/filterseveuk/public_html/project/getusers.php on line 7

and underneath the error it prints the value of var_dump($data)
which is  NULL
any ideas how to fix this?

=
?
function getusers($status){
$query = SELECT FROM Staff WHERE Staffstatusid = '$status';
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$users[$status] = $row ;
return $users[$status] ;
}
$status = 0 ;
$data = getusers($status);
var_dump($data);
echo $data;
?
_
Use MSN Messenger to send music and pics to your friends 
http://messenger.msn.co.uk

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


  1   2   >