[PHP] Re: mysql connection question

2004-07-16 Thread Torsten Roehr
"John Meyer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
> For a long time, on all of my mysql pages, I've done something like this
>
> $conn = mysql_connect($server,$username,$password) or die("Could not
> connect")
> mysql_select_db($db);
>
>
> I've finally put that into its own script file, moved it to my include
> files, and simply included it whereever I needed a connection.  My
question
> is, could this get me into trouble if multiple people access the database
at
> the same time?

Including it is no different to placing it directly into your code. So there
will be no difference.

Regards, Torsten Roehr

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



[PHP] Re: [mysql]Problem with PHP5

2004-07-15 Thread Ciprian Constantinescu
I have included the extension. Now I get "Unable to load dynamic library
'C:\php\ext\php_mysql.dll' - The specified procedure could not be found"

I have in Windows\System32 the file libmysql.dll. I have also put it in the
php\ext directory without any result.

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



[PHP] Re: [mysql]Problem with PHP5

2004-07-14 Thread Ben Ramsey
Ciprian Constantinescu wrote:
I have installed PHP5 and i get the following error from a script that was
working on PHP4
 "Fatal error: Call to undefined function mysql_pconnect() in
D:\htdocs\cdalex\Connections\listacon.php on line 9 "
MySQL is no longer embedded in PHP, as of PHP 5.  Depending on your 
platform, you will either need to build PHP 5 with support for MySQL, or 
you will need to modify php.ini to load in the MySQL extension.

--
Regards,
 Ben Ramsey
 http://benramsey.com
---
http://www.phpcommunity.org/
Open Source, Open Community
Visit for more information or to join the movement.
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: MySQL Database Connection Question

2004-07-08 Thread Afan Pasalic
Oh!
:-)
Thanks...

John Nichel wrote:
Afan Pasalic wrote:
Daniel Kullik wrote:
Note: You should checkout the thread 'Form Submission' started on 
July 6th since this is appearently not the best way to check if the 
user hit the submit-button.

Daniel

July 6th? What are you talking about? Can you please give me more 
info about that?

afan
He's saying RTFA.
http://marc.theaimsgroup.com/?l=php-general&m=108910994407822&w=2
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: MySQL Database Connection Question

2004-07-08 Thread Daniel Kullik
John Nichel wrote:
Afan Pasalic wrote:
Daniel Kullik wrote:
Note: You should checkout the thread 'Form Submission' started on 
July 6th since this is appearently not the best way to check if the 
user hit the submit-button.

Daniel

July 6th? What are you talking about? Can you please give me more info 
about that?

afan
He's saying RTFA.
http://marc.theaimsgroup.com/?l=php-general&m=108910994407822&w=2
Thanks for that URL, John.
Eventually CVS come to Afan's mind when he read "checkout" and "thread". 
Sorry for the confusion.

Daniel
--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: MySQL Database Connection Question

2004-07-08 Thread Daniel Kullik
Afan Pasalic wrote:
July 6th? What are you talking about? Can you please give me more info 
about that?

afan

Daniel Kullik wrote:
Note: You should checkout the thread 'Form Submission' started on July 
6th since this is appearently not the best way to check if the user 
hit the submit-button.

Daniel
Hello Afan.
On July 6th 2004 (or 2004-06-07 if you prefer ISO-dates) 
[EMAIL PROTECTED] started a thread named 'Form Submission'.
That's all.

Daniel
--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: MySQL Database Connection Question

2004-07-08 Thread John Nichel
Afan Pasalic wrote:
Daniel Kullik wrote:
Note: You should checkout the thread 'Form Submission' started on July 
6th since this is appearently not the best way to check if the user 
hit the submit-button.

Daniel
July 6th? What are you talking about? Can you please give me more info 
about that?

afan
He's saying RTFA.
http://marc.theaimsgroup.com/?l=php-general&m=108910994407822&w=2
--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: MySQL Database Connection Question

2004-07-08 Thread Afan Pasalic
July 6th? What are you talking about? Can you please give me more info 
about that?

afan

Daniel Kullik wrote:
Note: You should checkout the thread 'Form Submission' started on July 
6th since this is appearently not the best way to check if the user 
hit the submit-button.

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


[PHP] Re: MySQL Database Connection Question

2004-07-08 Thread Daniel Kullik
Harlequin wrote:
I have a user registration form that asks new users to register. However, Do
I post the MySQLconnection string in the page they are completing or in the
later page that the data is posted to, or both...?
You ought to tell your registration-page to redirect to itself right 
after the visitor hit the submit-button of your form.

This should to the trick:
[code]

[/code]

Therefore your script will have to check if something has been posted.
[code]
if (!empty($_POST) && isset($_POST['button_name'])) {
// perform validation, insert record into database, etc
}
[/code]
.. might do, while 'button_name' is the name of your form's submit-button.
Note: You should checkout the thread 'Form Submission' started on July 
6th since this is appearently not the best way to check if the user hit 
the submit-button.

Daniel
--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: MySQL Results Not Being Commited To Database

2004-07-03 Thread Harlequin
Sorry about the "Reply To Sender" I was kind of busy and made that mistake.

I guessed from past experience of developing MS Access databases that I'd
assigned the primary key to the UserID which is fine but the duplicate
entries were a mystery.

Thanks for your help Torsten, John. I've cracked it now. The entire page is
attached, I'm a very happy man and can go eat. My next problem will be
retrieving the values for editing based upon the UserID and Password
combination...!

Once again - thanks very much for your help and I hope to return the favour
if ever you need any systems advice.

-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-
"Harlequin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I've managed with a lot of help to get the PHP pages to echo the results
of
> what a user put into a "User Registration" page. However, I'm still having
> trouble getting the code right to actually commit the data on the
> "Registered" page that the "Register" page points to.
>
> Can anyone help...?
>
> Code attached...
>
> -- 
> -
>  Michael Mason
>  Arras People
>  www.arraspeople.co.uk
> -
>
>
>


begin 666 Commit.txt
M/#]P:' -"B\J($UY4U%,($-O;FYE8W1I;[EMAIL PROTECTED]:6%B;&5S("HO#0H))&AO
M7-Q;%]Q=65R>[EMAIL PROTECTED]http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] RE: MySQL Results Not Being Committed To Database

2004-07-03 Thread Torsten Roehr
"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >>  $query = mysql_query($sql);
> >> $mysql_result = mysql_query ($sql, $Connection) or die ("Invalid
> >>Query - " . mysql_error());
>
> You're running the query twice. Take out that first line.

Michael, that's where your duplicate key error comes from. Forget about the
table structure.

Thanks, John.

>
> And I second the recommendation to please reply to the list and not
> individuals unless they request it.
>
> --
> ---John Holmes...

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



Re: [PHP] RE: MySQL Results Not Being Committed To Database

2004-07-03 Thread John W. Holmes
 $query = mysql_query($sql);
$mysql_result = mysql_query ($sql, $Connection) or die ("Invalid
Query - " . mysql_error());
You're running the query twice. Take out that first line.
And I second the recommendation to please reply to the list and not 
individuals unless they request it.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] RE: MySQL Results Not Being Committed To Database

2004-07-03 Thread Torsten Roehr
> Torsten
>
> I managed to work through it and this is the code:
>
>   $NewUserID=$_POST['TXT_UserID'];
>   $NewUserPassword=$_POST['TXT_UserPassword'];
>   $NewUserComments=$_POST['TXT_Comments'];
>   $NewUserFurtherComments=$_POST['TXT_FurtherComments'];
>   $sql = "INSERT INTO RegisteredMembers
> (UserID,UserPassword,Comments,FurtherComments)
>
> VALUES('".$NewUserID."','".$NewUserPassword."','".$NewUserComments
> ."','".$Ne
> wUserFurtherComments."')";
>   $query = mysql_query($sql);
>   $mysql_result = mysql_query ($sql, $Connection) or die ("Invalid
> Query - " . mysql_error());
>
>   echo "Username:\t\t$NewUserID";
>   echo "Password:\t\t$NewUserPassword";
>   echo "Comments:\t\t$NewUserComments";
>   echo "Further Comments:\t$NewUserFurtherComments";
>
>   mysql_close ($Connection);
>
> However. I still get an error although the input is actually
> commited to the
> database:
>
> Invalid Query - Duplicate entry 'SherylJo' for key 1
>
> I don't follow this because although I have set that particular
> field up as
> a primary key this value is not duplicated... Strange.

Hi Michael,

please always anser to the list (Answer All). Could you post your table
structure?

Regards, Torsten

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



[PHP] Re: MySQL Results Not Being Commited To Database

2004-07-03 Thread Torsten Roehr
"Harlequin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I've managed with a lot of help to get the PHP pages to echo the results
of
> what a user put into a "User Registration" page. However, I'm still having
> trouble getting the code right to actually commit the data on the
> "Registered" page that the "Register" page points to.
>
> Can anyone help...?
>
> Code attached...

You don't call mysql_query() anywhere in your code! Add this line below the
line where you set $sql:
mysql_query($sql);

And you don't need quotes here:
mysql_select_db ("$dbase"); => mysql_select_db($dbase);

Regards,
Torsten Roehr

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



RE: [PHP] Re: MySQL QUERY Results Not Appearing[Scanned]

2004-07-02 Thread Michael Egan
Don't know that this will work but it might help isolate the problem:

/* MySQL Connection Variables */
 $host="localhost";
 $user="arras_WebMaster";
 $password="qwerty";
 $dbase="arras_Members";
  
/* MySQL Connection String */
 if(!$dbConnect = @mysql_connect ("$host", "$user", "$password"))
 {
echo "Couldn't connect to the database server: ".mysql_error()."";
 }

 if(!$dbSelect = @mysql_select_db ("$dbase"))
 {
echo "Couldn't select the database: ".mysql_error()."";
 }

 if(!$query = @mysql_query("SELECT * FROM RegisteredMembers"))
 {
echo "Couldn't execute query: ".mysql_error()."";
 }
 else
 {
   while($result = mysql_fetch_array($query))
   {
echo $result['UserID'];
   }
 }


HTH,

Michael Egan



-Original Message-
From: Harlequin [mailto:[EMAIL PROTECTED]
Sent: 02 July 2004 09:34
To: [EMAIL PROTECTED]
Subject: [PHP] Re: MySQL QUERY Results Not Appearing[Scanned]


Craig. Thanks for the response and sorry I've been delayed in getting back
to you.

I put a new page together and dropped all the peripheral code and this is
what I ended up with:

active members should appear here";

$query = mysql_query("SELECT * FROM RegisteredMembers") or die("could not
execute query");
while($result = mysql_fetch_array($query)){
echo $result['UserID'];
}


?>

Still no joy though. Any ideas...?

--
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
- 
The information contained in this email (and in any attachments sent with it) is 
confidential. It is intended for the addressee only. Access to this email by anyone 
else is unintended and unauthorized.  
If you are not the original addressee, 3tc asks you to please maintain 
confidentiality. If you have received this email in error please notify 3tc 
immediately by replying to it, then destroy any copies and delete it from your 
computer system. 
Any use, dissemination, forwarding, printing or copying of this email by anyone except 
the addressee in the normal course of his/her business, is strictly prohibited. 3tc 
owns the copyright in this email and any document created by us and assert the right 
to be identified as the author of it. Copyright has not been transferred to the 
addressee. 
We protect our systems with Sophos Anti-virus -  
www.sophos.com 
 

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



[PHP] Re: MySQL QUERY Results Not Appearing

2004-07-02 Thread Harlequin
Craig. Thanks for the response and sorry I've been delayed in getting back
to you.

I put a new page together and dropped all the peripheral code and this is
what I ended up with:

active members should appear here";

$query = mysql_query("SELECT * FROM RegisteredMembers") or die("could not
execute query");
while($result = mysql_fetch_array($query)){
echo $result['UserID'];
}


?>

Still no joy though. Any ideas...?

--
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-
"Craig Donnelly" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> $result is an array that has to be fetched...try this
>
> echo "active members should appear here";
>
> $query = mysql_query("SELECT * FROM RegisteredMembers") or die("could not
> execute query");
> while($result = mysql_fetch_array($query)){
> echo $result['YOUR_DB_FIELDNAME'];
> }
>
> change YOUR_DB_FIELDNAME' to whatever the fields are you are querying.
> you could also:
>
> 
> 
> 
>
> HTH
>
> Craig
>
> "Harlequin" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi all...
> >
> > Despite being able to make a connection to the server and execute a
query
> I
> > am unable to do this through PHP using the following commands:
> >
> >  echo "active members should appear here";
> >  $query = "SELECT * FROM RegisteredMembers";
> >  $result = mysql_query($query) or die ("could not execute query");
> >  echo "$result";
> >
> > Any ideas...?
> >
> > --
> > -
> >  Michael Mason
> >  Arras People
> >  www.arraspeople.co.uk
> > -

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



[PHP] Re: MySQL QUERY Results Not Appearing

2004-06-30 Thread Craig Donnelly
$result is an array that has to be fetched...try this

echo "active members should appear here";

$query = mysql_query("SELECT * FROM RegisteredMembers") or die("could not
execute query");
while($result = mysql_fetch_array($query)){
echo $result['YOUR_DB_FIELDNAME'];
}

change YOUR_DB_FIELDNAME' to whatever the fields are you are querying.
you could also:





HTH

Craig

"Harlequin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all...
>
> Despite being able to make a connection to the server and execute a query
I
> am unable to do this through PHP using the following commands:
>
>  echo "active members should appear here";
>  $query = "SELECT * FROM RegisteredMembers";
>  $result = mysql_query($query) or die ("could not execute query");
>  echo "$result";
>
> Any ideas...?
>
> -- 
> -
>  Michael Mason
>  Arras People
>  www.arraspeople.co.uk
> -

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



[PHP] Re: MySQL question

2004-06-23 Thread David Robley
John Taylor-Johnston wrote:

> Sorry, MySQL question. Any takers? If I search for 'margaret atwood', I
> get results in no real structured heirachy. Any thoughts?
> 
>  atwood' IN BOOLEAN MODE);>Search  color="blue">ccl.ccl_main For: margaret
> atwood - 275 record(s) found
> 
> John

The results from IN BOOLEAN MODE are not sorted in order of relevance, from
what I can see in the docs. More info can be found at 

http://dev.mysql.com/doc/mysql/en/Fulltext_Boolean.html

Depending on what you are trying to achieve, BOOLAEN MODE may not be what
you want.

David

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



[PHP] Re: MySQL question

2004-06-22 Thread John Taylor-Johnston
I would have at least expected it give me 'margaret atwood' before it gives me 
'margaret' and then 'atwood'.


> Sorry, MySQL question. Any takers? If I search for 'margaret atwood', I get results 
> in no real structured heirachy. Any thoughts?
>
>  BOOLEAN MODE);>Search ccl.ccl_main For:  color="blue">margaret atwood - 275 record(s) found

John

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



[PHP] Re: MySql Close problem

2004-06-22 Thread Erik Gjertsen
I suppose it was mysql_close that was a problem but I am not secure. I am
new in this.
I have tryed to made registration page. I  wish to that you can use one nic
name ony one time.


I hav use the following code:


 You forgot to enter your name';
 } else {
 $name = escape_data($_POST['name']);

 if (empty($_POST['email'])) {
 $email = FALSE;
 $message = ' You forgot to enter your email';
 } else {
 $email = escape_data($_POST['email']);

 if (empty($_POST['username'])) {
 $username = FALSE;
 $message = ' You forgot to enter your username';
 } else {
 $username = escape_data($_POST['username']);

 if (empty($_POST['password1'])) {
 $password1 = FALSE;
 $message = ' You forgot to enter your password';
 } else {
  if ($_POST['password1'] == $_POST['password2']) {
  $password1 = escape_data($_POST['password1']);
  } else {
   $password = FALSE;
   $message = ' your password did not math';
  }
 }

 if ($name && $email && $username && $password) // If everything's ok.

 $query = "SELECT usrid FROM users WHERE username='$username'";
 $result = @mysql_query ($query); //Run the query
  if (mysql_num_rows($result) == 0) { // Make the query
  $query = "INSERT INTO users (username, name, email, password,
registration_date) VALUES
  ('$username', '$name', '$email', '$password', NOW() )";
  $result = @mysql_query ($query);
   if ($result) { // IF it ran OK

// Send an email, if desired
echo 'You have been registered!';
include("./footer.inc");
exit();
   } else { // If it did not ron OK.
$message = 'You cout not be registered due to a system error. We
apologize for any inconvenience';
   }
  } else {
  $message = 'That username is alredy taken.';
  }


 mysql_close();


 } else {
  $message = 'Please try again.';
 }
} // End of the main   submit conditional.

 // Print the error message if ther is one
 if (isset($message)) {
  echo '', $message, '';
 )

 ?>



Enter your information in the form below:

Name 

Email Adress 

User Name 

 Password 

 Confirm Password 

 



 





but it dont work. If I take away al after mysql close to form_action it com
the folloving error:Parse error: parse error on line 114 (it is on the end
of the script). But when I set it back aganst the error massages coms on the
line of mysql_close. Are ther someone that understand what I means??

Thanks for any proposal
Erik Gjertsen

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



[PHP] Re: MySql Close problem

2004-06-21 Thread Thomas Seifert
you should tell WHAT problem you have.
does it throw an error? 
doesn't it work as expected ... ? 

whats the matter?



thomas

On Sun, 20 Jun 2004 13:47:03 -0700 [EMAIL PROTECTED] (Erik Gjertsen) wrote:

> I have problem with mysql_close 
> I dont understand why.
> Are ther someone that have any proposal?
> 
> Thank for any help
> Erik Gjertsen
> 
> Here is the code
> 
> 
> $query = "SELECT usrid FROM users WHERE username";
>  $result = @mysql_query ($query); //Run the query
>   if (mysql_num_rows($result) == 0) { // Make the query
>   $query = "INSERT INTO users (username, name, email, password, registration_date) 
> VALUES
>   ('$username', '$name', '$email', '$password', NOW() )";
>   $result = @mysql_query ($query);
>if ($result) { // IF it ran OK
>  
> // Send an email, if desired
> echo 'You have been registered!';
> include("./footer.inc");
> exit();
>} else { // If it did not ron OK.
> $message = 'You cout not be registered due to a system error. We apologize 
> for any inconvenience';
>}
>   } else {
>   $message = 'That username is alredy taken.';
>   }
>  mysql_close();
>  
>  
>  } else {
>   $message = 'Please try again.';
>  }
> } // End of the main   submit conditional.
> 
>  // Print the error message if ther is one
>  if (isset($message)) {
>   echo '', $message, '';
>  )

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



[PHP] Re: MySql Close problem

2004-06-21 Thread franciccio
Have you tried to specify the the handler of the connection, when you first
made the connection yo had somethig like:
$handler=mysql_connect(...);
...
...
...
mysql_close($handler);


"Erik Gjertsen" <[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]
I have problem with mysql_close
I dont understand why.
Are ther someone that have any proposal?

Thank for any help
Erik Gjertsen

Here is the code


$query = "SELECT usrid FROM users WHERE username";
 $result = @mysql_query ($query); //Run the query
  if (mysql_num_rows($result) == 0) { // Make the query
  $query = "INSERT INTO users (username, name, email, password,
registration_date) VALUES
  ('$username', '$name', '$email', '$password', NOW() )";
  $result = @mysql_query ($query);
   if ($result) { // IF it ran OK

// Send an email, if desired
echo 'You have been registered!';
include("./footer.inc");
exit();
   } else { // If it did not ron OK.
$message = 'You cout not be registered due to a system error. We
apologize for any inconvenience';
   }
  } else {
  $message = 'That username is alredy taken.';
  }
 mysql_close();


 } else {
  $message = 'Please try again.';
 }
} // End of the main   submit conditional.

 // Print the error message if ther is one
 if (isset($message)) {
  echo '', $message, '';
 )

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



[PHP] Re: Mysql fetch_row()

2004-06-20 Thread Kim Steinhaug
Whatabout :

mysql_fetch_array()
or
mysql_fetch_object()

Both gives you both the results and the names of the coloumns.
Maby I didnt get the question right but since nobody else mentioned it, .)

--
--
Kim Steinhaug
--
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
--
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
--

"Gerben" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> when I call mysql_fetch_row() I get an array, but this Array doesn't have
> the fieldnames as array-keys.
> I've seen several codes from others where they use something like
>
> print $row['key'];
>
> This doesn't work on my server. Is this because my server-software is too
> old or am I using the wrong function?
> PHP Version 4.3.4
> mySQL version: 3.23.54

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



[PHP] Re: MySQL equivalent for odbc_result_all()???????

2004-06-09 Thread Red Wingate
Some old piece of source i found in my libs:
function sql_dump_result ( $result ) {
  $line = '';
  $head = '';
  while ( $temp = mysql_fetch_assoc( $result ) ){
if ( empty ( $head ) ) {
  $keys  = array_keys($temp);
  $head  = 
''.implode('',$keys).'';
}

$line .= ''.implode('',$temp).'';
  }
  return ''.$head.$line.'';
}
maybe this helps :-)
Scott Fletcher wrote:
I noticed there is no MySQL equivalent for odbc_result_all(), so it meant I
had to make a user-defined function from scratch.  That part, I haven't been
able to do very well.  Does anyone have a good code or whip up one that
would work.
Thanks...
FletchSOD
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: MySQL equivalent for odbc_result_all()???????

2004-06-09 Thread coopster
There is an example in the User Contributed Notes on the 
odbc_result_all() function page.

Scott Fletcher wrote:
I noticed there is no MySQL equivalent for odbc_result_all(), so it meant I
had to make a user-defined function from scratch.  That part, I haven't been
able to do very well.  Does anyone have a good code or whip up one that
would work.
Thanks...
FletchSOD
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Re: Mysql Problem

2004-05-28 Thread Ian Barnes
Hi,

Yes that was my mistake. But even with the code, it still doesnt display the
last one. If i didnt put a " it wouldnt work at all.

Thanks,
Ian

-Original Message-
From: Torsten Roehr [mailto:[EMAIL PROTECTED]
Sent: 28 May 2004 13:56
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Mysql Problem


"Ian Barnes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I am generating a mysql statement and then printing it to a formatted
field.
> Here is my code:
>
> $sql="SELECT * from tablename where name in ('Web','HTML','PHP') group by
> name;

You are missing the closing quote here!

Please set your error reporting to E_ALL while developing:
ini_set('error_reporting', E_ALL);

Regards, Torsten Roehr


> $mysql_rslt1 = mysql_query($sql, $mysql_bconn)
> or die ("Could not get data");
> while ($rec1 = mysql_fetch_array ($mysql_rslt1)) {
> echo "some stuff here";
> }
>
> Now the problem is it will leave out the last line of the reply. So it
would
> leave out the 'PHP' line for the query above. Always the last line, and if
> for some reason i only have 1 in my query, it displays nothing, although
if
> I do it manually using the mysql prompt, it works fine, and i get back the
> info I want. All the other lines format properly and the info is correct,
> just the last line doesnt display.
>
> Any ideas ?
>
> Ian

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

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



[PHP] Re: Mysql Problem

2004-05-28 Thread Torsten Roehr
"Ian Barnes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I am generating a mysql statement and then printing it to a formatted
field.
> Here is my code:
>
> $sql="SELECT * from tablename where name in ('Web','HTML','PHP') group by
> name;

You are missing the closing quote here!

Please set your error reporting to E_ALL while developing:
ini_set('error_reporting', E_ALL);

Regards, Torsten Roehr


> $mysql_rslt1 = mysql_query($sql, $mysql_bconn)
> or die ("Could not get data");
> while ($rec1 = mysql_fetch_array ($mysql_rslt1)) {
> echo "some stuff here";
> }
>
> Now the problem is it will leave out the last line of the reply. So it
would
> leave out the 'PHP' line for the query above. Always the last line, and if
> for some reason i only have 1 in my query, it displays nothing, although
if
> I do it manually using the mysql prompt, it works fine, and i get back the
> info I want. All the other lines format properly and the info is correct,
> just the last line doesnt display.
>
> Any ideas ?
>
> Ian

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



[PHP] Re: mysql blob and phpmysqladmin

2004-05-13 Thread Torsten Roehr
"Jianping Zhu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have mysql table call com. One colum of table com will store
> user's comments. Because user-provided comment might be too big to fit in
char(255), i
> use blob. but when i try to see it by use phpmysqladmin, i can only see
> something like [BLOB 345 byes] i can not read the text of the comment.
>
> Is there a way to let see the user-provide comments from phpmysqladmin?
>
> Thank
>
> JP

Why don't you use column type "text"? This does not have the 255 character
limit.

Regards, Torsten

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



[PHP] Re: MySQL Dump

2004-04-22 Thread Torsten Roehr
"Matt Palermo" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Is there an easy way to do a mysql dump routine written in php?  I
basically
> want to write a function to backup a database and have it create all the
> neccessary structures and data in the dump.  I know phpMyAdmin will do
this
> for me, but I want to write a function to do this incase the server
doesn't
> have phpMyAdmin installed.  Any ideas?
>
> Thanks,
>
> Matt

Hi Matt,

I have converted the relevant dump scripts of phpMyAdmin into a function and
removed all unnecessary stuff. This has served me well for over a year now.
Are you interested?

Regards,
Torsten Roehr

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



[PHP] Re: mysql and md5??

2004-03-25 Thread Rebus
On Wed, 24 Mar 2004 20:46:33 -0500, [EMAIL PROTECTED] (Andy B) wrote:

>hi...
>
>trying to figure out what is wrong here... the code is supposed to check an md5'd 
>password from a form and compare it against an md5'd password in a mysql table... for 
>some strange reason when i run the code below on my dev server (apache 2.0.47, 
>php4.3.3 and mysql 4.1-A) it works. when i run it on the live site (apache 1.0.3.2, 
>php 4.1.2 and mysql 3.22.5.6) it wont work and for that matter wont even return an 
>error!

>mysql_query("select * from rnjresort.users where username='$username' and 
>pwd=md5($password)");

Try to put md5($password) inside single quotes, like this

mysql_query("select * from rnjresort.users where username='$username'
and pwd='".md5($password)."'");

or maybe

$crypted_pass = md5($password);
mysql_query("select * from rnjresort.users where username='$username'
and pwd='$crypted_pass'");

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



[PHP] Re: MYSQL & Image functions

2004-03-08 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> I am trying to use any of the image functions with image data from a
> mysql database. I can get these functions to work from files on the
> server but for some reason, not out of the database. If any one has
> gotten this to work, code you shoot me over some sample code, or
> functions on what to do.
> 
You probably need to eval() the strings after you extract them from the 
database.

-- 
Quod subigo farinam

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



[PHP] Re: MySQL update

2004-02-24 Thread Howard Miller
You can't

well, not via PHP anyway. You would need to do a select first to establish
if any of these values exist in the database. Something like...

select first,last,email from mytable where first=x or last=y or email=z;

then check which one of first,last,email is non-empty.

BUT.. do you *realy* want firstname and lastname to be unique??

HM

 

Matthew Oatham wrote:

> Hi,
> 
> I have an update statement that tries to update a number of values - these
> values have unique value constraint so when I do the update it will either
> succeed or fail. If it fails how can I determine where the update failed.
> i.e. pinpoint the value that was not unique?
> 
> At the moment I am doing ...
> 
> $sql = mysql_query("UPDATE dis_user SET first_name = '$firstName',
> last_name = '$lastName', email_address = '$emailAddress' WHERE user_id =
> '$userId'");
> 
> if(!$sql) {
> echo "Data not inserted due error";
> }
> 
> How can I improve on the above to give specific error information.
> 
> Thanks
> 
> Matt

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



[PHP] Re: mysql functions

2004-02-10 Thread Eric Bolikowski
Would advise mysql_fetch_row()

"Angelo Zanetti" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have a query which returns only 1 row, which of the following would be
the
> best to get the value from the resultset:
>
> mysql_result()
> mysql_fetch_field()
> mysql_fetch_row()
>
> the resultset only returns 1 column, so basically its only 1 field i get
> from the resultset.
>
> thanx in advance.
> angelo
>
> 
> Disclaimer
> This e-mail transmission contains confidential information,
> which is the property of the sender.
> The information in this e-mail or attachments thereto is
> intended for the attention and use only of the addressee.
> Should you have received this e-mail in error, please delete
> and destroy it and any attachments thereto immediately.
> Under no circumstances will the Cape Technikon or the sender
> of this e-mail be liable to any party for any direct, indirect,
> special or other consequential damages for any use of this e-mail.
> For the detailed e-mail disclaimer please refer to
> http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



RE: [PHP] Re: MySQL: Order by

2004-02-05 Thread Angelo Zanetti
make your column of type int column

-Original Message-
From: Ben Ramsey [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 05, 2004 7:52 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] Re: MySQL: Order by


I assume "number" is a column name in your table.  If so, I'm also
guessing that it's probably of a varchar (or some other character type)
datatype.  Here's why: if it's a character, then ORDER BY will sort
alphabetically.  The way it sorts number alphabetically is rather odd,
but it makes sense in an alphabetical way.

If it is character data, then it should order like this:
1
10
11
12
13
2
3
4
..

To correct it, put a zero at the beginning of your single digits:
01
02
03
..
10
11
12

That will order it correctly.  Otherwise, change the number column to
type int, and it should work just fine.

Hope that answers your question, and, yes, this is more of a MySQL
question.  ;-)

-Ben


John Taylor-Johnston wrote:
> This is probably a MySQL question, and maybe an easy question, but I'm
here to learn <|:)
>
> When I order by number, it echoes 1,2,3,4,5,6,7,8,9,10 and hten jumps to
100...199 before it comes back to 11-19. Any way of ordering that
differently?
>
> $sql = 'SELECT * FROM '.$table.' ORDER BY number desc;';

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


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



[PHP] Re: MySQL: Order by

2004-02-04 Thread Ben Ramsey
I assume "number" is a column name in your table.  If so, I'm also 
guessing that it's probably of a varchar (or some other character type) 
datatype.  Here's why: if it's a character, then ORDER BY will sort 
alphabetically.  The way it sorts number alphabetically is rather odd, 
but it makes sense in an alphabetical way.

If it is character data, then it should order like this:
1
10
11
12
13
2
3
4
...
To correct it, put a zero at the beginning of your single digits:
01
02
03
...
10
11
12
That will order it correctly.  Otherwise, change the number column to 
type int, and it should work just fine.

Hope that answers your question, and, yes, this is more of a MySQL 
question.  ;-)

-Ben

John Taylor-Johnston wrote:
This is probably a MySQL question, and maybe an easy question, but I'm here to learn <|:)

When I order by number, it echoes 1,2,3,4,5,6,7,8,9,10 and hten jumps to 100...199 before it comes back to 11-19. Any way of ordering that differently?

$sql = 'SELECT * FROM '.$table.' ORDER BY number desc;';
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: MySQL timestamp to desired date function

2003-09-18 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Hi all,
> 
> I have a a timestamp in a DB (14 digits) that I want to display like I
> want in my pages. I tried to use strtotime, mktime and date functions
> with no success... it always return the current timestamp instead of the
> one I have stored. This is what I've done so far:
> 
>   for ($x = 0; $x < $num_rows; $x++)
>   {
>   $row = mysql_fetch_array($result);
>   $date1 = strtotime($row[lugar_lastinsert]);
>   $date2 = date("d \de m \de Y \a \l\a\s H:i:s",
> mktime($date1));
>   echo "";
>   echo "";
>   echo $row[lugar_name]." - ".$row[lugar_specific];
>   echo "";
>   echo "";
>   echo $date2;
>   echo "";
>   echo "";
>   }
> 
> How can I do this and make it work?
> 
> Thanks in advanced,
> 
> Cesar Aracena
> www.icaam.com.ar
> 
Have you considered using MySQL's DATE_FORMAT function?

Cheers
-- 
Quod subigo farinam

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



[PHP] Re: Mysql query and PHP loops

2003-07-31 Thread sven
did you also play with group by?
what does this return?

select * from `yourTable` group by `val1`

ciao SVEN

Petre Agenbag wrote:
> Hi List
>
> I've been trying to do something with one MySQL query, but I don't
> think it is possible, so, I would need to probably do multiple
> queries, and possibly have queries inside loops, but I am rather
> weary of that so, I'd like your views/possible solutions to doing the
> following:
>
>
> Consider this:
>
> id val1 val2 val3
> 1 a 1 1
> 2 b 2 3
> 3 a 1 2
> 4 b 2 1
> 5 c 3 3
> 6 c 2 1
>
> I need to query this table to return this:
>
> id val1 val2 val3
> 3 a 1 2
> 4 b 2 1
> 6 c 2 1
>
> Thus, I need to firstly only return ONE row for each val1, and that
> row MUST be that last row (ie, the row with the highest id, OR,
> should val3 for instance be a date, then with the highest date).
>
>
> if I do a
>
> select distinct val1, MAX(id) from table order by val1, then it
> returns
>
> id val1
> 3 a
> 4 b
> 6 c
>
> which is correct, BUT
> select distinct val1, MAX(id), val2 from table order by val1
>
> it returns
>
> id val1 val2
> 3 a 1
> 4 b 2
> 6 c 3 <--- incorrect
>
> it then returns the FIRST "hit" for val2 in the db, and NOT the one in
> the row with the max id...
>
> Can I do this with one query? ( PS, I cannot use MAX on val2 or val3,
> they are text)
>
>
> Thanks



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



RE: [PHP] Re: MySQL query problems

2003-07-16 Thread Beauford.2005
Not sure what the problem was, but I dug up a similar script I used for
something else and modifed it for this project, and voila. I then put
the two side by side and I still can't see where the problem is. 

Thanks for the input.

-Original Message-
From: Nomadeous [mailto:[EMAIL PROTECTED] 
Sent: July 16, 2003 5:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: MySQL query problems


But what's your prob ?
When you say the second one seems to never be executed ...
Does the line:
$row = mysql_fetch_array($result2);
launches a Php Error ?

And pay attention, because you're using mysql_fetch_array and
mysql_fetch_row, be sure that you are not treating the result in the
same way ;-)

"Beauford.2005" <[EMAIL PROTECTED]> a écrit dans le message de
news: [EMAIL PROTECTED]
> Hi,
>
> Not sure if the problem here is PHP or MySQL, but here we go. I am 
> trying to do two queries on a database - one after the other, but the 
> second one never seems to get executed. The two queries are identical 
> except for two variables. I have checked my form and they are correct 
> and are being sent to the PHP script the way they should be.
>
> The variables are $playerto, $playerfrom, $nameto, $namefrom. The 'TO'

> query is the one that doesn't work.
>
> Here is my code. Any help is appreciated.
>
> if ($namefrom != $nameto) {
> if ($playerfrom != $playerto) {
>
> include("2004server.inc");
> if($error) {
> include("trades-input.php");
> exit;
> }
>
> $query1 = "select manager.idn, manager.total,
> roster.idp, position, points from roster join reference
> join manager where manager.idn=reference.idn and 
> reference.idp=roster.idp and manager.idn like '$namefrom' and 
> roster.idp like '$playerfrom'";
>
> $result1 = mysql_query($query1) or $mysqlerror = mysql_error();
> if ($mysqlerror) {
> $error = "$d_base_error$email_error";
> include("trades-input.php");
> exit;
> }
>
> $line = mysql_fetch_row($result1);
>
> mysql_free_result($result1);
>
> $query2 = "select manager.idn, manager.total,
> roster.idp, position, points from roster join reference
> join manager where manager.idn=reference.idn and 
> reference.idp=roster.idp and manager.idn like '$nameto' and roster.idp

> like '$playerto'";
>
> $result2 = mysql_query($query2) or $mysqlerror = mysql_error();
> if ($mysqlerror) {
> $error = "$d_base_error$email_error";
> include("trades-inputs.php");
> exit;
> }
>
> $row = mysql_fetch_array($result2);
>
> mysql_free_result($result2);
> }
> }
>



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


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



[PHP] Re: MySQL query problems

2003-07-16 Thread Nomadeous
But what's your prob ?
When you say the second one seems to never be executed ...
Does the line:
$row = mysql_fetch_array($result2);
launches a Php Error ?

And pay attention, because you're using mysql_fetch_array and
mysql_fetch_row, be sure that
you are not treating the result in the same way ;-)

"Beauford.2005" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> Hi,
>
> Not sure if the problem here is PHP or MySQL, but here we go. I am
> trying to do two queries on a database - one after the other, but the
> second one never seems to get executed. The two queries are identical
> except for two variables. I have checked my form and they are correct
> and are being sent to the PHP script the way they should be.
>
> The variables are $playerto, $playerfrom, $nameto, $namefrom. The 'TO'
> query is the one that doesn't work.
>
> Here is my code. Any help is appreciated.
>
> if ($namefrom != $nameto) {
> if ($playerfrom != $playerto) {
>
> include("2004server.inc");
> if($error) {
> include("trades-input.php");
> exit;
> }
>
> $query1 = "select manager.idn, manager.total,
> roster.idp, position, points from roster join reference
> join manager where manager.idn=reference.idn and
> reference.idp=roster.idp and manager.idn like '$namefrom' and
> roster.idp like '$playerfrom'";
>
> $result1 = mysql_query($query1) or $mysqlerror =
> mysql_error();
> if ($mysqlerror) {
> $error = "$d_base_error$email_error";
> include("trades-input.php");
> exit;
> }
>
> $line = mysql_fetch_row($result1);
>
> mysql_free_result($result1);
>
> $query2 = "select manager.idn, manager.total,
> roster.idp, position, points from roster join reference
> join manager where manager.idn=reference.idn and
> reference.idp=roster.idp and manager.idn like '$nameto' and
> roster.idp like '$playerto'";
>
> $result2 = mysql_query($query2) or $mysqlerror =
> mysql_error();
> if ($mysqlerror) {
> $error = "$d_base_error$email_error";
> include("trades-inputs.php");
> exit;
> }
>
> $row = mysql_fetch_array($result2);
>
> mysql_free_result($result2);
> }
> }
>



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



[PHP] Re: MySQL Results - display issue :S

2003-07-09 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> I know im probibly getting irritating to most of you :P but i thought i may
> ask another thing that is on my mind!
> 
> I have a sql query bringing back 200 rows for arguments sake, From this i
> would like an answer to 2 issues i have.
> 
> 1) I know how to display it row after row going down :P duh of course :P,
> but i have seen sites where it goes across then down across then down ect
> ect like X -> X then next row ect. How is this done??

Easy enough; keep a count of how many records you have processed and use 
the modulus operator % to determine where you want to start a new 

> 2) How can i alternate the colours for each row?? row 1 eg light blue and
> the 2nd row dark blue then back to light blue ect ect.

There will be at least n different ways of doing this; one would be to 
change the colour using the above test as a trigger. Another is via a 
simple ternary operator test:

$bgcolour = ($bgcolour == '#FF' ? '#00FF00' : '##FF);

In other words if $bgcolour is currently red then make it blue else make 
it red.

> Thanks in advance
> 

-- 
Quod subigo farinam

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



[PHP] Re: mysql detect

2003-07-02 Thread Manuel Lemos
Hello,

On 07/02/2003 04:05 AM, [EMAIL PROTECTED] wrote:
what command in linux , to see default direcktory instalation mysql
database dan mysql library
./configure ?

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: mysql update not working

2003-06-26 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
> I have the following code:
> 
> 
> $sql = "UPDATE class_sub SET  desc = '$catdesc', sub_cat = '$subcatname' 
> WHERE id='$catid'";
> echo $sql;
> $sql_result = mysql_query($sql);
> if (!$sql_result)
> {
> echo "Couldn't update record!";
> echo mysql_error();
> exit;
> } else
> {
> header("Location: index.php"); /* Redirect browser */
> exit;
> }   
> here is the actual sql statement:
> UPDATE class_sub SET desc = 'Come play with us! This class is designed 
> to challenge your cardiovascular and muscular endurance. Participants 
> will work or \"play\" in different activities such as team exercises, 
> sprints, obstacle courses, cycling, plyometrics, and core conditioning. 
> Challenge yourself like never before!', sub_cat = 'Recess' WHERE id='4'
> 
> And the error:
> 
> 
> Couldn't update record!
> 
> You have an error in your SQL syntax near 'desc = 'Come play with us! 
> This class is designed to challenge your cardiovascul' at line 1

Desc is a reserved word in mysql


-- 
Quod subigo farinam

$email =~ s/oz$/au/o;


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



[PHP] Re: mysql - get actual row

2003-06-10 Thread BAROILLER Pierre-Emmanuel
Hy,

try with mysql_insert_id()  [ if you've set the first field as "index" in
your table ].


Regards.


"Harry.De" <[EMAIL PROTECTED]> a écrit dans le message de
news:[EMAIL PROTECTED]
> Hi,
> if i insert into a mysql table a row e.g.
>mysql_query("INSERT into TEST (testfield) VALUES ('This is a test')");
> and the first field is an auto increment (e.g. NR),
> how can i get the value of the auto increment NR i've actually inserted?
>
> Tanks Harry
>
>
>
>
>



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



[PHP] Re: MySQL Problem

2003-06-06 Thread Esteban Fernandez
What's up

Supposing that the filename of the you code is create_table.php.
Try tipping in the URL: create_table.php?nueva_base=prueba

EF.
---

Que tal

Suponiendo que el archivo del codigo se llama create_table.php.
Prueba poniendo el la URL: create_table.php?nueva_base=prueba

EF.



"Felipe R." <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Hi everyone,
>
> first, sorry to all if my english is so poor.
> second, i have the follow question: when i create a existing MySQL DBase,
> what happend??
>
> how can i avoid this problem??
>
> i attached my create_table code. Thanks for all
>
> 
> 
> Creación de una Base de Datos
> 
> 
>  Creando Base de Datos
>
>   $connection = mysql_connect("localhost","ferios","ferios") or die ("No se
> puede conectar a MySQL");
>  if (!$connection) {
>  die ("No se puede conectar a MySQL");
>  }
>
>  if (mysql_create_db("$nueva_base")) {
>  print (" Base de Datos  size=\"5\">$nueva_base Creada Satisfactoriamente!!");
>  $db_list = mysql_list_dbs($connection);
>  $indice=0;
>
>  while($row = mysql_fetch_array($db_list)){
>  $bases[$indice]=$row[0];
>  $indice++;
>  }
>
>  mysql_close($connection);
>
>  echo " Las Bases de Datos Disponibles son:
> ";
>  for($aux = 0; $aux < $indice; $aux++) {
>  echo " $bases[$aux]";
>  }
>  }else{
>  print ("Ërror Creando la Base de Datos: ". mysql_error());
>  }
> ?>
>
>  Volver a  href="http://localhost/administrador.htm";>Administrador de Bases de
> Datos
>  Volver a http://localhost/nueva_base.htm";>Crear
> un Base de Datos
>
> 
> 
>
>
>
>



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



[PHP] Re: MySQL Date

2003-03-24 Thread George Whiffen
Why not get MySQL to compare your date with today?

 e.g.

select if(Booking_Date = curdate(),'booked','free') as Todays_Status ...

$Todays_Status = mysql_result($result,$i, Todays_Status);

echo "you are $Todays_Status today";

I find it is much, much safer to only use the database for finding out 
the date/time. Why?

My applications typically run where the database and the web-server are 
on different machines and where there often multiple machines running 
the web-servers.  That means different clocks.

This can cause some really horrid bugs to start appearing e.g. records 
you just inserted "today" appearing on the next select as yesterday's or 
tomorrow's,  records appearing to be inserted out of order, etc. etc. 
What makes them so nasty is that you may notice until the data is 
completely screwed up.

You won't get these problems as long as you only ever use the database 
server to supply the date/time.  You will always get consistent results 
even if they are consistently a few seconds fast or slow. Records will 
always appear to have been inserted in the expected order, a row with 
"today"'s date will show up on every query for today etc.  You have to 
be careful as and when the time is changed on the database server, 
(which is why they so often do have the wrong time!).

To pick up today from the database server, remember you don't have to 
have any tables in your query e.g. your query can be as simple (and 
fast) as :-

select curdate() as today;

Regards,

George

Shaun wrote:
Hi,

I have a date stored in a table in my MySQL Database using a DATE type for
the column.
How can i compare the date in the table to today

e.g.

$today = mysql_result($result, $i, Booking_Date);

if($today = *HELP*){
echo "you are booked today";
}else{
echo "you are free today";
}
thanks for your help




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


[PHP] Re: MySQL Query

2003-03-05 Thread David Eisenhart
If I understand your requirement correctly I would say that you are looking
in the wrong place to protect particular table fields from the user; the
user gets access to the underlying database only through your 'application'
pages (ie. your php pages) - it is your coding of these pages that
determines what the user can not and can not do in the underlying database
(ok, the database permissions also serve this kind of function, but as you
are talking about (dis)allowing editing of certain fields within particular
tables this will be determined by your 'application logic' as mentioned
above)

Hope this helps
David Eisenhart




"Shaun" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Is there a way of updating a table so that I can add some sort of
identifier
> to each field, something as simple as x=1 will do. I want to be able to
> modify the table so I can set a variable for each column so I can tell
> whether I can let a user modify that field. If I modify the fieldname then
> the web application wont work. The purpose of this is to create a content
> management system that will allow me to set which fields are editable by
the
> user. I don't want to add another field to each table because I want the
> system to be as portable and pluggable into other web sites as possible.
>
> Any ideas would be greatly appreciated.
>
> Thanks
>
>



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



[PHP] RE: Mysql Date got prob!

2003-03-01 Thread Dhaval Desai
Hi,

Thanx for yor reply. Well It worked for me with the same query when I used 
"HAVING" instead of "where". This is what I got from Mysql Database. However 
the solution that you have showed is reall good as well.

Thanx
-Dhaval





From: "Uttam" <[EMAIL PROTECTED]>
To: "'Dhaval Desai'" <[EMAIL PROTECTED]>,<[EMAIL PROTECTED]>
Subject: RE: Mysql Date got prob!
Date: Sat, 1 Mar 2003 13:45:53 +0530
try:

select
date_format(date_add(arrivaldate1, INTERVAL nights1 DAY), '%Y-%m-%d') as
dept_date1
from mytable
where
(date_add(arrivaldate1, INTERVAL nights1 DAY) BETWEEN '2003-02-01' AND
'2003-02-10')
regds,
-Original Message-
From: Dhaval Desai [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 15:48
To: [EMAIL PROTECTED]
Subject: Mysql Date got prob!
Hello,

As related to my earlier question

select  date_format(date_add(arrivaldate1, INTERVAL nights1 DAY), '%Y-
%m-%d') as dept_date1 from mytable where ('dept_date1' BETWEEN
'2003-02-01' AND '2003-02-10')
The above query is valid but returns 0 because 'dept_date1' is treated
as a
string. I want dept_date1 to be treated as  date so that it can be
compared.
I hope it is possible...

Thank you!

-Dhaval

_
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail


_
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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


[PHP] RE: Mysql Date got prob!

2003-03-01 Thread Uttam
try:

select
date_format(date_add(arrivaldate1, INTERVAL nights1 DAY), '%Y-%m-%d') as
dept_date1
from mytable
where
(date_add(arrivaldate1, INTERVAL nights1 DAY) BETWEEN '2003-02-01' AND
'2003-02-10')

regds,
-Original Message-
From: Dhaval Desai [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 15:48
To: [EMAIL PROTECTED]
Subject: Mysql Date got prob!


Hello,

As related to my earlier question


select  date_format(date_add(arrivaldate1, INTERVAL nights1 DAY), '%Y-
%m-%d') as dept_date1 from mytable where ('dept_date1' BETWEEN
'2003-02-01' AND '2003-02-10')

The above query is valid but returns 0 because 'dept_date1' is treated
as a
string. I want dept_date1 to be treated as  date so that it can be
compared.


I hope it is possible...


Thank you!

-Dhaval


_
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail



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



Re: [PHP] Re: Mysql DB connect failure

2003-02-23 Thread Sunfire
better to use something like
mysql_connect("localhost", "test1", "test1")||die(mysql_error());
because you will make smaller code that way killing the script instantly
when connection is refused and you will still get the same message:
user access denied for '[EMAIL PROTECTED]' using password:(yes)

in either case die would be better to use than testing a link variable since
in very large amounts of hits on the db that way could cause a test to fall
through and do something really uninteresting..

at least thats my experience with that...
 so if i purposfully make an error:
mysql_connect("localhost", "root", "")||die(mysql_error());
i get
the message above about the error


- Original Message -
From: "Hans Prins" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 21, 2003 11:07 AM
Subject: Re: [PHP] Re: Mysql DB connect failure


> > Would you care to explain to the rest of the list how you intend to use
> > mysql_error () to return connection failure information?
> >
> > It returns the text of the error message from previous MySQL operation
> > Description: string mysql_error ( [resource link_identifier])
> >
> > Seems to me that without a connection, we wouldn't have a valid
> > link_identifier.
>
> maybe so, but it works nonetheless.
>
> if for example the username stated in the connection initialization was
> wrong it will print an error like:
>
> "Access denied for user: '[EMAIL PROTECTED]' (Using password: YES)"
>
> MI,
>
> my code would look somethign like this:
>
> $link = @mysql_pconnect("localhost", "test1", "test1");
>
> // If connection failed...
> if (!$link) {
> // Inform user of error and quit
> print "Couldn't connect to database server\n";
> print mysql_error();
> exit;
> }
>
>
>
> "Jason K Larson" <[EMAIL PROTECTED]> schreef in bericht
> news:[EMAIL PROTECTED]
> > Would you care to explain to the rest of the list how you intend to use
> > mysql_error () to return connection failure information?
> >
> > It returns the text of the error message from previous MySQL operation
> > Description: string mysql_error ( [resource link_identifier])
> >
> > Seems to me that without a connection, we wouldn't have a valid
> > link_identifier.
> >
> > What you probably should attempt going for is getting something back
> > from PHP itself regarding the error returned when the mysql_connect
> failed.
> >
> > Here's a snippet from:
> > http://www.php.net/manual/en/language.operators.errorcontrol.php
> >
> > If the track_errors feature is enabled, any error message generated by
> > the expression will be saved in the global variable $php_errormsg. This
> > variable will be overwritten on each error, so check early if you want
> > to use it.
> >
> > Hope that clears things up a bit.
> >
> > Regards,
> > Jason k Larson
> >
> >
> >
> > Hans Prins wrote:
> > > did you try:
> > > print mysql_error();
> > >
> > > "Ml" <[EMAIL PROTECTED]> schreef in bericht
> > > news:[EMAIL PROTECTED]
> > >
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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


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



Re[2]: [PHP] Re: Mysql DB connect failure

2003-02-21 Thread Tom Rogers
Hi,

Saturday, February 22, 2003, 2:26:35 AM, you wrote:
M> I see that its looking for mysql.sock in /tmp/mysql.sock
M> but I searched on my system and only found mysql.sock in /var/lib/mysql/

M> is there a section where I need to change this setting? or a conf file?


M> "Hans Prins" <[EMAIL PROTECTED]> wrote in message
M> news:[EMAIL PROTECTED]
>> > Would you care to explain to the rest of the list how you intend to use
>> > mysql_error () to return connection failure information?
>> >
>> > It returns the text of the error message from previous MySQL operation
>> > Description: string mysql_error ( [resource link_identifier])
>> >
>> > Seems to me that without a connection, we wouldn't have a valid
>> > link_identifier.
>>
>> maybe so, but it works nonetheless.
>>
>> if for example the username stated in the connection initialization was
>> wrong it will print an error like:
>>
>> "Access denied for user: '[EMAIL PROTECTED]' (Using password: YES)"
>>
>> MI,
>>
>> my code would look somethign like this:
>>
>> $link = @mysql_pconnect("localhost", "test1", "test1");
>>
>> // If connection failed...
>> if (!$link) {
>> // Inform user of error and quit
>> print "Couldn't connect to database server\n";
>> print mysql_error();
>> exit;
>> }
>>
>>
>>
>> "Jason K Larson" <[EMAIL PROTECTED]> schreef in bericht
>> news:[EMAIL PROTECTED]
>> > Would you care to explain to the rest of the list how you intend to use
>> > mysql_error () to return connection failure information?
>> >
>> > It returns the text of the error message from previous MySQL operation
>> > Description: string mysql_error ( [resource link_identifier])
>> >
>> > Seems to me that without a connection, we wouldn't have a valid
>> > link_identifier.
>> >
>> > What you probably should attempt going for is getting something back
>> > from PHP itself regarding the error returned when the mysql_connect
>> failed.
>> >
>> > Here's a snippet from:
>> > http://www.php.net/manual/en/language.operators.errorcontrol.php
>> >
>> > If the track_errors feature is enabled, any error message generated by
>> > the expression will be saved in the global variable $php_errormsg. This
>> > variable will be overwritten on each error, so check early if you want
>> > to use it.
>> >
>> > Hope that clears things up a bit.
>> >
>> > Regards,
>> > Jason k Larson
>> >
>> >
>> >
>> > Hans Prins wrote:
>> > > did you try:
>> > > print mysql_error();
>> > >
>> > > "Ml" <[EMAIL PROTECTED]> schreef in bericht
>> > > news:[EMAIL PROTECTED]
>> > >
>> >
>> >
>>
>>

In php.ini

mysql.default_socket = /var/lib/mysql/mysql.sock

-- 
regards,
Tom


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



Re: [PHP] Re: Mysql DB connect failure

2003-02-21 Thread ML
Thanks rick, that is a much cleaner solution!


"Rick Emery" <[EMAIL PROTECTED]> wrote in message
009f01c2d9c1$51171d20$0500a8c0@honeybee">news:009f01c2d9c1$51171d20$0500a8c0@honeybee...
> $db = mysql_pconnect("localhost", "test1", "test1") or die(mysql_error());
>
> - Original Message -
> From: "ML" <[EMAIL PROTECTED]>
> To: <>
> Sent: Friday, February 21, 2003 9:33 AM
> Subject: [PHP] Re: Mysql DB connect failure
>
>
> Where exactly would I put the print mysql_error() ?
> Here is the code...
>
> 
>  @ $db = mysql_pconnect("localhost", "test1", "test1")
>or
>die("
> 
> 
> 
> 
> ");
>
>
>
>
>
> "Hans Prins" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > did you try:
> > print mysql_error();
> >
> > "Ml" <[EMAIL PROTECTED]> schreef in bericht
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Currently I have some php code that displays a message if a connect to
> my
> > > database fails. Is there anyway I
> > > can get a more descriptive error message? So I can see exactly why my
> php
> > > can't connect to the Database?
> > > I am pretty sure that the username and password are correct and the
> > username
> > > exists as a mysql user...
> > >
> > >
> > >
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



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




Re: [PHP] Re: Mysql DB connect failure

2003-02-21 Thread ML
I see that its looking for mysql.sock in /tmp/mysql.sock
but I searched on my system and only found mysql.sock in /var/lib/mysql/

is there a section where I need to change this setting? or a conf file?


"Hans Prins" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Would you care to explain to the rest of the list how you intend to use
> > mysql_error () to return connection failure information?
> >
> > It returns the text of the error message from previous MySQL operation
> > Description: string mysql_error ( [resource link_identifier])
> >
> > Seems to me that without a connection, we wouldn't have a valid
> > link_identifier.
>
> maybe so, but it works nonetheless.
>
> if for example the username stated in the connection initialization was
> wrong it will print an error like:
>
> "Access denied for user: 'username@localhost' (Using password: YES)"
>
> MI,
>
> my code would look somethign like this:
>
> $link = @mysql_pconnect("localhost", "test1", "test1");
>
> // If connection failed...
> if (!$link) {
> // Inform user of error and quit
> print "Couldn't connect to database server\n";
> print mysql_error();
> exit;
> }
>
>
>
> "Jason K Larson" <[EMAIL PROTECTED]> schreef in bericht
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Would you care to explain to the rest of the list how you intend to use
> > mysql_error () to return connection failure information?
> >
> > It returns the text of the error message from previous MySQL operation
> > Description: string mysql_error ( [resource link_identifier])
> >
> > Seems to me that without a connection, we wouldn't have a valid
> > link_identifier.
> >
> > What you probably should attempt going for is getting something back
> > from PHP itself regarding the error returned when the mysql_connect
> failed.
> >
> > Here's a snippet from:
> > http://www.php.net/manual/en/language.operators.errorcontrol.php
> >
> > If the track_errors feature is enabled, any error message generated by
> > the expression will be saved in the global variable $php_errormsg. This
> > variable will be overwritten on each error, so check early if you want
> > to use it.
> >
> > Hope that clears things up a bit.
> >
> > Regards,
> > Jason k Larson
> >
> >
> >
> > Hans Prins wrote:
> > > did you try:
> > > print mysql_error();
> > >
> > > "Ml" <[EMAIL PROTECTED]> schreef in bericht
> > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > >
> >
> >
>
>



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




Re: [PHP] Re: Mysql DB connect failure

2003-02-21 Thread ML
You were right Prins, I got the error:

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

So I guess I need to investigate what this means now...
Thanks!

-ML

"Hans Prins" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Would you care to explain to the rest of the list how you intend to use
> > mysql_error () to return connection failure information?
> >
> > It returns the text of the error message from previous MySQL operation
> > Description: string mysql_error ( [resource link_identifier])
> >
> > Seems to me that without a connection, we wouldn't have a valid
> > link_identifier.
>
> maybe so, but it works nonetheless.
>
> if for example the username stated in the connection initialization was
> wrong it will print an error like:
>
> "Access denied for user: 'username@localhost' (Using password: YES)"
>
> MI,
>
> my code would look somethign like this:
>
> $link = @mysql_pconnect("localhost", "test1", "test1");
>
> // If connection failed...
> if (!$link) {
> // Inform user of error and quit
> print "Couldn't connect to database server\n";
> print mysql_error();
> exit;
> }
>
>
>
> "Jason K Larson" <[EMAIL PROTECTED]> schreef in bericht
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Would you care to explain to the rest of the list how you intend to use
> > mysql_error () to return connection failure information?
> >
> > It returns the text of the error message from previous MySQL operation
> > Description: string mysql_error ( [resource link_identifier])
> >
> > Seems to me that without a connection, we wouldn't have a valid
> > link_identifier.
> >
> > What you probably should attempt going for is getting something back
> > from PHP itself regarding the error returned when the mysql_connect
> failed.
> >
> > Here's a snippet from:
> > http://www.php.net/manual/en/language.operators.errorcontrol.php
> >
> > If the track_errors feature is enabled, any error message generated by
> > the expression will be saved in the global variable $php_errormsg. This
> > variable will be overwritten on each error, so check early if you want
> > to use it.
> >
> > Hope that clears things up a bit.
> >
> > Regards,
> > Jason k Larson
> >
> >
> >
> > Hans Prins wrote:
> > > did you try:
> > > print mysql_error();
> > >
> > > "Ml" <[EMAIL PROTECTED]> schreef in bericht
> > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > >
> >
> >
>
>



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




Re: [PHP] Re: Mysql DB connect failure

2003-02-21 Thread Hans Prins
> Would you care to explain to the rest of the list how you intend to use
> mysql_error () to return connection failure information?
>
> It returns the text of the error message from previous MySQL operation
> Description: string mysql_error ( [resource link_identifier])
>
> Seems to me that without a connection, we wouldn't have a valid
> link_identifier.

maybe so, but it works nonetheless.

if for example the username stated in the connection initialization was
wrong it will print an error like:

"Access denied for user: 'username@localhost' (Using password: YES)"

MI,

my code would look somethign like this:

$link = @mysql_pconnect("localhost", "test1", "test1");

// If connection failed...
if (!$link) {
// Inform user of error and quit
print "Couldn't connect to database server\n";
print mysql_error();
exit;
}



"Jason K Larson" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Would you care to explain to the rest of the list how you intend to use
> mysql_error () to return connection failure information?
>
> It returns the text of the error message from previous MySQL operation
> Description: string mysql_error ( [resource link_identifier])
>
> Seems to me that without a connection, we wouldn't have a valid
> link_identifier.
>
> What you probably should attempt going for is getting something back
> from PHP itself regarding the error returned when the mysql_connect
failed.
>
> Here's a snippet from:
> http://www.php.net/manual/en/language.operators.errorcontrol.php
>
> If the track_errors feature is enabled, any error message generated by
> the expression will be saved in the global variable $php_errormsg. This
> variable will be overwritten on each error, so check early if you want
> to use it.
>
> Hope that clears things up a bit.
>
> Regards,
> Jason k Larson
>
>
>
> Hans Prins wrote:
> > did you try:
> > print mysql_error();
> >
> > "Ml" <[EMAIL PROTECTED]> schreef in bericht
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
>
>



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




Re: [PHP] Re: Mysql DB connect failure

2003-02-21 Thread Jason k Larson
Would you care to explain to the rest of the list how you intend to use 
mysql_error () to return connection failure information?

It returns the text of the error message from previous MySQL operation
Description: string mysql_error ( [resource link_identifier])

Seems to me that without a connection, we wouldn't have a valid 
link_identifier.

What you probably should attempt going for is getting something back 
from PHP itself regarding the error returned when the mysql_connect failed.

Here's a snippet from: 
http://www.php.net/manual/en/language.operators.errorcontrol.php

If the track_errors feature is enabled, any error message generated by 
the expression will be saved in the global variable $php_errormsg. This 
variable will be overwritten on each error, so check early if you want 
to use it.

Hope that clears things up a bit.

Regards,
Jason k Larson



Hans Prins wrote:
did you try:
print mysql_error();

"Ml" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...





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




Fw: [PHP] Re: Mysql DB connect failure

2003-02-21 Thread Rick Emery
$db = mysql_pconnect("localhost", "test1", "test1") or die(mysql_error());

- Original Message - 
From: "ML" <[EMAIL PROTECTED]>
To: <>
Sent: Friday, February 21, 2003 9:33 AM
Subject: [PHP] Re: Mysql DB connect failure


Where exactly would I put the print mysql_error() ?
Here is the code...






");





"Hans Prins" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> did you try:
> print mysql_error();
>
> "Ml" <[EMAIL PROTECTED]> schreef in bericht
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Currently I have some php code that displays a message if a connect to
my
> > database fails. Is there anyway I
> > can get a more descriptive error message? So I can see exactly why my
php
> > can't connect to the Database?
> > I am pretty sure that the username and password are correct and the
> username
> > exists as a mysql user...
> >
> >
> >
>
>



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




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




[PHP] Re: Mysql DB connect failure

2003-02-21 Thread ML
Where exactly would I put the print mysql_error() ?
Here is the code...






");





"Hans Prins" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> did you try:
> print mysql_error();
>
> "Ml" <[EMAIL PROTECTED]> schreef in bericht
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Currently I have some php code that displays a message if a connect to
my
> > database fails. Is there anyway I
> > can get a more descriptive error message? So I can see exactly why my
php
> > can't connect to the Database?
> > I am pretty sure that the username and password are correct and the
> username
> > exists as a mysql user...
> >
> >
> >
>
>



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




[PHP] Re: Mysql DB connect failure

2003-02-21 Thread Hans Prins
did you try:
print mysql_error();

"Ml" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Currently I have some php code that displays a message if a connect to my
> database fails. Is there anyway I
> can get a more descriptive error message? So I can see exactly why my php
> can't connect to the Database?
> I am pretty sure that the username and password are correct and the
username
> exists as a mysql user...
>
>
>



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




Re: [PHP] Re: MySQL for storing PHP code

2003-02-10 Thread Tom Rogers
Hi,

Tuesday, February 11, 2003, 7:39:16 AM, you wrote:
DP> Thanks for the comments everyone! eval() has just made my day :)

DP> Cheers,
DP> Daniel


DP> "Daniel Page" <[EMAIL PROTECTED]> a écrit dans le message de news:
DP> [EMAIL PROTECTED]
>> Hi,
>>
>> Would it be possible to store PHP code in a MySQL table, then via a web
>> page, connect to the DB, recover the code that corresponds to a certain id
>> number, then include that code for execution?
>>
>> For example (quick, dirty, and untested!):
>>
>> $sql = "SELECT phpcode FROM phpstorage WHERE codeid = 1";
>> $result = mysql_query($sql);
>> $_php_code = mysql_result($result, 0,"phpcode");
>> echo $_php_code;
>>
>> Will the echo (or print() ) just output code that can be read by the
DP> reader
>> of the page, or will it generate output that will be executed?
>>
>> If the echo/print does not work, is there another way to do this?
>>
>> Cheers,
>> Daniel
>>
>>

Be aware that it could also ruin your life :)
It would be a good idea to store an encrypted checksum of the code to ensure it
has not been tampered with as eval will do exactly what it is told to do.

-- 
regards,
Tom


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




[PHP] Re: MySQL for storing PHP code

2003-02-10 Thread Daniel Page
Thanks for the comments everyone! eval() has just made my day :)

Cheers,
Daniel


"Daniel Page" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> Hi,
>
> Would it be possible to store PHP code in a MySQL table, then via a web
> page, connect to the DB, recover the code that corresponds to a certain id
> number, then include that code for execution?
>
> For example (quick, dirty, and untested!):
>
> $sql = "SELECT phpcode FROM phpstorage WHERE codeid = 1";
> $result = mysql_query($sql);
> $_php_code = mysql_result($result, 0,"phpcode");
> echo $_php_code;
>
> Will the echo (or print() ) just output code that can be read by the
reader
> of the page, or will it generate output that will be executed?
>
> If the echo/print does not work, is there another way to do this?
>
> Cheers,
> Daniel
>
>



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




[PHP] Re: Mysql Select

2003-02-09 Thread andraskende
> Hello,
>
> Can anyone help me with this simple query:
>
> I want to limit to 1 the same names returned from the query like:
>
> 
>
> FROM:
>
> SELECT gallery.design FROM gallery
>
> buffet
> buffet
> buffet
> buffet
> barstools
> barstools
> barstools
> barstools
> barstools
> barstools
> barstools
> barstools
> tables
> tables
> tables
>
> 
>
> TO:
>
> SELECT gallery.design FROM gallery ??
>
> buffet
> barstools
> tables
>
>
> THANKS !!
>
> Andras Kende
> [EMAIL PROTECTED]




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




[PHP] Re: mysql auto increment question

2003-02-07 Thread Justin Garrett
http://www.php.net/manual/en/function.mysql-insert-id.php

Justin Garrett

"Van Andel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
m...
I have an application that updates two MySQL database tables.  One table has
an auto_increment id field.  I need to use this id to link to an entry in
the other table.  Is there an easy way to find out what the auto_incremented
number is so I can use it to update the other table?

Robbert van Andel





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




Re: [PHP] Re: MySQL/PHP Associative Array Insert

2003-02-03 Thread michael kimsal
Chris Shiflett wrote:

--- Cditty <[EMAIL PROTECTED]> wrote:


A co-worker is teaching me to move to the next level
in php. I have started using associative arrays for my
scripts, but I am having a problem using them to do an
insert into MySQL. Can someone give me an example of
how to do an insert to the database using these arrays?
My array is this...$item['itemID']



Using arrays is easy. For example:

$sql = "insert into blah (foo) values('";
$sql .= $item['item_id'];
$sql .= "')";

It isn't necessary for that to span three lines, but my
mail client will annihilate it otherwise. Just use
concatenation (.) to make things easy on yourself instead
of embedding your variable in the string (possible with
curly braces).

Of course, if you want to do it the cool way (which is what
your co-worker probably wants), look at Mr. Kimsal's
example:



(That's what I figured the co-worker was after, with the 'next level'
bit)


--- michael kimsal <[EMAIL PROTECTED]> wrote:






The only problem here is that there is no table name, which
is easily remedied. You probably want to pass the table
name as another argument. Also, use "replace into" for an
elegant way to insert the record if it does not exist
(based on whether your where clause matches) or update the
record if it does. Mr. Kimsal mentioned later in his
explanation I believe.


GOOD CALL - sorry - shouldn't have been trying to do
that so late at night.  :)




You can eliminate the slashadd() function and the
array_walk() call if you make sure your values are properly
escaped. If magic_quotes is on, you definitely want to
avoid the extra slashes, and it might be worth checking
whether it is on in your script, so that you don't depend
on any specific PHP configuration.


Yeah, I was going to mention about that too, but I figured
someone looking at the code might just assume that
I hadn't thought about the slash issue.  :)


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




Re: [PHP] Re: MySQL/PHP Associative Array Insert

2003-02-02 Thread Chris Shiflett
--- Cditty <[EMAIL PROTECTED]> wrote:
> A co-worker is teaching me to move to the next level
> in php. I have started using associative arrays for my
> scripts, but I am having a problem using them to do an
> insert into MySQL. Can someone give me an example of
> how to do an insert to the database using these arrays?
> My array is this...$item['itemID']

Using arrays is easy. For example:

$sql = "insert into blah (foo) values('";
$sql .= $item['item_id'];
$sql .= "')";

It isn't necessary for that to span three lines, but my
mail client will annihilate it otherwise. Just use
concatenation (.) to make things easy on yourself instead
of embedding your variable in the string (possible with
curly braces).

Of course, if you want to do it the cool way (which is what
your co-worker probably wants), look at Mr. Kimsal's
example:

--- michael kimsal <[EMAIL PROTECTED]> wrote:
>  $x['name'] = "Mike's";
> $x['phone'] = 'fsdlfksdf';
> echo sql($x);
> 
> function sql($a) {
>   $k = implode(",",array_keys($a));
>   array_walk($a,'slashadd');
>   $v = "'".implode("','",$a)."'";
>   return "insert into ($k) values ($v)";
> }
> function slashadd(&$bar) { $bar = addslashes($bar); }
> ?>

The only problem here is that there is no table name, which
is easily remedied. You probably want to pass the table
name as another argument. Also, use "replace into" for an
elegant way to insert the record if it does not exist
(based on whether your where clause matches) or update the
record if it does. Mr. Kimsal mentioned later in his
explanation I believe.

You can eliminate the slashadd() function and the
array_walk() call if you make sure your values are properly
escaped. If magic_quotes is on, you definitely want to
avoid the extra slashes, and it might be worth checking
whether it is on in your script, so that you don't depend
on any specific PHP configuration.

Finally, since this only builds your SQL statement, you can
enhance your function to execute the query for you (you
might want to add another argument for the database name)
and return true or false indicating success or failure.

Have fun, and tell your co-worker hello.

Chris

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




[PHP] Re: MySQL/PHP Associative Array Insert

2003-02-02 Thread michael kimsal
Cditty wrote:

A co-worker is teaching me to move to the next level in php. I have
started using associative arrays for my scripts, but I am having a problem
using them to do an insert into MySQL. Can someone give me an example of
how to do an insert to the database using these arrays? My array is
this...$item['itemID']


If you want to go up to even another level:



Now all you need to do is pass more info to the $x
array, and it'll make the insert SQL for you,
including adding the slashes, and you don't need to
worry about { } or where to put quotes and backslashes
and all that crap.  1 column or 50 columns
is absolutely no more work for you.

Modify it just slightly some by using REPLACE with
MySQL and you've got updates and inserts taken care
of.

PLUG: That's the sort of thing we get up to during our
PHP Training Courses.  More info at http://tapinternet.com/php


Michael Kimsal
http://phpappserver.com
http://www.phphelpdesk.com
734-480-9961


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




[PHP] Re: MySQL/PHP Associative Array Insert

2003-02-01 Thread Thomas Seifert
On Sat, 01 Feb 2003 10:26:10 -0600 [EMAIL PROTECTED] (Cditty) wrote:

> A co-worker is teaching me to move to the next level in php. I have
> started using associative arrays for my scripts, but I am having a problem
> using them to do an insert into MySQL. Can someone give me an example of
> how to do an insert to the database using these arrays? My array is
> this...$item['itemID']

try something like that:


mysql_query("INSERT INTO items SET itemcolumn='".$item['itemID']."'");

or just

mysql_query("INSERT INTO items (itemcolumn) VALUES('".$item['itemID']."')");



Regards,

-- 
Thomas Seifert

mailto:[EMAIL PROTECTED]
http://www.MyPhorum.de 

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




[PHP] Re: MySQL 4.0 + PHP 4

2003-01-22 Thread Thomas Seifert
I'm running it in production since MySQL-4.0.2 and without any problems.



Thomas

On Wed, 22 Jan 2003 11:21:40 -0800 [EMAIL PROTECTED] (Joe Stump) wrote:

> Anyone out there have anything to share as to using PHP4+MySQL4. I've been
> hearing good things on the MySQL list about v4.0 and I'm thinking of
> upgrading, since I run a rather small server.
> 
> Thanks!
> 
> 
> --Joe
> 
> ps. PHP list responders please respond directly. I'm not currently
> subscribed.
> 
> --
> Joe Stump <[EMAIL PROTECTED]>
> http://www.joestump.net
> 
> 


-- 
Thomas Seifert

mailto:[EMAIL PROTECTED]
http://www.MyPhorum.de 

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




[PHP] Re: MySQL

2002-12-25 Thread Mike Mannakee
Perhaps setting the ini file socket info is bypassing php using the tcp port
directly.  It should be going 'through' tcp/ip to get at the port mysql is
listening to and they talk through there.  I'm on a windows box and have
limited experience with unix implementations, but on the one linux box I did
get up and running I don't think I had set the php.ini to any sockets.  Try
commenting out the line.

If you can get the sql error number and message it will also help you
determine what's up.

Mike


<[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm having some problems with MySQL.  PHP just isn't working with it.
> I'm running Apache 1.3.27 with PHP 4.2.3 and MySQL 3.23.49 on OpenBSD 3.2.
> Apache and PHP were compiled with source (PHP was configured with
> --with-mysql and --with-apxs), and MySQL was installed from a package.
> I can connect to MySQL via the command-line interface, but not via PHP.
> phpBB always reports "cannot connect to database".  I've checked the
> permissions and everything, and it all should work.
> I've also set the mysql socket in php.ini to /var/run/mysql/mysql.sock
> because that's where it is.
>
> Thanks,
> Parry60



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




[PHP] Re: MySQL ?

2002-12-05 Thread Bastian Vogt
Hi,

use mysql_list_tables();

HTH,
Bastian

Hacook schrieb:

> I am really sorry but i can't find any good mySQL good mailing list...
>
> How can i make a little php function to check if a table exists ?
>
> Thanks a lot,
> Hacook


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




[PHP] Re: MySQL and PHP math problem...

2002-11-09 Thread Peter
Thanks...the thing that I did wrong was I retrieved the number with
FORMAT(SUM(amount), 2), which formats the number and return it in the string
format...so that's what happened during the computation (it only took the
number prior to the ','.  I miss the type-checking in C. :-)

Thanks,
-Peter
"@ Edwin" <[EMAIL PROTECTED]> wrote in message
news:20021109134728.65621.qmail@;pb1.pair.com...
> Hello,
>
> "Peter" <[EMAIL PROTECTED]> wrote in message
> news:20021109065959.35268.qmail@;pb1.pair.com...
>
> ...[snip]...
>
> > the result of echo, $tmp is displayed as '0.0002'.  What's wrong here?
> The
> > problem only occurs when the value is greater than a 1,000?  Could the
','
> > messed the computation up somehow?
>
> I think so because
>
>   1/5000 = 0.0002
>
> (Only the number *before* the ',' is being used.)
>
> Try taking away the ',' then by using str_replace() and calculate again.
>
> - E
>



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




[PHP] Re: MySQL and PHP math problem...

2002-11-09 Thread @ Edwin
Hello,
(B
(B"Peter" <[EMAIL PROTECTED]> wrote in message
(B[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
(B
(B...[snip]...
(B
(B> the result of echo, $tmp is displayed as '0.0002'.  What's wrong here?
(BThe
(B> problem only occurs when the value is greater than a 1,000?  Could the ','
(B> messed the computation up somehow?
(B
(BI think so because
(B
(B  1/5000 = 0.0002
(B
(B(Only the number *before* the ',' is being used.)
(B
(BTry taking away the ',' then by using str_replace() and calculate again.
(B
(B- E
(B
(B
(B-- 
(BPHP General Mailing List (http://www.php.net/)
(BTo unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: MySQL GMT --> Local time

2002-11-06 Thread Pete
This might help

http://www.mysql.com/doc/en/Date_and_time_functions.html

Here is an example that uses date functions. The following query selects 
all records with a date_col value from within the last 30 days:

mysql> SELECT something FROM tbl_name
   WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) <= 30;

Pete


Jason wrote:
My logging application is feeding a MySQL database with data records
that are time stamped with GMT time.  I would like to query the database
for records matching local time(eg. all records created on oct
17,2002 local time).  I would prefer if the records could be formated
in local time when returned from MySQL.  What is the best way to do this.

Jason








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




[PHP] Re: Mysql not functioning after upgrade to 4.2.3

2002-11-05 Thread ceo
[PLEASE do NOT reply-all to this message!]

> Richard -
> I hired Richard Lynch ([EMAIL PROTECTED]) to fix it for me and he did. It
> appeared to be problems created by the new version of PHP and he had to
> tweak some things to make it work. I'd talk to him.
> Jeff
>  Richard <[EMAIL PROTECTED]> wrote:Did you ever figure this out as I am
> having the same problems.

If you are stuck on the "mailparse" thing, start with this tid-bit:
[If you don't need mailparse, and just are stuck with MySQL, skim down a bit]
-
Aha!
mailparse has been turned into a PEAR module.

We needed to do:

http://pear.php.net/manual/en/faq.install-pecl.php

The buildconf step (see URL contents) required libtool 1.4.3, but you only
had 1.3.5, so I upgraded that.

--

After that, it was the usual game of [re-]installing and [re-]configuring
and [re-]compiling enough things from source so PHP could find all the
headers and be happy.

[Well, that's *my* usual game-plan.  I'm sure somebody must actually LIKE
rpms enough to fight with them all the time...]

I believe we ended up making MySQL, PHPLib (?), and at least one other PHP
Module static (IE, got rid of --with-XXX=shared,/path/path/path and used
--with-XXX=/path/path/path) to make everything happy.  I know for sure we
got rid of MySQL "shared," and I'm pretty sure one other one had to go
when all was said and done.

As a rule, if something is broken, trying the "static" (or, more rarely,
"shared") instead of shared (static, respectively) tends to do wonders.

Here is the final "configure" file we used:
./configure i386-redhat-linux \
--with-prefix=/usr  \
--exec-prefix=/usr  \
--bindir=/usr/bin  \
--sbindir=/usr/sbin  \
--sysconfdir=/etc  \
--datadir=/usr/share  \
--includedir=/usr/include  \
--libexecdir=/usr/libexec \
--libdir=/usr/lib \
--localstatedir=/var  \
--sharedstatedir=/usr/com  \
--mandir=/usr/share/man  \
--infodir=/usr/share/info  \
--prefix=/usr  \
--with-config-file-path=/etc  \
--enable-force-cgi-redirect  \
--disable-debug  \
--disable-rpath  \
--with-db3  \
--with-exec-dir=/usr/bin  \
--with-png-dir=/usr  \
--with-gd  \
--enable-gd-native-ttf  \
--with-ttf  \
--with-gdbm  \
--with-gettext  \
--with-ncurses  \
--with-gmp  \
--with-iconv  \
--with-jpeg-dir=/usr  \
--with-openssl  \
--with-png  \
--with-zlib \
--with-ftp  \
--with-layout=GNU  \
--enable-bcmath  \
--enable-magic-quotes  \
--enable-sockets  \
--enable-sysvsem  \
--enable-sysvshm  \
--enable-track-vars  \
--enable-trans-sid  \
--enable-wddx  \
--without-oci8  \
--with-imap=shared   \
--with-imap-ssl  \
--with-kerberos=/usr/kerberos  \
--with-mysql=/usr  \
--enable-memory-limit  \
--enable-bcmath  \
--enable-shmop  \
--enable-calendar  \
--enable-dbx  \
--with-curl=/usr  \
--with-apxs=/usr/sbin/apxs \
--with-pdflib=/usr \
--enable-mbstring \
--enable-mailparse

Oh, and we had to add the path to the MySQL "Libraries" by hand to the
Makefile every time:

After "configure" and before "make" alter the file "Makefile" line that says:

LTLIBRARY_LIBADD = $(LTLIBRARY_DEPENDENCIES) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS)

to be:

LTLIBRARY_LIBADD = $(LTLIBRARY_DEPENDENCIES) $(EXTRA_LIBS)
$(ZEND_EXTRA_LIBS) -L/usr/lib/mysql
(that's all one line)

Of course, if your MySQL installation isn't *IN* /usr/lib/mysql, you may
not need this, and/or you may need a different path instead of
/usr/lib/mysql.  The point is to point "make" in the general direction of
being able to find your mysql.so files, wherever they may be.

[I sometimes wish "configure" would just do an "updatedb; locate foo" for
everything it needs, and then prompt me with a menu for anything it finds
two of...  Might take longer to compile, but at least I'd know it found
everything I wanted it to.]

For the ./configure above:
Your mileage may vary.
Your paths almost certainly will. :-)

After reporting the -L part as a bug, Sascha (configure god) said to try
the CVS version -- I didn't though, since I didn't want to bring down
Jeff's live server to try it, and don't have the box/time/knowledge to try
create another with exactly the same setup...

I'm cc-ing PHP-General, so this info may help out others in the future.

[REMINDER: PLEASE do not Reply-All to this message!]

Disclaimer:  I get PHP to compile more the Sam Spade way than the Sherlock
Holmes.  Just sort of start stomping around like a bull in a china shop
and pull at any threads that come loose until there's nothing left
breaking. :-)  Sacrificing rubber chickens seems to help too.




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




Re: [PHP] Re: MySQL back up

2002-10-10 Thread Ken

Okay, I took out all the reason for error, I took the variables out of the
code and replaced them with the actual values. I do not execute the gzip
function. All I get is an empty file. Also I made sure the back up directory
is set to 777.

Now phpMySQLAdmin will perform the same function, so there must be a way to
do this without the phpMySQLAdmin program? Has anyone tried to do what I am
trying to do? Has anyone tried with this code?

One more thing, I borrowed a free script written in perl that uses mysqldump
and it worked. The point here is that I want this to work in PHP so I can
include this code in a bigger application I am writing.

Thanks for all your ideas!


"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
01c27058$c1770170$7c02a8c0@coconut">news:01c27058$c1770170$7c02a8c0@coconut...
> > Okay here is the new code and this is still not working.
> >
> >  >
> > require("./config.php");
> >
> > $sqlserver = $server1;
> > $sqlusername = $username1;
> > $sqlpassword = $password1;
> > $sqldatabase = $database1;
> >
> > //**
> > $nam_bak=date('D,d-m-Y');
>
> Can you have a filename with a comma in it?
>
> > exec("mysqldump -u\"$sqlusername\" -p\"$sqlpassword\" \"$sqldatabase\"
> >
> > $backupdir/$nam.sql");
>
> Take out the \" quotes around username, password, and database.
>
> >
> > exec("gzip $backupdir/$nam.sql");
>
> ---John Holmes...
>
>



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




RE: [PHP] Re: MySQL back up

2002-10-10 Thread Daniel Masson

Ken ..

You have to replace

exec("mysqldump -u\"$sqlusername\" -p\"$sqlpassword\" \"$sqldatabase\" >
$backupdir/$nam.sql");

With this

exec("mysqldump -u \"$sqlusername\" --password=\"$sqlpassword\"
\"$sqldatabase\" > $backupdir/$nam.sql");

Please not the space after -u

And i agree owen about

2. $backupdir MUST BE writeable by apache

IT HAS TO WORK MAN !!


Cordialmente
Daniel Massón => Ingeniero de desarollo
[EMAIL PROTECTED]
www.imagine.com.co
Tels: (57)(1) 2182064 - 6163218
Bogotá - Colombia

- Soluciones web para internet e intranet
- Asesoría y Soporte Técnico
- Licenciamiento de Software 
 



-Mensaje original-
De: Ken [mailto:[EMAIL PROTECTED]] 
Enviado el: miércoles, 09 de octubre de 2002 22:36
Para: [EMAIL PROTECTED]
Asunto: Re: [PHP] Re: MySQL back up


Okay here is the new code and this is still not working.


$backupdir/$nam.sql");

exec("gzip $backupdir/$nam.sql");

?>



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



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




RE: [PHP] Re: MySQL back up

2002-10-10 Thread John W. Holmes

> Okay here is the new code and this is still not working.
> 
>  
> require("./config.php");
> 
> $sqlserver = $server1;
> $sqlusername = $username1;
> $sqlpassword = $password1;
> $sqldatabase = $database1;
> 
> //**
> $nam_bak=date('D,d-m-Y');

Can you have a filename with a comma in it?

> exec("mysqldump -u\"$sqlusername\" -p\"$sqlpassword\" \"$sqldatabase\"
>
> $backupdir/$nam.sql");

Take out the \" quotes around username, password, and database.

> 
> exec("gzip $backupdir/$nam.sql");

---John Holmes...



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




Re: [PHP] Re: MySQL back up

2002-10-09 Thread Owen Prime

Haven't really been following this thread but you may want to make sure that

1. mysqldump & gzip are executable by apache
2. $backupdir is writeable by apache
3. You have taken into consideration your php safe mode settings

Cheers,

Owen Prime
http://www.noggin.com.au

Ken wrote:

> Okay here is the new code and this is still not working.
> 
>  
> require("./config.php");
> 
> $sqlserver = $server1;
> $sqlusername = $username1;
> $sqlpassword = $password1;
> $sqldatabase = $database1;
> 
> //**
> $nam_bak=date('D,d-m-Y');
> 
> exec("mysqldump -u\"$sqlusername\" -p\"$sqlpassword\" \"$sqldatabase\" >
> $backupdir/$nam.sql");
> 
> exec("gzip $backupdir/$nam.sql");
> 
> ?>


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




Re: [PHP] Re: MySQL back up

2002-10-09 Thread Ken

Okay here is the new code and this is still not working.


$backupdir/$nam.sql");

exec("gzip $backupdir/$nam.sql");

?>



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




RE: [PHP] Re: MySQL back up

2002-10-09 Thread Daniel Masson

I agree everything, but
Im not very sure if this is going to work:

 > $backup=@passthru("mysqldump --opt \"$sqldatabase\" > 
 > $backupdir/$nam.sql");

 You need to send mysqldump the username and password. Syntax is


 Mysqldump -uuser -ppassword databasename > filename.sql

Y think tou should use:

Mysqldump -u user --password user_password > filename.sql

I had an expirience with perl trying like John "mysqldump -uuser
-ppassword databasename > filename.sql" did not work, i think you have
to send the password too.


Regards.
Daniel


> -Original Message-
> From: Ken [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, October 09, 2002 7:25 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: MySQL back up
> 
> Here is the code I tired to use:
> 
>  
> session_start();

You don't need to start a session...

> require("./config.php");
> 
> $sqlserver = $server1;
> 
> $sqlusername = $username1;
> 
> $sqlpassword = $password1;
> 
> $sqldatabase = $database1;
> 
> $nam=date('D,d-m-Y');
> 
> @ $db = mysql_pconnect($sqlserver, $sqlusername, $sqlpassword);

You don't need to connect to the mysql server.

> 
> if (!$db)
> 
> {
> 
> echo "Could not connect to MySQL";
> 
> exit;
> 
> }
> 
> $backup=@passthru("mysqldump --opt \"$sqldatabase\" > 
> $backupdir/$nam.sql");

You need to send mysqldump the username and password. Syntax is 

Mysqldump -uuser -ppassword databasename > filename.sql

> passthru("gzip $backupdir/$nam.sql");

Why are you using passthru? Neither of these commands should return any
output, so passthru isn't returning anything. You can use backticks or
exec() instead.

---John Holmes...



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



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




RE: [PHP] Re: MySQL back up

2002-10-09 Thread John W. Holmes



> -Original Message-
> From: Ken [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, October 09, 2002 7:25 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: MySQL back up
> 
> Here is the code I tired to use:
> 
>  
> session_start();

You don't need to start a session...

> require("./config.php");
> 
> $sqlserver = $server1;
> 
> $sqlusername = $username1;
> 
> $sqlpassword = $password1;
> 
> $sqldatabase = $database1;
> 
> $nam=date('D,d-m-Y');
> 
> @ $db = mysql_pconnect($sqlserver, $sqlusername, $sqlpassword);

You don't need to connect to the mysql server.

> 
> if (!$db)
> 
> {
> 
> echo "Could not connect to MySQL";
> 
> exit;
> 
> }
> 
> $backup=@passthru("mysqldump --opt \"$sqldatabase\" >
> $backupdir/$nam.sql");

You need to send mysqldump the username and password. Syntax is 

Mysqldump -uuser -ppassword databasename > filename.sql

> passthru("gzip $backupdir/$nam.sql");

Why are you using passthru? Neither of these commands should return any
output, so passthru isn't returning anything. You can use backticks or
exec() instead.

---John Holmes...



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




[PHP] Re: MySQL back up

2002-10-09 Thread Ken

Here is the code I tired to use:

 $backupdir/$nam.sql");

passthru("gzip $backupdir/$nam.sql");

?>




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




[PHP] Re: MySQL back up

2002-10-08 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Hi All!
> 
> Anyone know how to code the MySQL command in PHP to make the database script
> download to your local hard disk, without writing 100 lines of code?
> 
> I tried the mysqldump without any luck, but I think there is an easy way to
> do it, just not sure how to code it.
> 
> Thanks in advance!

passthru and mysqldump should be able to do that for you - perhaps if you 
were to show the code you tried, someone might be able to suggest 
improvements.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




RE: [PHP] Re: MySQL back up

2002-10-08 Thread John W. Holmes

> Why don't you just do a hard backup of the files from the db. Find out
the
> location of the data folder where thd db saves its tables, perform a
tar
> cvzf data_folder and then pipe it directly to the user for download
via
> http.
> 
> Havent tryed it that way, but should work. Another thing would be
reoback
> which is a perl script. You should be able to perform this backup via
ftp
> controled by a daily cron job.


You'll have to shut down the database to do it this way, though.

---John Holmes...



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




[PHP] Re: MySQL back up

2002-10-08 Thread Andy

Why don't you just do a hard backup of the files from the db. Find out the
location of the data folder where thd db saves its tables, perform a tar
cvzf data_folder and then pipe it directly to the user for download via
http.

Havent tryed it that way, but should work. Another thing would be reoback
which is a perl script. You should be able to perform this backup via ftp
controled by a daily cron job.

Hope this helps,

Andy

--
--
http://www.globosapiens.net
Worldwide Travel Community



"Ken" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi All!
>
> Anyone know how to code the MySQL command in PHP to make the database
script
> download to your local hard disk, without writing 100 lines of code?
>
> I tried the mysqldump without any luck, but I think there is an easy way
to
> do it, just not sure how to code it.
>
> Thanks in advance!
>
>
>



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




Re: [PHP] Re: MySQL Problem

2002-10-03 Thread OrangeHairedBoy

Well, that's just a typo...of course there should be a () to make it call a
function...

The whole point to my postings is that I can't get the darn variable to stay
in place!!! Look where it says "Prints NOTHING".

Does anyone know why it doesn't print "Hello World"???

::Lewis


"Mike Ford" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > -Original Message-
> > From: OrangeHairedBoy [mailto:[EMAIL PROTECTED]]
> > Sent: 03 October 2002 09:39
> >
> > Here's a simplier version...and I'm still having a problem
> > with it. It's
> > driving me insane!!! :)
> >
> > class MySQL
> >  {
> >  function SET ( )
> >   {
> >   $this->MYVAR = "Hello World!";
> >   }
> >  function RETREIVE ( )
> >   {
> >   print $this->MYVAR;
> >   }
> >  }
> > $helpme = new MySQL;
> > $helpme->SET;
> > $helpme->RETREIVE; /* Prints NOTHING */
>
> I'm pretty sure you have to add () on the end of those function names to
get
> PHP to actually *call* the function, so you need:
>
>   $helpme->SET();
>   $helpme->RETREIVE();
>
> Without the parentheses, PHP evaluates the name of the function (returning
> its "handle"), but then doesn't know what to do with it so just throws it
> away on seeing the terminating semicolon.  As far as PHP is concerned, you
> could quite legitimately want to do something entirely different with the
> handle, such as assigning it to a variable -- PHP won't assume you want to
> call it as a function just because it happens to be a function name.  For
> instance, the following should work (I think! - although I haven't tested
> it):
>
>   $method = $helpme->SET;
>   $method();
>
> In fact, you can ask PHP to try and call anything as a function by
appending
> parentheses, so this should work too:
>
>   $method = "SET";
>   $helpme->$method();
>
>
> Cheers!
>
> Mike
>
> -
> Mike Ford,  Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211



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




RE: [PHP] Re: MySQL Problem

2002-10-03 Thread Ford, Mike [LSS]

> -Original Message-
> From: OrangeHairedBoy [mailto:[EMAIL PROTECTED]]
> Sent: 03 October 2002 09:39
> 
> Here's a simplier version...and I'm still having a problem 
> with it. It's
> driving me insane!!! :)
> 
> class MySQL
>  {
>  function SET ( )
>   {
>   $this->MYVAR = "Hello World!";
>   }
>  function RETREIVE ( )
>   {
>   print $this->MYVAR;
>   }
>  }
> $helpme = new MySQL;
> $helpme->SET;
> $helpme->RETREIVE; /* Prints NOTHING */

I'm pretty sure you have to add () on the end of those function names to get
PHP to actually *call* the function, so you need:

  $helpme->SET();
  $helpme->RETREIVE();

Without the parentheses, PHP evaluates the name of the function (returning
its "handle"), but then doesn't know what to do with it so just throws it
away on seeing the terminating semicolon.  As far as PHP is concerned, you
could quite legitimately want to do something entirely different with the
handle, such as assigning it to a variable -- PHP won't assume you want to
call it as a function just because it happens to be a function name.  For
instance, the following should work (I think! - although I haven't tested
it):

  $method = $helpme->SET;
  $method();

In fact, you can ask PHP to try and call anything as a function by appending
parentheses, so this should work too:

  $method = "SET";
  $helpme->$method();


Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




[PHP] Re: MySQL Problem

2002-10-03 Thread OrangeHairedBoy

Here's a simplier version...and I'm still having a problem with it. It's
driving me insane!!! :)

class MySQL
 {
 function SET ( )
  {
  $this->MYVAR = "Hello World!";
  }
 function RETREIVE ( )
  {
  print $this->MYVAR;
  }
 }
$helpme = new MySQL;
$helpme->SET;
$helpme->RETREIVE; /* Prints NOTHING */





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




Re: [PHP] Re: MySQL Problem

2002-10-03 Thread OrangeHairedBoy

I thought someone might mention that, but that is actually correct.

The problem is that the variable assigned on the line
$this->DBLink[$MyVars[NAME]] = mysql_connect( $MyVars[HOST] ,
$MyVars[USERNAME] , $MyVars[PASSWORD] ); dissapears and can't be retreived
on the line mysql_select_db( $MyVars[DATABASE] ,
$this->DBLink[$MyVars[LINK]] );.

For instance, if the first line saves $this->DBLink["TEST"], when CHOOSEDB
is called, the command PRINT $this->DBLink["TEST"] will print nothing when
the same line right after the variable is saved would produce something like
"Resource ID #38".

That's the brain twister.

Thanks though!


::Lewis

"Tom Rogers" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> Thursday, October 3, 2002, 6:01:53 PM, you wrote:
> O> You know...maybe I should mention where this code is...
>
> O> I have my main file which loads using 'require.once' a second file
called
> O> 'everything.php'.
>
> O> Inside everything.php is a class called 'mainclass' which is called by
the
> O> mail file.
>
> O> This class ('mainclass') loads the MySQL class from the previous post
which
> O> is stored in yet another file, using require.once.
>
> O> MainClass then calls the MySQL->CONNECT and MySQL->CHOOSEDB functions.
>
> O> I know this sounds a bit over the top, but it works...at least it
> O> did...until now. I thought I'd mention the circumstances in case that
makes
> O> a difference, which I suspect it will.
>
> O> Thanks again!
>
> O> Lewis
>
> O> "Orangehairedboy" <[EMAIL PROTECTED]> wrote in message
> O> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >> Hi everyone! I can't figure out why this doesn't work. The call to the
> >> CONNECT function works and it connects with no problem, and it does
save
> O> the
> >> Resource ID in $this->DBLink[]...however, when CHOOSEDB is called, the
> >> Resource ID just saved is gone. $this->DBLink is just empty, and I
can't
> >> figure out why...
> >>
> >> Can anyone offer insight on this one?
> >>
> >> class MySQL
> >>  {
> >>  var $DBLink = array();
> >>  function CONNECT ( $MyVars , $MyContents )
> >>   {
> >>   $host = ( $MyVars[PORT] ) ? $MyVars[HOST] . ":" . $MyVars[PORT] :
> >> $MyVars[HOST];
> >>   $this->DBLink[$MyVars[NAME]] = mysql_connect( $MyVars[HOST] ,
> >> $MyVars[USERNAME] , $MyVars[PASSWORD] );
> >>   }
> >>  function CHOOSEDB ( $MyVars , $MyContents )
> >>   {
> >>   mysql_select_db( $MyVars[DATABASE] , $this->DBLink[$MyVars[LINK]] );
> >>   }
> >>  }
> >>
> >>
> >> Thanks!
> >>
> >>
> >> Lewis
> >>
> >>
>
> Looks like you change the name of the index from NAME to LINK
> and it should be  $this->DBLink[$MyVars['LINK']]
>
> --
> regards,
> Tom
>



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




Re: [PHP] Re: MySQL Problem

2002-10-03 Thread Tom Rogers

Hi,

Thursday, October 3, 2002, 6:01:53 PM, you wrote:
O> You know...maybe I should mention where this code is...

O> I have my main file which loads using 'require.once' a second file called
O> 'everything.php'.

O> Inside everything.php is a class called 'mainclass' which is called by the
O> mail file.

O> This class ('mainclass') loads the MySQL class from the previous post which
O> is stored in yet another file, using require.once.

O> MainClass then calls the MySQL->CONNECT and MySQL->CHOOSEDB functions.

O> I know this sounds a bit over the top, but it works...at least it
O> did...until now. I thought I'd mention the circumstances in case that makes
O> a difference, which I suspect it will.

O> Thanks again!

O> Lewis

O> "Orangehairedboy" <[EMAIL PROTECTED]> wrote in message
O> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>> Hi everyone! I can't figure out why this doesn't work. The call to the
>> CONNECT function works and it connects with no problem, and it does save
O> the
>> Resource ID in $this->DBLink[]...however, when CHOOSEDB is called, the
>> Resource ID just saved is gone. $this->DBLink is just empty, and I can't
>> figure out why...
>>
>> Can anyone offer insight on this one?
>>
>> class MySQL
>>  {
>>  var $DBLink = array();
>>  function CONNECT ( $MyVars , $MyContents )
>>   {
>>   $host = ( $MyVars[PORT] ) ? $MyVars[HOST] . ":" . $MyVars[PORT] :
>> $MyVars[HOST];
>>   $this->DBLink[$MyVars[NAME]] = mysql_connect( $MyVars[HOST] ,
>> $MyVars[USERNAME] , $MyVars[PASSWORD] );
>>   }
>>  function CHOOSEDB ( $MyVars , $MyContents )
>>   {
>>   mysql_select_db( $MyVars[DATABASE] , $this->DBLink[$MyVars[LINK]] );
>>   }
>>  }
>>
>>
>> Thanks!
>>
>>
>> Lewis
>>
>>

Looks like you change the name of the index from NAME to LINK
and it should be  $this->DBLink[$MyVars['LINK']]

-- 
regards,
Tom


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




[PHP] Re: MySQL Problem

2002-10-03 Thread OrangeHairedBoy

You know...maybe I should mention where this code is...

I have my main file which loads using 'require.once' a second file called
'everything.php'.

Inside everything.php is a class called 'mainclass' which is called by the
mail file.

This class ('mainclass') loads the MySQL class from the previous post which
is stored in yet another file, using require.once.

MainClass then calls the MySQL->CONNECT and MySQL->CHOOSEDB functions.

I know this sounds a bit over the top, but it works...at least it
did...until now. I thought I'd mention the circumstances in case that makes
a difference, which I suspect it will.

Thanks again!

Lewis

"Orangehairedboy" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi everyone! I can't figure out why this doesn't work. The call to the
> CONNECT function works and it connects with no problem, and it does save
the
> Resource ID in $this->DBLink[]...however, when CHOOSEDB is called, the
> Resource ID just saved is gone. $this->DBLink is just empty, and I can't
> figure out why...
>
> Can anyone offer insight on this one?
>
> class MySQL
>  {
>  var $DBLink = array();
>  function CONNECT ( $MyVars , $MyContents )
>   {
>   $host = ( $MyVars[PORT] ) ? $MyVars[HOST] . ":" . $MyVars[PORT] :
> $MyVars[HOST];
>   $this->DBLink[$MyVars[NAME]] = mysql_connect( $MyVars[HOST] ,
> $MyVars[USERNAME] , $MyVars[PASSWORD] );
>   }
>  function CHOOSEDB ( $MyVars , $MyContents )
>   {
>   mysql_select_db( $MyVars[DATABASE] , $this->DBLink[$MyVars[LINK]] );
>   }
>  }
>
>
> Thanks!
>
>
> Lewis
>
>



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




Re: [PHP] Re: mysql timestamp and php date

2002-09-30 Thread Bryan Koschmann - GKT

This is what I am using here:

$db = DB::connect("mysql://$username:$password@$hostName/$databaseName");

if (DB::iserror($db))
die($db->getMessage());

$sql = "SELECT idnum, title, DATE_FORMAT(date, '%W, %M %D \@ %l:%i%p'),
news FROM newslist ORDER BY idnum DESC";

$query = $db->query($sql);
if (DB::iserror($query))
die($db->getMessage());

while ($query->fetchInto($row)) {
echo "\n" .
"\n\n\t$row[1] ID#$row[0]" .
"\n\n\tAdded $row[2]" .
"\n\n\t$row[3]" .
"\n";
}


I took out all the font formatting and stuff so its not so cluttered here.
but it works just dandy, although I know what you are talkng about, when
using the other way to connect it returns the name as whatever (like a
COUNT(*) does). Although, I never knew the AS var thing, so that will help
me with other stuff down the road!

I know this is nothing fancy, but it is just what I've been wanting to do
since before I started learning php and mysql. :)

Bryan

On Mon, 30 Sep 2002, Jason Young wrote:

|No  problem!
|
|Refresh MY memory here.. I noticed you didn't return the DATE_FORMAT
|column "AS " .. is that working okay? I seemed to think that it
|returned a long unwieldy column name.. maybe things are good.. let me
|know :-D
|
|--Jason
|


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




Re: [PHP] Re: mysql timestamp and php date

2002-09-30 Thread Jason Young

No  problem!

Refresh MY memory here.. I noticed you didn't return the DATE_FORMAT 
column "AS " .. is that working okay? I seemed to think that it 
returned a long unwieldy column name.. maybe things are good.. let me 
know :-D

--Jason

Bryan Koschmann - Gkt wrote:
> Hi Jason,
> 
> I had come across this earlier, and while I can get it to return
> perfectly, I was more looking for something that I could do without having
> to pull 2 queries. Err, well wait, I wouldn't have to would I? I have 4
> columns:
> 
> idnum, title, date, news
> 
> I was just doing a select * from newlist, but I suppose I can just address
> each specifically:
> 
> select idnum, title, DATE_FORMAT(date, '%W, %M %D \@ %h:%i%p'), news from
> newslist
> 
> right? Okay that works.
> 
> (don't mind me talking to myself)
> 
> Thanks for the help, and making me take a second to look further at it!
> 
>   Bryan
> 
> 
> On Mon, 30 Sep 2002, Jason Young wrote:
> 
> |In my pages, I just format the date from the SQL query:
> |
> |"SELECT DATE_FORMAT(last_modified, '%m/%d/%Y %h:%i:%s %p') AS
> |last_modified (...)"
> |
> |Look up the DATE_FORMAT on mysql.com to get a list of the arguments.
> |
> |Hope this helps!
> |-Jason
> |
> 


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




Re: [PHP] Re: mysql timestamp and php date

2002-09-30 Thread Bryan Koschmann - GKT

Hi Jason,

I had come across this earlier, and while I can get it to return
perfectly, I was more looking for something that I could do without having
to pull 2 queries. Err, well wait, I wouldn't have to would I? I have 4
columns:

idnum, title, date, news

I was just doing a select * from newlist, but I suppose I can just address
each specifically:

select idnum, title, DATE_FORMAT(date, '%W, %M %D \@ %h:%i%p'), news from
newslist

right? Okay that works.

(don't mind me talking to myself)

Thanks for the help, and making me take a second to look further at it!

Bryan


On Mon, 30 Sep 2002, Jason Young wrote:

|In my pages, I just format the date from the SQL query:
|
|"SELECT DATE_FORMAT(last_modified, '%m/%d/%Y %h:%i:%s %p') AS
|last_modified (...)"
|
|Look up the DATE_FORMAT on mysql.com to get a list of the arguments.
|
|Hope this helps!
|-Jason
|


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




[PHP] Re: mysql timestamp and php date

2002-09-30 Thread Jason Young

In my pages, I just format the date from the SQL query:

"SELECT DATE_FORMAT(last_modified, '%m/%d/%Y %h:%i:%s %p') AS 
last_modified (...)"

Look up the DATE_FORMAT on mysql.com to get a list of the arguments.

Hope this helps!
-Jason

Bryan Koschmann - Gkt wrote:
> Hello,
> 
> I have a table with timestamps in mysql. The timestamps of course are in
> the format of 20020930014535 but I would like to format the output as
> this:
> 
> date("l F jS H:i:s", $last_modified)
> 
> What is the simplest way to do this? I see there are a few ways to convert
> it, but I was hoping for something easy (i.e. any built in functions that
> I missed).
> 
> Thanks!
> 
>   Bryan
> 


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




Re: [PHP] Re: MySQL > Access

2002-09-20 Thread Liam MacKenzie

Thanks.

That's fine, it's either $55 for this or a couple of hundred to pay someone
to do it manually.

Go figure  ;-)

Cheers,
Liam


- Original Message -
From: "M1tch" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 21, 2002 3:51 AM
Subject: [PHP] Re: MySQL > Access


I had the problem a few days ago.

Here's some software that makes it easy as clicking a button ->
http://www.convert-in.com/sql2acc.htm

Be warned though, it's only free to copy table structure. It requires
registration to copy data.


"Christian Calloway" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Can anyone suggest a strategy for importing data from MySQL to Access (it
> sucks I know, but I have to do it for my work). I was thinking of using a
> text-delimited file as an intermediate, but I am not quite sure on the
> logistics.
>
>



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







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




[PHP] Re: MySQL > Access

2002-09-20 Thread M1tch

I had the problem a few days ago.

Here's some software that makes it easy as clicking a button ->
http://www.convert-in.com/sql2acc.htm

Be warned though, it's only free to copy table structure. It requires
registration to copy data.


"Christian Calloway" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Can anyone suggest a strategy for importing data from MySQL to Access (it
> sucks I know, but I have to do it for my work). I was thinking of using a
> text-delimited file as an intermediate, but I am not quite sure on the
> logistics.
>
>



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




[PHP] Re: MySQL > Access

2002-09-20 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Can anyone suggest a strategy for importing data from MySQL to Access (it
> sucks I know, but I have to do it for my work). I was thinking of using a
> text-delimited file as an intermediate, but I am not quite sure on the
> logistics.

Google is your friend. Try 
http://www.google.co.nz/search?q=convert+access+to+mysql

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: MySQL > Access

2002-09-20 Thread Erwin

Christian Calloway wrote:
> Can anyone suggest a strategy for importing data from MySQL to Access
> (it sucks I know, but I have to do it for my work). I was thinking of
> using a text-delimited file as an intermediate, but I am not quite
> sure on the logistics.

You can use the Mysql-ODBC driver, which can be downloaded from
www.mysql.com, and then import the tables with access

Grtz
Erwin


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




[PHP] Re: MySQL errors in newer PHP 4.2.3

2002-09-19 Thread Jocelyn Fournier

Hi Steven,

Some precisions : after taking a look at my mail, I noticed the very first
time I saw this error was with PHP 4.2.1 and MySQL 4.0.2 (reported on this
list on 27 june 2002).

Regards,
  Jocelyn
- Original Message -
From: "Steven Roussey" <[EMAIL PROTECTED]>
To: "'Jocelyn Fournier'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Cc: "'Mysql'" <[EMAIL PROTECTED]>
Sent: Friday, September 20, 2002 2:38 AM
Subject: RE: MySQL errors in newer PHP 4.2.3


> Hmm, do you use pconnect or connect?
>
> I noticed someone changed our PHP script to use persistent connections
> (likely why the server is running slower). I am wondering if a cancelled
> connection is being reused or if it just is a more general bug in the
> mysql client code in PHP
>
> Sincerely,
> Steven Roussey
> http://Network54.com/?pp=e
>
> > -Original Message-
> > From: Jocelyn Fournier [mailto:[EMAIL PROTECTED]]
> >
> > Hi,
> >
> > Same problem for me, although it was already here with 4.2.0 for me
> (well
> > it
> > seems to be also a high QPS problem...). The problem seems to
> disappear
> > with
> > an apache restart, but sometimes appear again randomly.
> >
> > Regards,
> >   Jocelyn
> >
> > - Original Message -
> > From: "Steven Roussey" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Cc: "Mysql" <[EMAIL PROTECTED]>
> > Sent: Friday, September 20, 2002 2:14 AM
> > Subject: MySQL errors in newer PHP 4.2.3
> >
> >
> > > Since updating to 4.2.3, we have been getting intermittent errors of
> > > "Commands out of sync". Anyone else see this?
> > >
> > > Sincerely,
> > > Steven Roussey
> > > http://Network54.com/?pp=e
> > >
> > > php,sql,query
> > >
> > >
> > >
> -
> > > Before posting, please check:
> > >http://www.mysql.com/manual.php   (the manual)
> > >http://lists.mysql.com/   (the list archive)
> > >
> > > To request this thread, e-mail <[EMAIL PROTECTED]>
> > > To unsubscribe, e-mail
> > <[EMAIL PROTECTED]>
> > > Trouble unsubscribing? Try:
> http://lists.mysql.com/php/unsubscribe.php
> > >
> > >
> > >
> > >
>
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>
>


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




[PHP] Re: MySQL errors in newer PHP 4.2.3

2002-09-19 Thread Zak Greant

Hello Jocelyn and Steven,

Could either or both of you submit a bug report at http://bugs.php.net/? If 
you follow the instructions there, it will greatly help us in tracking down 
the issue!

Cheers!

Zak Greant
PHP QA Team


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




<    1   2   3   4   >