[PHP-DB] MySQL and apostrophes, interesting problem. 42082

2002-03-10 Thread Nick Patsaros

I'm working with a simple form which submits field
data to a MySQL database.  This is for the purpose of
generating a dynamic news page for my site. 
Interestingly enough I've found that any time I try to
submit data that contains an apostrophe ' it gives
me an error and will not send the data (any of it) to
the database. 

How can I change my database query, or escape out
apostrophes?  I'm looking for the easiest fix out
there of course.  Below is my current DB query. I
realize I'm using apostrophes for my variables... is
this acceptable syntax and/or is there a replacement?

$query = INSERT into $table values ('0', '$year',
'$month', '$day', '$hour', '$minutes', '$seconds',
'$article_name', '$content', '$admin_name');


__
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

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




Re: [PHP-DB] two different MySQL connections without always select_db?

2002-03-10 Thread Clever

What about a function
function nameyouchoose ($query,$link) {

if ( ! isset($query) || ! isset($link) )
return;

mysql_selectdb($link);
return mysql_query($query);
}


- Original Message -
From: PHP freak [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, March 09, 2002 1:38 AM
Subject: [PHP-DB] two different MySQL connections without always select_db?


 How would you keep two different MySQL connections to two different MySQL
databases (on two different MySQL servers) up and available with two
different pointers (id), and not need to always do select_db() to switch
between them?

 I thought that if I did this:

 --- php: -
 $aaa_link = mysql_pconnect(localhost, u, p);
 mysql_select_db(apples, $aaa_link);

 $zzz_link = mysql_pconnect(remotehost, u, p);
 mysql_select_db(zebras, $zzz_link);
 --

 .. that I'd be able to access both pretty easily. Like this:

 --- php: -
 $aaa_result = mysql_query(select * from apples, $aaa_link);
 $orchard = mysql_fetch_assoc($aaa_result);

 $zzz_result = mysql_query(select * from zebras, $zzz_link);
 $zoo = mysql_fetch_assoc($zzz_result);

 $aaa_result = mysql_query(update apples set something=' .
$zoo['zebrafur'] . ', $aaa_link);
 --

 But it seems to tell me that $zzz_result is not a valid resource - unless
I do the select_db thing inbetween the two commands.

 Is there anyone doing this successfully?  Back-n-forth between two
databases?

 Thanks for any help.



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




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




Re: [PHP-DB] MySQL and apostrophes, interesting problem. 42082

2002-03-10 Thread Robert Weeks

See the manual at php.net:

addslashes()
stripslashes()

I've found it easier to just turn on magic-quotes in the php.ini file

This is all covered at php.net

Robert
- Original Message - 
From: Nick Patsaros [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Sunday, March 10, 2002 11:23 AM
Subject: [PHP-DB] MySQL and apostrophes, interesting problem. 42082


 I'm working with a simple form which submits field
 data to a MySQL database.  This is for the purpose of
 generating a dynamic news page for my site. 
 Interestingly enough I've found that any time I try to
 submit data that contains an apostrophe ' it gives
 me an error and will not send the data (any of it) to
 the database. 
 
 How can I change my database query, or escape out
 apostrophes?  I'm looking for the easiest fix out
 there of course.  Below is my current DB query. I
 realize I'm using apostrophes for my variables... is
 this acceptable syntax and/or is there a replacement?
 
 $query = INSERT into $table values ('0', '$year',
 '$month', '$day', '$hour', '$minutes', '$seconds',
 '$article_name', '$content', '$admin_name');
 
 
 __
 Do You Yahoo!?
 Try FREE Yahoo! Mail - the world's greatest free email!
 http://mail.yahoo.com/
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




[PHP-DB] Re: File Upload and MySQL-Please Disregard

2002-03-10 Thread Carl E Shmidt

Sorry , I accidentally posted the same thing twice.  Just diregard this one.

Carl E Shmidt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have an admin site where users can upload files. Information about the
 file like file name and song name are stored in a Mysql db.
 Here's a snippet of code:

//add the MP3 meta data to the database


$mp3ID=addMP3($songName,$isStudio,$HTTP_POST_FILES['userfile']['name'],$user
 name,$password,$host,$databaseName,$dbErrorArray);

   if(// if no errors inserting the meta data into mysql){


handleupload($DOCUMENT_ROOT,$HTTP_POST_FILES,$errorArray,audio,/mp3/);
 if(//errors copying up the file){

   //delete the database entry

 deleteMP3($username,$password,$host,$databaseName,$errorArray,$mp3ID);
 }
   }


 The problem is this:
 If there are errors uploading the file, I can see in my debug output that
 the SQL call to delete the MP3 meta data executed, but yet when i check
the
 db using mysql connect, the record still exists in the db.  I have to
 manually delete it for the record to disappear.  What's going on?


 Carl





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




Re: [PHP-DB] Hosting - what's needed to handle 650K queries?

2002-03-10 Thread Frank Flynn

You actually have several options here and some things could complicate the
issue too.

A previous poster suggested that 36 page views a second would be
satisfactory - this sounds reasonable but it's also my experience that in
the Windows world the way the systems tend to fail is to become unstable at
high loads.  You'll want to watch this and always have extra head room.

You didn't exactly say but I assume you'd be doing this all on one machine;
I'd suggest using at least two - one for the DB and the other for the Web
Server, ASP and PHP processing.  You can add more front end machines and so
long as they all look to the same DB you won't have consistency issues.

Getting your 36 pages per second depends on how much work your doing per
page.  For every page view you have:

End User's Browser - IIS - ASP - PHP - DB

I assume your query would be looking up stories by a primary key and since
most people will be looking for the latest news these pages would be cached
so the DB shouldn't have much trouble keeping up this pace.

But 36 times a second PHP and ASP would be retrieving and formatting the
same stories and this could be minimal or more likely significant work.
Having more than one front end would allow you to scale by adding more front
ends when needed.

You could also design a system where after a story is submitted it gets
formatted once and pushed to the Front End servers - although you still may
want to process the pages as they are served (for Ad's, user preferences or
whatever) you would have some or maybe even most of the processing already
done speeding up the process.

Even if you only had the top 100 stories as static pages and for old stories
you did hit the DB this could still save you significant time.

And the system the authors use to submit the stories should defiantly be on
a different Front End - perhaps not that powerful if money's an issue but
having it separate reduces the chances that something on that box (an
Upgrade, bug or even an editor doing something unusual) would bring down the
whole site.

Good Luck,
Frank


On 3/10/02 8:23 AM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:

 From: olinux [EMAIL PROTECTED]
 Date: Sat, 9 Mar 2002 17:47:15 -0800 (PST)
 To: [EMAIL PROTECTED]
 Subject: Hosting - what's needed to handle 650K queries?
 
 I am working with a news site that currently uses
 static pages. 
 
 I'm looking into the option of building a db driven
 system and new host option as we are up to about 10K
 articles. What do I need in a server to handle this
 amount of traffic. Site is currently getting about
 600,000 page views and growing quite rapidly. The
 server I am looking at is athlon 1gig 512MB Win2K
 (portions of the site are ASP scripted). Will this
 server handle the traffic of approx 650,000 queries
 monthly. (Traffic is heaviest M-F)
 
 I would like to develop the content management system
 in PHP. MySQL has more than enough functionality to
 insert and pull data for what we're doing. We also
 have a MSSQL database. Which would be a better
 solution. I am guessing that MySQL would be as 99% of
 queries would be simple select statements and MySQL
 handles this well.
 
 Thanks much,
 olinux
 
 PS: Hosting providers - feel free to send me
 (dedicated) hosting offers off-list
 
 
 __
 Do You Yahoo!?
 Try FREE Yahoo! Mail - the world's greatest free email!
 http://mail.yahoo.com/
 


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




[PHP-DB] Mssql trusted connections ?

2002-03-10 Thread Kearns, Terry

How does one use trusted connections with mssql_connect()
?


Also, the manual says something about an interfaces file. Where do I find
this? Where is this interfaces file documented?

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




[PHP-DB] login

2002-03-10 Thread its me

there is a page that when user go to need to be looged in,so it automaticaly go back 
with him to loggin page but after login i want him to go back to the page he was 
in.how?
using history()? and how.
thanks guys


Rehab M.Shouman





-
Express yourself with a super cool email address from BigMailBox.com.
Hundreds of choices. It's free!
http://www.bigmailbox.com
-

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




Re: [PHP-DB] login

2002-03-10 Thread Marius Ursache

try header(Location :  http://the.page.where.you.want.to.return );

(search in phpmanual)

its me a écrit :

 there is a page that when user go to need to be looged in,so it automaticaly go back 
with him to loggin page but after login i want him to go back to the page he was 
in.how?
 using history()? and how.
 thanks guys

 Rehab M.Shouman

 
 

 -
 Express yourself with a super cool email address from BigMailBox.com.
 Hundreds of choices. It's free!
 http://www.bigmailbox.com
 -

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

--
  Marius Ursache (3563 || 3494)

   \|/  \|/
   '/ ,. \`
   /_| \__/ |_\
  \__U_/



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




[PHP-DB] RE: login

2002-03-10 Thread Adam Royle

If the variable $SCRIPT_NAME does not suit your needs, try the other
environment variables here:

http://www.php.net/manual/en/language.variables.predefined.php

Adam


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