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 :
> 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™ 
>
>> Hi All,
>>
>> I want to update an existing mysql record with another value after
>> calculating it. Below is the code.
>>
>> > $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)){
>> ?>
>> > "class='body1'";}?>>
>> 
>> > $res=$result_ar['mwool40_totqty']-10;
>> echo $res;
>> ?>
>> 
>> > $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



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™ 

> Hi All,
>
> I want to update an existing mysql record with another value after
> calculating it. Below is the code.
>
>  $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)){
> ?>
>  "class='body1'";}?>>
> 
>  $res=$result_ar['mwool40_totqty']-10;
> echo $res;
> ?>
> 
>  $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 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™  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?


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

  {


 echo 'Mail sent!';
  }
  }





?>




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?

';
  }
  }





?>


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™ 

> Hi All,
>
> I have this HTML form
>
>
> 
> 
> 
> 
>  
>
>   cellpadding="0" cellspacing="0" bordercolor="#00">
>
>   align="right">Your Name
>   type="text" size="50" />
>
>
>  Contact
> Numbers
>  
>
>(please specify STD code)
>
>
>   align="right">Email 
>   size="50" />
>
>  
>  
>
>  
>
>  
> 
>
>
>
>
> 
>
> 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 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



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.
>
>>
> 
>
>  
>> 
>> 
>>
>   
>
>   are you missing ";" on this line after echo statement
> should be 
>
> 
>
>

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



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.
>
> 
> 
> 
> 
>   
> 
are you missing ";" on this line after echo statement should be 

 


- -- 
ヘスス   アルベルト
"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



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   
wrote:



Hi All,

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

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




b>& 
nbsp; 
  
  
   td>
td>




All Fields
""type") { echo

"selected"; } ?>>
""name") { echo

"selected"; } ?>>
""date") { echo

"selected"; } ?>>
""size") { echo

"selected"; } ?>>










*** 
*** 
*


The above code is giving me the following errors:

 Notice:  Undefined variable: filter in
C:\wamp\www\5_Final\index.php on line 228

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 in Mysql database

2010-06-30 Thread Bastien Koert
On Wed, Jun 30, 2010 at 10:52 AM, nagendra prasad
 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



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


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"  wrote:

On 18 May 2010 09:19, nagendra prasad  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

--

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


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


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
wrote:

> 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 Peter Lind
On 18 May 2010 09:19, nagendra prasad  wrote:
> 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.
>

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

-- 

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


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



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
wrote:

> 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
>
>
> 
>
> 
>
> //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 " color='blue'> Mymp3 size='3'>® type='text' onclick=value='' size='50' name='search' value='$search'>
>  type='submit' name='submit' value='Search'>";
>
>  //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 $search";
>  else
>  {
>   echo " /> align='right'>Showing 1-20 of $foundnum results found for
> $search.";
>
>   echo " /> face='sana-serif' size='3'>
>
>    Type
>
>    
> Name
>
>   
>
>    
>    Size
> ";
>
>   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 '';
>
>   print ''."$type".'';
>
>
>//print ''."http://localhost/mymp3/"."; herf='$url'>$name".'';
>
>
>print ''."$name".'';
>
>
>print ''."$size".'';
>
>
>
>  print '';
>
>  print '';
> print '';
>
>  /* echo "
>$type -->   $nameSize: $size
> 
>  Date Added: $date
>   ";   */
>   }
> ?>
>
> 
> 
> 
> 
> 
>  if (!$s<=0)
>  echo "Prev";
>
> $i =1;
> for ($x=0;$x<$foundnum;$x=$x+$e)
> {
>
>
>  echo " $i ";
>
>
> $i++;
>
>
> }
>
> if ($s<$foundnum-$e)
>  echo "Next";
>
>}
> }
>
>
> ?>
> 
> 
> 
> 
>
> --
> 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
wrote:

> 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



Re: [PHP-DB] Need help in triggers

2009-10-05 Thread gunawan

Yogendra Kaushik wrote:

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.

  

do you using PEAR? to help database?

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



Re: [PHP-DB] Need help in triggers

2009-10-05 Thread Pavan Keshavamurthy
Read the manual:

http://www.postgresql.org/docs/8.1/interactive/sql-createtrigger.html

Best
_Pavan

On Monday 05 October 2009 14:36:47 Yogendra Kaushik wrote:
> 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.
> 
> -- 
>  Regard's
> Yogendra kaushik
> 

-- 
-Pavan Keshavamurthy
http://grahana.net/

-- 
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
hay so I have solved the issue. The problem was with my login HTML page.
Anyways thanks everyone for quick responses :)


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 wrote:

  

nagendra prasad wrote:



OK so here is the form for the below code:



 
   Username: 
   Password: 
   
 


 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 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 "";
var_dump(print_r($_GET));
var_dump(print_r($_POST));
echo "";

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

*IE: 

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 
mailto:jason.ger...@scl.utah.edu>> wrote:


nagendra prasad wrote:

OK so here is the form for the below code:



 
   Username: 
   Password: 
   
 


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



--
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 wrote:

> nagendra prasad wrote:
>
>> OK so here is the form for the below code:
>>
>> 
>>
>>  
>>Username: 
>>Password: 
>>
>>  
>> 
>>
>>  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

nagendra prasad wrote:

OK so here is the form for the below code:



  
Username: 
Password: 

   
   
  




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
OK so here is the form for the below code:



  
Username: 
Password: 



  



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.


  

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 click 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 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-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
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?
>
>
> Best,
>
>


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

2009-09-20 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



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

2009-09-20 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" 

To: "Vinay Kannan" 
Cc: 
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-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,


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

2009-09-17 Thread Eric

- Original Message - 
From: "nagendra prasad" 
To: "Vinay Kannan" 
Cc: 
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
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 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
wrote:

> 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 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 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



Hope this helps.

Thanks,

patrick



On Fri, Sep 4, 2009 at 5:07 AM, nagendra prasad wrote:

> 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.
>
>
> 
> $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 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-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  wrote:
From: chris smith 
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 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-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  wrote:
From: Chris 
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/




  

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-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  wrote:
From: chris smith 
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 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 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



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



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



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 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 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



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
> 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 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: [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 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 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 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



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



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!!!

2003-12-12 Thread Griffiths, Daniel
you have the GET var in the hyperlink down as just 'id' not 'tutor_id', so change the 
hyperlink to 

echo "Modify";

or the the get var to $tutor_id = $_GET['id'];

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 12 December 2003 10:02
To: Griffiths, Daniel
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Need help!!!




Yes I'm using a hyperlink to access this page (see below)
echo "Modify";

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 ""; 
echo "Tutor ID : ".$row['tutor_id'].""; 
echo ""; 
echo "Name : "; 
echo "Contact No : "; 
echo "E-mail : "; 
echo "Profile : "; 
echo ""; 
echo ""; 

} 
?> 

$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 irinchiang


Yes I'm using a hyperlink to access this page (see below)
echo "Modify";

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 ""; 
echo "Tutor ID : ".$row['tutor_id'].""; 
echo ""; 
echo "Name : "; 
echo "Contact No : "; 
echo "E-mail : "; 
echo "Profile : "; 
echo ""; 
echo ""; 

} 
?> 

$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 ""; 
echo "Tutor ID : ".$row['tutor_id'].""; 
echo ""; 
echo "Name : "; 
echo "Contact No : "; 
echo "E-mail : "; 
echo "Profile : "; 
echo ""; 
echo ""; 

} 
?> 

$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 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



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("".odbc_errormsg());
odbc_result_all($results) or die("pulling result error");

(full syntax below)

But when I switch to

$results = odbc_exec($conn,$sql) or die(" captured
".odbc_errormsg());
odbc_result_all($results) or die("pulling 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:

couldn't
connect");

echo "connected to DSN: $dsn";
echo "SQL: $sql";

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

odbc_result_all($results) or die("pulling 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



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



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: [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



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 - %s\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 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 fetching a result using a function

2003-03-02 Thread Koleszár Tibor
Ahh, thats true. I thought its wokring in mysql.
put a * after the select

Tibor

- Original Message - 
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "'David Rice'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, March 02, 2003 5:28 PM
Subject: RE: [PHP-DB] need help with fetching a result using a function


> > 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'";
> 
> Select _WHAT_ from the table? You do not have a valid query...
> 
> > $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;
> > ?>
> 
> ---John W. Holmes...
> 
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
> 
> 
> 
> -- 
> 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 fetching a result using a function

2003-03-02 Thread John W. Holmes
> 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'";

Select _WHAT_ from the table? You do not have a valid query...

>   $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;
> ?>

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



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

2003-03-02 Thread Koleszár Tibor
Sorry,

Tried error_reporting()? The query is invalid that's sure. Maybe '0' is not
integer value (i dont know well mysql)...
(or is there any mysql_error() to get mysql's error, why were the query
invalid?)

Tibor


- Original Message -
From: "David Rice" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, March 02, 2003 4:59 PM
Subject: Re: [PHP-DB] need help with fetching a result using a function


>
> You haven't thorougly read my message, about 4/5 lines down i have said
> "(yes it is included in a script that connects to the database i am
using)"
> :)
> i have another script that calls this function script, and at the top of
it,
> it calls a script that contains my connection information.
>
> I have tested it with other queries that work... and there is no problem,
i
> am definately connected to the database
>
>
>
>
>
> >From: Koleszár Tibor <[EMAIL PROTECTED]>
> >To: "David Rice" <[EMAIL PROTECTED]>
> >Subject: Re: [PHP-DB] need help with fetching a result using a function
> >Date: Sun, 2 Mar 2003 16:54:25 +0100
> >
> >Hello,
> >
> >You have forgotten to connect :)
> >This error occurs when the $result variable is false and it is not
> >a resource (database query) id.
> >
> >Tibor
> >
> >PS:
> >for any db:
> >  $conn_id = connect(...);
> >  $result_id = query($conn_id, );
> >  $row = fetch($result_id);
> >
> >...
> >
> >
> >
> >- Original Message -
> >From: "David Rice" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Sunday, March 02, 2003 4:49 PM
> >Subject: [PHP-DB] need help with fetching a result using a function
> >
> >
> > >
> > > 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 database 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
> > >
> > >
> > >
>
> _
> Overloaded with spam? With MSN 8, you can filter it out
>
http://join.msn.com/?page=features/junkmail&pgmarket=en-gb&XAPID=32&DI=1059
>
>
> --
> 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 fetching a result using a function

2003-03-02 Thread David Rice
You haven't thorougly read my message, about 4/5 lines down i have said 
"(yes it is included in a script that connects to the database i am using)"
:)
i have another script that calls this function script, and at the top of it, 
it calls a script that contains my connection information.

I have tested it with other queries that work... and there is no problem, i 
am definately connected to the database





From: Koleszár Tibor <[EMAIL PROTECTED]>
To: "David Rice" <[EMAIL PROTECTED]>
Subject: Re: [PHP-DB] need help with fetching a result using a function
Date: Sun, 2 Mar 2003 16:54:25 +0100
Hello,

You have forgotten to connect :)
This error occurs when the $result variable is false and it is not
a resource (database query) id.
Tibor

PS:
for any db:
 $conn_id = connect(...);
 $result_id = query($conn_id, );
 $row = fetch($result_id);
...



- Original Message -
From: "David Rice" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 02, 2003 4:49 PM
Subject: [PHP-DB] need help with fetching a result using a function
>
> 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 database 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
>
>
>
_
Overloaded with spam? With MSN 8, you can filter it out 
http://join.msn.com/?page=features/junkmail&pgmarket=en-gb&XAPID=32&DI=1059

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


RE: [PHP-DB] need help spotting this php parse error

2003-01-23 Thread Peter Lovatt
Hi

Probably a missing ;

?>
   ">
   
 
 




-Original Message-
From: Ignatius Reilly [mailto:[EMAIL PROTECTED]]
Sent: 23 January 2003 22:00
To: David Rice; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] need help spotting this php parse error


Dunno.

I also remember once having a parse error, but it was on line 35.

Cheers

Ignatius

- Original Message -
From: "David Rice" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 23, 2003 8:53 PM
Subject: [PHP-DB] need help spotting this php parse error


> When i run this script it tells me that I have a parse error on line 34? I
> really can't see it anyhelp (please!) would be much appreciated Cheers,
Dave
>
> 
> session_start();
>
> if(!$HTTP_COOKIE_VARS["username"]) {
>
> /* The Cookie is not set, so load the page as if it is the first time
> */
>
> include("library/include/header.php");
> include("library/include/database.php");
>
> /* Include a header file and a database connections/functions file
> */
>
> ?>
>
> 
>
>
>
>$query = "SELECT * FROM Staff WHERE ResterauntId = 1";
>$result = mysql_query($query) or die( mysql_error () );
>
>While( $row = mysql_fetch_array($result) ) {
>
>?>
>   "> $row["2"]; ?>
>  }
>   ?>
> 
> 
>
> _
> Stay in touch with MSN Messenger http://messenger.msn.co.uk
>
>
> --
> 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: [PHP-DB] need help spotting this php parse error

2003-01-23 Thread Ignatius Reilly
Dunno.

I also remember once having a parse error, but it was on line 35.

Cheers

Ignatius

- Original Message -
From: "David Rice" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 23, 2003 8:53 PM
Subject: [PHP-DB] need help spotting this php parse error


> When i run this script it tells me that I have a parse error on line 34? I
> really can't see it anyhelp (please!) would be much appreciated Cheers,
Dave
>
> 
> session_start();
>
> if(!$HTTP_COOKIE_VARS["username"]) {
>
> /* The Cookie is not set, so load the page as if it is the first time
> */
>
> include("library/include/header.php");
> include("library/include/database.php");
>
> /* Include a header file and a database connections/functions file
> */
>
> ?>
>
> 
>
>
>
>$query = "SELECT * FROM Staff WHERE ResterauntId = 1";
>$result = mysql_query($query) or die( mysql_error () );
>
>While( $row = mysql_fetch_array($result) ) {
>
>?>
>   "> $row["2"]; ?>
>  }
>   ?>
> 
> 
>
> _
> Stay in touch with MSN Messenger http://messenger.msn.co.uk
>
>
> --
> 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 spotting this php parse error

2003-01-23 Thread Mark
Unless what showed up here isn't what you posted (quite possible),
the only differences between the first and second time you posted
were:

-require instead of include 
-Removed quotes on 



  >





--- David Rice <[EMAIL PROTECTED]> wrote:
> 
> 
> 
> It Does have a closing Brace, just check my second email it
> contains the 
> FULL code.. i missed the last few lines copying it the first time
> somehow.
> 
> 
> >From: "Andreas Sheriff" <[EMAIL PROTECTED]>
> >To: "David Rice" <[EMAIL PROTECTED]>
> >Subject: RE: [PHP-DB] need help spotting this php parse error
> >Date: Thu, 23 Jan 2003 12:09:15 -0800
> >
> >The if statement does not have a closing brace.
> >
> > > -Original Message-
> > > From: David Rice [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, January 23, 2003 11:53 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP-DB] need help spotting this php parse error
> > >
> > >
> > > When i run this script it tells me that I have a parse error on
> > > line 34? I
> > > really can't see it anyhelp (please!) would be much appreciated
> > > Cheers, Dave
> > >
> > >  > >
> > >   session_start();
> > >
> > >   if(!$HTTP_COOKIE_VARS["username"]) {
> > >
> > >   /* The Cookie is not set, so load the page as if it
> > > is the first time
> > >   */
> > >
> > >   include("library/include/header.php");
> > >   include("library/include/database.php");
> > >
> > >   /* Include a header file and a database
> > > connections/functions file
> > >   */
> > >
> > >   ?>
> > >
> > >   
> > >   
> > >
> > >> >
> > >   $query = "SELECT * FROM Staff WHERE
> > > ResterauntId = 1";
> > >   $result = mysql_query($query) or die(
> > > mysql_error () );
> > >
> > >   While( $row = mysql_fetch_array($result) ) {
> > >
> > >   ?>
> > >> > ?>"> > > $row["2"]; ?>
> > >> >   }
> > >   ?>
> > >   
> > >   
> > >
> > >
> _
> > > Stay in touch with MSN Messenger http://messenger.msn.co.uk
> > >
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> 
> _
> 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
> 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
-Stolen from the now-defunct Randy's Random mailing list.
***

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




RE: [PHP-DB] need help spotting this php parse error

2003-01-23 Thread Hutchins, Richard
In your second e-mail you posted the error message, but failed to identify
line 34. This is important so we can tell what code the parser is gagging
on. Otherwise, it's going to take longer to get an answer because we're
guessing which line is line 34.

> -Original Message-
> From: David Rice [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 23, 2003 3:11 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] need help spotting this php parse error
> 
> 
> 
> 
> 
> It Does have a closing Brace, just check my second email it 
> contains the 
> FULL code.. i missed the last few lines copying it the first 
> time somehow.
> 
> 
> >From: "Andreas Sheriff" <[EMAIL PROTECTED]>
> >To: "David Rice" <[EMAIL PROTECTED]>
> >Subject: RE: [PHP-DB] need help spotting this php parse error
> >Date: Thu, 23 Jan 2003 12:09:15 -0800
> >
> >The if statement does not have a closing brace.
> >
> > > -Original Message-
> > > From: David Rice [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, January 23, 2003 11:53 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP-DB] need help spotting this php parse error
> > >
> > >
> > > When i run this script it tells me that I have a parse error on
> > > line 34? I
> > > really can't see it anyhelp (please!) would be much appreciated
> > > Cheers, Dave
> > >
> > >  > >
> > >   session_start();
> > >
> > >   if(!$HTTP_COOKIE_VARS["username"]) {
> > >
> > >   /* The Cookie is not set, so load the page as if it
> > > is the first time
> > >   */
> > >
> > >   include("library/include/header.php");
> > >   include("library/include/database.php");
> > >
> > >   /* Include a header file and a database
> > > connections/functions file
> > >   */
> > >
> > >   ?>
> > >
> > >   
> > >   
> > >
> > >> >
> > >   $query = "SELECT * FROM Staff WHERE
> > > ResterauntId = 1";
> > >   $result = mysql_query($query) or die(
> > > mysql_error () );
> > >
> > >   While( $row = 
> mysql_fetch_array($result) ) {
> > >
> > >   ?>
> > >> > ?>"> > > $row["2"]; ?>
> > >> >   }
> > >   ?>
> > >   
> > >   
> > >
> > > _
> > > Stay in touch with MSN Messenger http://messenger.msn.co.uk
> > >
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> 
> _
> 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
> 

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




RE: [PHP-DB] need help spotting this php parse error

2003-01-23 Thread David Rice



It Does have a closing Brace, just check my second email it contains the 
FULL code.. i missed the last few lines copying it the first time somehow.


From: "Andreas Sheriff" <[EMAIL PROTECTED]>
To: "David Rice" <[EMAIL PROTECTED]>
Subject: RE: [PHP-DB] need help spotting this php parse error
Date: Thu, 23 Jan 2003 12:09:15 -0800

The if statement does not have a closing brace.

> -Original Message-
> From: David Rice [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 23, 2003 11:53 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] need help spotting this php parse error
>
>
> When i run this script it tells me that I have a parse error on
> line 34? I
> really can't see it anyhelp (please!) would be much appreciated
> Cheers, Dave
>
> 
> 	session_start();
>
> 	if(!$HTTP_COOKIE_VARS["username"]) {
>
> 		/* The Cookie is not set, so load the page as if it
> is the first time
> 		*/
>
> 		include("library/include/header.php");
> 		include("library/include/database.php");
>
> 		/* Include a header file and a database
> connections/functions file
> 		*/
>
> 		?>
>
> 		
>			
>
>			
>			$query = "SELECT * FROM Staff WHERE
> ResterauntId = 1";
>			$result = mysql_query($query) or die(
> mysql_error () );
>
>			While( $row = mysql_fetch_array($result) ) {
>
>?>
>   			 ?>"> $row["2"]; ?>
>   			   		}
>   		?>
> 		
> 		
>
> _
> Stay in touch with MSN Messenger http://messenger.msn.co.uk
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


_
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: [PHP-DB] need help spotting this php parse error

2003-01-23 Thread heilo
You forgot to close the { of the first if-statement.




   

   
  ">
  




David Rice <[EMAIL PROTECTED]> [EMAIL PROTECTED] 20:53 Uhr:

> When i run this script it tells me that I have a parse error on line 34? I
> really can't see it anyhelp (please!) would be much appreciated Cheers, Dave
> 
>  
> session_start();
> 
> if(!$HTTP_COOKIE_VARS["username"]) {
> 
> /* The Cookie is not set, so load the page as if it is the first time
> */
> 
> include("library/include/header.php");
> include("library/include/database.php");
> 
> /* Include a header file and a database connections/functions file
> */
> 
> ?>
> 
> 
> 
> 
>  
> $query = "SELECT * FROM Staff WHERE ResterauntId = 1";
> $result = mysql_query($query) or die( mysql_error () );
> 
> While( $row = mysql_fetch_array($result) ) {
> 
> ?>
> "> $row["2"]; ?>
>  }
> ?>
> 
> 
> 
> _
> Stay in touch with MSN Messenger 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 spotting this php parse error

2003-01-23 Thread Addison Ellis
you might try pulling the semi colon out before while. i put it in 
red. i think,that's probably it. addison


When i run this script it tells me that I have a parse error on line 
34? I really can't see it anyhelp (please!) would be much 
appreciated Cheers, Dave



	session_start();

	if(!$HTTP_COOKIE_VARS["username"]) {

		/* The Cookie is not set, so load the page as if it 
is the first time
		*/

		include("library/include/header.php");
		include("library/include/database.php");

		/* Include a header file and a database 
connections/functions file
		*/

		?>

		
 			

 			

 			$query = "SELECT * FROM Staff WHERE ResterauntId = 1";
 			$result = mysql_query($query) or die( mysql_error () );

 			While( $row = mysql_fetch_array($result) ) {

 ?>
			">
			
		}
		?>
  		
		

_
Stay in touch with MSN Messenger http://messenger.msn.co.uk


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

--
Addison Ellis
small independent publishing co.
114 B 29th Avenue North
Nashville, TN 37203
(615) 321-1791
[EMAIL PROTECTED]
[EMAIL PROTECTED]
subsidiaries of small independent publishing co.
[EMAIL PROTECTED]
[EMAIL PROTECTED]


RE: [PHP-DB] need help spotting this php parse error

2003-01-23 Thread Hutchins, Richard
Tell us specifically what the parse error is reporting to you and
specifically what line is line 34.

> -Original Message-
> From: David Rice [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 23, 2003 2:53 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] need help spotting this php parse error
> 
> 
> When i run this script it tells me that I have a parse error 
> on line 34? I 
> really can't see it anyhelp (please!) would be much 
> appreciated Cheers, Dave
> 
>  
>   session_start();
> 
>   if(!$HTTP_COOKIE_VARS["username"]) {
> 
>   /* The Cookie is not set, so load the page as 
> if it is the first time
>   */
> 
>   include("library/include/header.php");
>   include("library/include/database.php");
> 
>   /* Include a header file and a database 
> connections/functions file
>   */
> 
>   ?>
> 
>   
>   
> 
>
>   $query = "SELECT * FROM Staff WHERE 
> ResterauntId = 1";
>   $result = mysql_query($query) or die( 
> mysql_error () );
> 
>   While( $row = mysql_fetch_array($result) ) {
> 
>   ?>
>   "> $row["2"]; ?>
>  }
>   ?>
>   
>   
> 
> _
> Stay in touch with MSN Messenger http://messenger.msn.co.uk
> 
> 
> -- 
> 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

2002-11-16 Thread Peter Beckman
A few suggestions.

$show["Time"] doesn't exist; replace the 5 lines after your "while" with
this:

   $sms_time=$show["sms_time"];
   $smsc=$show["smsc"];
   $org_sms=$show["org_sms"];
   $dest_sms=$show["dest_sms"];
   $msg_content=$show["msg_content"];


Also, so save you some formatting headaches, change your $s_sms to this:

$s_sms="SELECT from_unixtime(unix_timestamp(sms_time)) as 
sms_time,smsc,org_sms,dest_sms,msg_content FROM dlr WHERE smsc=('Receive SMS')";

This will format your sms_time from the DB as year-month-day hour:minute:second

select from_unixtime(unix_timestamp(now()));
+--+
| from_unixtime(unix_timestamp(now())) |
+--+
| 2002-11-17 00:11:57  |
+--+

Peter

On Sun, 17 Nov 2002, Afif wrote:

> Dear All,
> I  would  like  to  represent  data  from  table dlr, but I could have
> nothing with this script
>
> $s_sms="SELECT sms_time,smsc,org_sms,dest_sms,msg_content FROM dlr WHERE 
>smsc=('Receive SMS')";
> $result = mysql_query($s_sms);
> if (!$result) error_message(sql_error());
>
> //Header of Table
>
>  echo "";
>  echo "Hasil";
>  echo "";
>  echo "";
>  echo "";
>  echo "Time";
>  echo "Action";
>  echo "From";
>  echo "Destination";
>  echo "Message";
>  echo "";
>
> //detail of row
>
>while ($show = mysql_fetch_array($result)) {
>   $sms_time=$show["Time"];
>   $smsc=$show["Action"];
>   $org_sms=$show["From"];
>   $dest_sms=$show["Destination"];
>   $msg_content=$show["Message"];
>
>   Make Best Result of timestamp;
>   $sms_time = substr($show["Time"],0,4).'-'.
>   substr($show["Time"],4,2).'-'.
>   substr($show["Time"],6,2).'-'.
>   substr($show["Time"],8,2).':'.
>   substr($show["Time"],10,2).':'.
>   substr($show["Time"],12,2);
>
>   echo "";
>   echo "$sms_time ";
>   echo "$smsc ";
>   echo "$org_sms ";
>   echo "$dest_sms ";
>   echo "$msg_content ";
>   echo "";
>}
> echo "";
> echo "";
> echo "";
>
> DO I miss some thing with above script ??
> pls help me
> Highly appreciate for yr help
>
> --
> Warm regards,
> Afif
> mailto:[EMAIL PROTECTED]
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




RE: [PHP-DB] need help with SHOW COLUMNS

2002-11-05 Thread Josh Johnson
I think you may want to loop over $row=mysql_fetch_array($result), each
row should have the name of the field, and some additional info about it
(I just ran a SHOW COLUMNS query on my log tables in my last post, that
should give you an idea of what the output is), try executing the query
in the mysql client, the top row of the output will be the names of the
fields of the array

So try:
while($row = mysql_fetch_array ($result)){
   var_dump($row);
}

to see what the db is returning, and access it accordingly.

-- Josh


-Original Message-
From: David Rice [mailto:haloplayer@;hotmail.com] 
Sent: Tuesday, November 05, 2002 10:12 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] need help with SHOW COLUMNS


I am tryin to create a DBMS,

the part of my code that is currently causing a problem is

mysql_select_db("filterseveuk") or die(mysql_error());
   $query = "SHOW COLUMNS FROM " .$table. "";

   $result =  mysql_query ( $query ) or die( mysql_error () );

   $numrows = mysql_num_rows ($result);

   $row = mysql_fetch_array ($result);

   for($x=0; $x <= $numrows; $x++){

echo $row[$x] ;

   }
It produces the error

user_idint(11)PRIauto_increment

The output i want to obtain from this query is that php prints out a
list of 
the field names.
I don't know why this is not working
How do i get it to only display the column names!?

_
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


-- 
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 "SHOW Colums"

2002-10-31 Thread rolf vreijdenberger

$table="user";
> > $query =  " SHOW COLUMNS FROM $user ";
> >
> > $result = mysql_query ( $query ) or die( mysql_error () );
> >
> > while ( $row = mysql_fetch_array ($result) ){
> >
> > $x = 0 ;// i don't know what you're trying to do here, but it's wrong!!
It keeps resetting$x to zero and does nothing with the update
> >
> > echo $row[$x] ;
> >
> > $x++ ;//
> > }



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




Re: [PHP-DB] need help with "SHOW Colums"

2002-10-31 Thread 1LT John W. Holmes
So show us the code that you tried with. This code doesn't do us any good
because it's not causing the error.

---John Holmes...

- Original Message -
From: "David Rice" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 31, 2002 11:31 AM
Subject: [PHP-DB] need help with "SHOW Colums"


>
>
>
>
>
>
>
>
> mysql_select_db("filterseveuk");
>
> $query = ( " SHOW COLUMNS FROM user ");
>
> $result = mysql_query ( $query ) or die( mysql_error () );
>
> while ( $row = mysql_fetch_array ($result) ){
>
> $x = 0 ;
>
> echo $row[$x] ;
>
> $x++ ;
> }
>
>
> I would like to replace the table name "user" with a variable $table, that
> wil automatically take the value of the selected table. I have tried many
> times but cannot get the correct sql syntax, it keeps saying
> "you have an error in your sql syntax near 'user' line 1" when i try it
with
> $table.
> any ideas??
>
> thank's,
> dave rice ([EMAIL PROTECTED])
>
> _
> Choose an Internet access plan right for you -- try MSN!
> http://resourcecenter.msn.com/access/plans/default.asp
>
>
> --
> 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

2002-10-08 Thread 1LT John W. Holmes

Remove all of the @ for one, so you can see if there are any errors. You're
using $rs as two different variables, also. Check mysql_error() after your
query to see if an error is returned.

---John Holmes...

- Original Message -
From: "Frederick Belfon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 08, 2002 12:19 PM
Subject: [PHP-DB] need help


I have Mysql set up on the same machine as the apache server. There is a
database name inventory_db with a table product_info which have the two row
id and name. I know there are three records in the table. However when ever
I place this script below into a webpage I get just a blank page.  What can
I do to correct it. Thank you




");

}

?>


/*" The gospel is meant to comfort the afflicted and afflict the
comfortable."
Garrison Keillor*/


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




Re: [PHP-DB] Need help with time calculation for a tracking system - it DOES involve DB work :)

2002-10-05 Thread Jason Wong

On Saturday 05 October 2002 03:45, Aaron Wolski wrote:

> Anyway.. everything as far as entering the time values, etc is working
> correctly except the calculation is NOT working as it should!!!

> $timeValue = date("g:i:s", $timeDifference);

> When I echo everything out to the browser this is what I get:
>
> The timeIn value is: 1033760057
> The timeOut value is: 1033760098
> The converted timeIn value is 3:34:17
> The converted timeOut value is 3:34:58
> The time difference between timeIn and timeOut is: 7:00:41
>
> You see.. the 7 is there... which represents 7 hours and 41 seconds that
> have elapsed. the 41 seconds is right.. but not the 7 hours!!!

date() returns the LOCAL time/date given a GMT/UTC timestamp. The timezone 
where your server is located is probably 7 hours ahead of GMT/UTC.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
If at first you don't succeed, you're doing about average.
-- Leonard Levinson
*/


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




Re: [PHP-DB] Need help urgent!!

2002-09-26 Thread Dan Brunner

Check your register_globals value in your PHP.INI!!

Dan


On Thursday, September 26, 2002, at 11:48  AM, [EMAIL PROTECTED] wrote:

> I'm using PHP4.2.2 Win with MySQL 3.2.52 Win and PHP doesn't pass vars 
> from
> 1 php to the other how i fix it?
>
> Thanks
>
>
>
> -- 
> 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 urgent!!

2002-09-26 Thread Pierre-Alain Joye

On Thu, 26 Sep 2002 19:48:31 +0300
"Thomas \"omega\" Henning" <[EMAIL PROTECTED]> wrote:

> I'm using PHP4.2.2 Win with MySQL 3.2.52 Win and PHP doesn't pass vars from
> 1 php to the other how i fix it?

Read the documentation, register_globals is SET to off by default.
http://www.php.net/manual/en/language.variables.external.php

pa

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




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

2002-09-26 Thread Hutchins, Richard

What's you register_globals set to?

> -Original Message-
> From: Thomas "omega" Henning [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 26, 2002 12:49 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Need help urgent!!
> 
> 
> I'm using PHP4.2.2 Win with MySQL 3.2.52 Win and PHP doesn't 
> pass vars from
> 1 php to the other how i fix it?
> 
> Thanks
> 
> 
> 
> -- 
> 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 urgent!!

2002-09-26 Thread Ryan Jameson (USA)

Do you mean passing vars between forms, between functions, or between includes?

<>< Ryan

-Original Message-
From: Thomas "omega" Henning [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 10:49 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Need help urgent!!


I'm using PHP4.2.2 Win with MySQL 3.2.52 Win and PHP doesn't pass vars from
1 php to the other how i fix it?

Thanks



-- 
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 getting record number off insert

2002-09-11 Thread Miles Thompson

Check the DataFlex docs and see if it has a function that returns this 
information, or if the ODBC driver has such a function.

Record numbers are dangerously useless in most database operations - they 
get re-used and changed when records are deleted or repair/compress 
functions are executed. I hope you aren't planning to use this as foreign 
key, i.e. for referencing information in this table from another table.

Miles Thompson

At 08:29 AM 9/11/2002 -0400, Anthony wrote:
>I'm doing an insert and need to get the record number that is generated 
>when the record in created.  I'm accessing the database through ODBC. It's 
>a DataFlex database and the driver i'm using is by Connex.  I know that 
>you can somehow insert a SQL statment inside an other statement.  I was 
>thinking if I could quesry the record inside the insert, then I could get 
>the record number.  I'm not sure how to do this though.  I was also 
>thinking that I might be able to get some info from the resourse 
>identifier that is returned to PHP, but I don't know how to read it from 
>an insert, odbc_result doesn't work.  Anyone have any clue how I can do 
>this?  I'm kinda new to this, so please help me out.
>
>I'm running IIS/Win2k, PHP 4.2.1 using ODBC through Connex DataFlex driver 
>8.7.
>
>Thanks in advance for your help.
>
>- Anthony
>
>
>--
>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 on improving performance on this querry

2002-05-07 Thread andy

thank you! I did not know this command.

Its 0.16s instead of 1.6!

Andy


<[EMAIL PROTECTED]> schrieb im Newsbeitrag
043c01c1f5f2$47f5b3e0$[EMAIL PROTECTED]">news:043c01c1f5f2$47f5b3e0$[EMAIL PROTECTED]...
> SELECT DISTINCT L.*
> from data.languages L, data2.user U
> WHERE L.id IN (U.language_1, U.language_2, U.language_3)
> order by name;
>
> I believe the IN clause is a shade faster than multiple ORs, but
> I'm not 100% sure.
>
> 'Luck
>
> -Szii
>
> - Original Message -
> From: "andy" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, May 07, 2002 9:38 AM
> Subject: [PHP-DB] need help on improving performance on this querry
>
>
> > Hi there,
> >
> > I do have a user table with 3 languages. I know that I should have put
them
> > into a seperate table. I still could, but would take lots of recoding. I
> > discovered, that as soon as I leave out the OR statements the querry
takes
> > under 0.2 s. With the two OR it takes on a 1 records about 1.4 s.
> >
> > Is there a way to increase the performance with a different querry? I
did
> > already index the fields, but does not look much better though.
> >
> > SELECT DISTINCT L.*
> > from data.languages L, data2.user U
> > where
> >   L.id = U.language_1
> >   or L.id = U.language_2
> >   or L.id = U.language_3
> > order by name
> >
> > Thanx for any help,
> >
> > Andy
> >
> >
> >
> > --
> > 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 on improving performance on this querry

2002-05-07 Thread szii

SELECT DISTINCT L.*
from data.languages L, data2.user U
WHERE L.id IN (U.language_1, U.language_2, U.language_3)
order by name;

I believe the IN clause is a shade faster than multiple ORs, but 
I'm not 100% sure.

'Luck

-Szii 

- Original Message - 
From: "andy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 07, 2002 9:38 AM
Subject: [PHP-DB] need help on improving performance on this querry


> Hi there,
> 
> I do have a user table with 3 languages. I know that I should have put them
> into a seperate table. I still could, but would take lots of recoding. I
> discovered, that as soon as I leave out the OR statements the querry takes
> under 0.2 s. With the two OR it takes on a 1 records about 1.4 s.
> 
> Is there a way to increase the performance with a different querry? I did
> already index the fields, but does not look much better though.
> 
> SELECT DISTINCT L.*
> from data.languages L, data2.user U
> where
>   L.id = U.language_1
>   or L.id = U.language_2
>   or L.id = U.language_3
> order by name
> 
> Thanx for any help,
> 
> Andy
> 
> 
> 
> -- 
> 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 returning new id's

2002-03-19 Thread Gurhan Ozen

Hi,

Did you copy and paste your code?IF yes, I have noticed a problem on the
code you posted.. Y
The line:

$run_query  = ($maxid,$db_connect);

will fail as you didn't put the function name in. Rewrite it as:
$run_query  = mysql_query($maxid,$db_connect);

Gurhan


-Original Message-
From: Jason McCormack [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 1:31 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Need Help with returning new id's


Hello All,

I am trying to return the largest id for a table and then print the value to
a page. My query works fine in MySQL, the problem is getting the value to
show in a web page with php. This is what I am trying to process.

TABLEID | VALUE
1   | Test
2   | Test 2
3   | Test 3

In the sample table above I am trying to pull back a value of 3 and print to
a web page via php.

$maxid = "select max(tableid) from table as largestid";
// db_connect is my database connection. I know this works because I have
other pages that return
// results based on my queries without any problems
$run_query  = ($maxid,$db_connect);

This is were I get a bit lost. I have tried using all sorts of various mysql
functions without success

$row = mysql_fetch_row($run_query);
$mymaxidvalue = $row[0];
echo $mymaxidvalue;

As I stated above I have tried many different ways to get the desired
results but have been unsuccessful. Any help would be greatly appreciated.

Thanks,
Jason



--
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 returning new id's

2002-03-19 Thread Rick Emery

first, it helps if you show us your REAL code.  The query statement you
showed below would obviously not work (it's missing the "mysql_query" part.
Second, when executing mysql_query() ALWAYS include the "or
die(mysql_error())" part to aid diagnostics.
Third, your query could not possibly work at the mysql command line; you've
misplaced the "AS" construct at the end of the query.

$maxid = "select max(tableid) as largestid from table";
$result = mysql_query($maxid) or die("Error: ".mysql_error());
list($mymaxidvalue) = mysql_fetch_array($result);
echo $mymaxidvalue;


-Original Message-
From: Jason McCormack [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 12:31 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Need Help with returning new id's


Hello All,

I am trying to return the largest id for a table and then print the value to
a page. My query works fine in MySQL, the problem is getting the value to
show in a web page with php. This is what I am trying to process.

TABLEID | VALUE
1   | Test
2   | Test 2
3   | Test 3

In the sample table above I am trying to pull back a value of 3 and print to
a web page via php.

$maxid = "select max(tableid) from table as largestid";
// db_connect is my database connection. I know this works because I have
other pages that return
// results based on my queries without any problems
$run_query  = ($maxid,$db_connect);

This is were I get a bit lost. I have tried using all sorts of various mysql
functions without success

$row = mysql_fetch_row($run_query);
$mymaxidvalue = $row[0];
echo $mymaxidvalue;

As I stated above I have tried many different ways to get the desired
results but have been unsuccessful. Any help would be greatly appreciated.

Thanks,
Jason



-- 
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 guys

2002-03-14 Thread Tony James

hi Rehab

Because your submitted text on the url contains an '&' anthing after this
character will be parsed as a new variable.
Instead of
location.href="additems.php?category="+c
try
location.href="additems.php?category="+escape(c)

this will encode the '&' aswell as spaces to preserve the entire string

Hope this helps
TJ

-Original Message-
From: its me [mailto:[EMAIL PROTECTED]]
Sent: 14 March 2002 11:21
To: [EMAIL PROTECTED]
Subject: [PHP-DB] need help guys


i have this

Antiques & Arts

then i pass this to next page:

RE: [PHP-DB] need help guys

2002-03-14 Thread Richard Black

Can you send us the full script?? Why can't you just do a submit???

The problem is the ampersand (&) in the middle. This is a place marker which
marks the start of the next variable in the query string.

If you absolutely *HAVE* to submit the data this way, you'll need to convert
it to the escape %26

So that it passes the correct value:

http://localhost/auction/seller/additems.php?category=Antiques%20%26%20Arts

HTH,

Richy

==
Richard Black
Systems Programmer, DataVisibility Ltd - http://www.datavisibility.com
Tel: 0141 435 3504
Email: [EMAIL PROTECTED]

-Original Message-
From: its me [mailto:[EMAIL PROTECTED]]
Sent: 14 March 2002 11:21
To: [EMAIL PROTECTED]
Subject: [PHP-DB] need help guys


i have this

Antiques & Arts

then i pass this to next page:

RE: [PHP-DB] need help guys

2002-03-14 Thread matt stewart

you can't pass a literal "&" in a url - it makes it think that it's the next
variable.

-Original Message-
From: its me [mailto:[EMAIL PROTECTED]]
Sent: 14 March 2002 11:21
To: [EMAIL PROTECTED]
Subject: [PHP-DB] need help guys


i have this

Antiques & Arts

then i pass this to next page:

RE: [PHP-DB] Need help (displaying select data from an array)

2002-02-13 Thread Rick Emery

session_start() does not take a parameter.  Use:

session_start();
session_register($clothes);


-Original Message-
From: Renaldo De Silva [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 8:16 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Need help (displaying select data from an array)


First up soory for the long messge but I'm totally stuck, I've been stuck 
for the past 3 days. I'm trying to display the results of a search, The 
code I've written so far displays the first five results and the links to 
pages for the rest, how do I display only the rows that I want.

The code I've written so far

--->






 Search results...

";

$searchwords = split(" ", $search);

/*
foreach($searchwords as $line)
{
$sql_1.= "description like '%$line%' or ";
$sql_2.= " name like '%$line%' or";
$sql_3.= " type like '%$line%' or";
}
$rest = substr($sql_3, 0, strlen($sql_3)-3);

$partsql.= $sql_1 . $sql_2 . $sql_3 ;

$command = substr($partsql, 0, strlen($partsql)-3);
$search = $command;
*/

if (empty($search))
{
echo "You did not enter a search string, please go back and try again";
quit;
}
echo "";

mysql_select_db("clothes");

$list = "select * from products WHERE MATCH ( type,name,description ) 
AGAINST ('$search')";

$results = mysql_query($list);

$num_results = mysql_num_rows($results);

$num_temp = ceil($num_results / 5) ;
echo "";
$num_pages = $num_temp + 1;
echo "$num_pages pages";
echo "";

$row = mysql_fetch_array($results);

$i= 0;
$m= 5;

if ($p != 0 )
{
$i = 5 * $p;
$m = ($m * $p) + 5;
}
if ($num_results)
{
for ( $i=$i;  $i<$m; $i++)
{
$row = mysql_fetch_array($results);

   echo "Type:";
   echo  $row["type"];
   echo " Name:";
   echo  $row["name"];
   echo " Price:";
   echo  $row["price"];
   echo "";
   echo " Description:";
   echo  $row["description"];
 if ($row["image1"])
{
echo "";
echo " Image 1: ";
?>
http://cirkit.com/images/ ">
";
echo " Image 2: ";
?>
http://cirkit.com/images/ ">
";
echo " Image 3: ";
?>
http://cirkit.com/images/ ">
";
}
}
 //diplay no result found if search unsucessful
 else
 {
 echo "No results found. Please try another search phrase.";
 }
   // dislpays the links @ the bottom of 
the page
   echo "";
   echo "";
   for ($p=0; $p<$num_pages; $p++)
   {
   $id = "p=$p&search=$search";
   ?>
   
   
   
   

HOME






<<<--->>

Can anyone help me please, I'm new at this only been programming for 3 
weeks.

-- 
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 Please

2002-01-03 Thread Rick Emery

Kelvin,

As I asked before: WHAT DATABASE ENGINE ARE YOU USING?

-Original Message-
From: Kelvn Yip [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 03, 2002 11:39 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Need Help Please


I have deleted all the info. from the Table by mistaken.
Now, I need to rollback all the info. otherwise, none of the user can login
to a page.

Please..Help I don't know how to rollback.
Can someone provide me a complete code , So, I can put up the DB online
asap.

Thanks.
Kelvin.



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

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




  1   2   >