[PHP] mysql and php questions
Hello all: I had a few questions. First, I'm using php-fastcgi with nginx for my primary web server. I was wondering what sorts of optimizations exist to make this process a lot faster. Second, I'm setting up a custom application, and it contains an authentication module for login/registration. In doing this, I discovered PDO (I used to just use the mysql_* functions). According to google, it's easier to prevent mysql injection attacks with PDO, so I dove in. Before, I was using $pdo->exec("...");, but I read that I need to call quote on the variables I'm passing in. It looks like that all quote does is just add '...' on the variables, but I could be wrong. So, here's my questions: First, I know that prepared statements are immune to mysql injection attacks, if I just use the variables with placeholders in the statements. I know that caching these means that the optimization does not have to be done every time, but is this the most efficient method for adding a single user for registration? Or would a basic query be better. Also, I had the idea of building up common queries and cacheing them, but this isn't really possible since each php script (as far as I'm aware) gets it's own process or environment. If I can build the prepared statements and cache them, it seems like things would be a lot quicker. Is this something commonly done? -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL and PHP weirdness
Bear with me here. I have a problem with PHP and MySQL that's been stumping me for a couple of days now. I'm not even sure how to describe it, so I'll just do my best. There's a row in our bugs database that looks like every other row in the table, but when it's pulled from the database and displayed in PHP, the "description" field -- which is defined as a "mediumtext" field -- is displayed as a date field with a value of 12/31/1969. Moreoever, when I use PHPMyAdmin to look at the row directly, the "description" field has the data that I expect it to. Just for fun, here's the text in question: Quarterly Course Set Up - Spring 2012 (114) Section Course titleCourse Start Date 114MHI214 The Internet and the Future of Patient Care 04/02/2012 114MHI212 Health Information Systems Analysis and Design 04/02/2012 Program administrator 2 users; Laurel Aroner - Susan Catron - Jennifer Kremer Instructors; MHI214; Peter Yellowlees MHI212; Robert Balch Per instructions from Rita Smith-Simms - I'm creating this task for myself and based on instructions given which are that all listed courses are now to be backed-up and restored sooner (original course set up time-frame was a month before course starts). Adding instructions - Follow the 52-step quarterly course set up process and information from the course matrix; if matrix incomplete, input information during this set up As you track your time each day, please include in the notes which courses (use project code) you worked on and indicate either working on or completed. Create and notify by 2/15/2012 I've made sure there are no odd characters that would mess up how PHP is displaying the text. I've tried changing the field type from "mediumtext" to "text" but this didn't work. If anyone has any ideas as to why this might be happening -- or if I just wasn't clear -- please let me know. -- Sláinte, Richard S. Crawford (rich...@underpope.com) http://www.underpope.com Twitter: http://twitter.com/underpope Facebook: http://www.facebook.com/underpope Google+: http://gplus.to/underpope
Re: [PHP] mysql and php
Display the different ways in which you've seen php using mysql, and we'll see if any one of them is any more secure than another. Most Security issues can be left to MySQL and the MySQL API. A few pointers - Store parameters(username/password) outside the DocuementRoot. Put your server on local host - or create an ssh/ssl tunnel between the PHP machine, and the DB. Cast any numbers, and escape any strings. ( mysql_escape_string ) Configure mysql securely - this is outside the scope of an email. On 4/14/06, benifactor <[EMAIL PROTECTED]> wrote: > > i was wondering what is the most secure way to use mysql in php. is there > a certain way it should be done or a way that is more secure than another? > > iv'e seen it done many ways and was wondering if it was just preference or > a if there was a reason behind it. > > if you guys could post some examples of how you do it and why maybe you > could help me understand or know of an article or tutorial on the subjecti > would appreciate it. >
[PHP] mysql and php
i was wondering what is the most secure way to use mysql in php. is there a certain way it should be done or a way that is more secure than another? iv'e seen it done many ways and was wondering if it was just preference or a if there was a reason behind it. if you guys could post some examples of how you do it and why maybe you could help me understand or know of an article or tutorial on the subjecti would appreciate it.
Re: [PHP] mysql and php
great tutorial to do what you want: http://www.freewebmasterhelp.com/tutorials/phpmysql/4 regards, David. On Tue, 11 Mar 2003, Joseph Bannon wrote: > How can I have php give me all the data in a table as > I would using the prompt in mysql? > > Joseph > > > > __ > Do you Yahoo!? > Yahoo! Web Hosting - establish your business online > http://webhosting.yahoo.com > > -- David Elías Sánchez Vásquez Bachiller en Educación PUCP [EMAIL PROTECTED] telf. (51)-1-5255601 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql and php
How can I have php give me all the data in a table as I would using the prompt in mysql? Joseph __ Do you Yahoo!? Yahoo! Web Hosting - establish your business online http://webhosting.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL and PHP arrays
mysql_fetch_array($result) works too. It fetches the data from the current row and is used in conjunction with a while loop: while($array=mysql_fetch_array($result)) { //stuff to do with the current array } Robbert van Andel -Original Message- From: Mike Mannakee [mailto:[EMAIL PROTECTED] Sent: Monday, March 10, 2003 8:45 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] MySQL and PHP arrays You get at the data through $array = mysql_result($result,0,0); Mike "{R}Ichard Ashton" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mon, 10 Mar 2003 22:34:44 +0800, Jason Wong wrote: > > >On Monday 10 March 2003 22:30, {R}ichard Ashton wrote: > >> Is there a generally recommended way of storing an array created by PHP > >> in a MySQL database field ? > > > >serialize() and unserialize(). > > > >> What type of field should it be, and how do you get the whole array > >> back in one go without reconstructing it row by row, if that is > >> possible? > > > >Any text field will do, just make sure it's large enough for your data. > > Thanks that now makes much more sense. So when I look at the data in > the database I see > a:142:{i:1;s:52:[52characters];i:2;s:37:[37characters] and so on for > the 142 elements of the array. > > But getting it out is not so easy. > > $result = mysql_query( " select post from posts where id = '$id' ") > > Gives $result as a Resource id #6 which is OK but I cant find the PHP > MySQL command to get the whole field back to unserialize it :( > > {R} > > > > >-- > >Jason Wong -> Gremlins Associates -> www.gremlins.biz > >Open Source Software Systems Integrators > >* Web Design & Hosting * Internet & Intranet Applications Development * > >-- > >Search the list archives before you post > >http://marc.theaimsgroup.com/?l=php-general > >-- > >/* > >QOTD: > > I'm not bald -- I'm "hair challenged". > > > > [I thought that was "differently haired". Ed.] > >*/ > > > > > >-- > >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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL and PHP arrays
You get at the data through $array = mysql_result($result,0,0); Mike "{R}Ichard Ashton" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mon, 10 Mar 2003 22:34:44 +0800, Jason Wong wrote: > > >On Monday 10 March 2003 22:30, {R}ichard Ashton wrote: > >> Is there a generally recommended way of storing an array created by PHP > >> in a MySQL database field ? > > > >serialize() and unserialize(). > > > >> What type of field should it be, and how do you get the whole array > >> back in one go without reconstructing it row by row, if that is > >> possible? > > > >Any text field will do, just make sure it's large enough for your data. > > Thanks that now makes much more sense. So when I look at the data in > the database I see > a:142:{i:1;s:52:[52characters];i:2;s:37:[37characters] and so on for > the 142 elements of the array. > > But getting it out is not so easy. > > $result = mysql_query( " select post from posts where id = '$id' ") > > Gives $result as a Resource id #6 which is OK but I cant find the PHP > MySQL command to get the whole field back to unserialize it :( > > {R} > > > > >-- > >Jason Wong -> Gremlins Associates -> www.gremlins.biz > >Open Source Software Systems Integrators > >* Web Design & Hosting * Internet & Intranet Applications Development * > >-- > >Search the list archives before you post > >http://marc.theaimsgroup.com/?l=php-general > >-- > >/* > >QOTD: > > I'm not bald -- I'm "hair challenged". > > > > [I thought that was "differently haired". Ed.] > >*/ > > > > > >-- > >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] MySQL and PHP arrays
On Mon, 10 Mar 2003 22:34:44 +0800, Jason Wong wrote: >On Monday 10 March 2003 22:30, {R}ichard Ashton wrote: >> Is there a generally recommended way of storing an array created by PHP >> in a MySQL database field ? > >serialize() and unserialize(). > >> What type of field should it be, and how do you get the whole array >> back in one go without reconstructing it row by row, if that is >> possible? > >Any text field will do, just make sure it's large enough for your data. Thanks that now makes much more sense. So when I look at the data in the database I see a:142:{i:1;s:52:[52characters];i:2;s:37:[37characters] and so on for the 142 elements of the array. But getting it out is not so easy. $result = mysql_query( " select post from posts where id = '$id' ") Gives $result as a Resource id #6 which is OK but I cant find the PHP MySQL command to get the whole field back to unserialize it :( {R} >-- >Jason Wong -> Gremlins Associates -> www.gremlins.biz >Open Source Software Systems Integrators >* Web Design & Hosting * Internet & Intranet Applications Development * >-- >Search the list archives before you post >http://marc.theaimsgroup.com/?l=php-general >-- >/* >QOTD: > I'm not bald -- I'm "hair challenged". > > [I thought that was "differently haired". Ed.] >*/ > > >-- >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] MySQL and PHP arrays
Serializing it would be the best way: seralize($myArray) then you can get the array back using unseralize($serializedarray) -Original Message- From: {R}ichard Ashton [mailto:[EMAIL PROTECTED] Sent: 10 March 2003 14:31 To: [EMAIL PROTECTED] Subject: [PHP] MySQL and PHP arrays Is there a generally recommended way of storing an array created by PHP in a MySQL database field ? What type of field should it be, and how do you get the whole array back in one go without reconstructing it row by row, if that is possible? {R} -- 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] MySQL and PHP arrays
On Monday 10 March 2003 22:30, {R}ichard Ashton wrote: > Is there a generally recommended way of storing an array created by PHP > in a MySQL database field ? serialize() and unserialize(). > What type of field should it be, and how do you get the whole array > back in one go without reconstructing it row by row, if that is > possible? Any text field will do, just make sure it's large enough for your data. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* QOTD: I'm not bald -- I'm "hair challenged". [I thought that was "differently haired". Ed.] */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL and PHP arrays
Is there a generally recommended way of storing an array created by PHP in a MySQL database field ? What type of field should it be, and how do you get the whole array back in one go without reconstructing it row by row, if that is possible? {R} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL and PHP math problem...
I have a database that stores a value of the type double. I do a SUM() query on the column and return save the value to a variable called, '$amount' which I divide into a fixed value (5000) . The math works out fine when $amount < 1000. However, when $amount > 1000, then the decimal places are wrong. // successful query, now fetch the data. $row = mysql_fetch_row($result); if (!$row) { return (-1); } $dollar = $row[0]; $tmp = ($dollar)/((double)5000); echo $tmp; return ($dollar); $amount = 1,104.40 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 did another computation $a = 1000 $b = 5000 $c = $a/$b; Thanks, -Peter $c does equal '0.2' which is correct. $amount -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MYSQL and PHP Storing and retrieving images getting corrupted
Have you tried out mysql function load_file() to upload directly your file into the database without passing through php variable ? Like this: $result=MYSQL_QUERY("INSERT INTO master_products (image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t ype) VALUES (load_file('$form_data'),'$form_data_name','$form_data_size','$form_data_typ e')"); If you are not allowed to upload directly $form_data using mysql load_file(), move first the file $form_data into another allowed directory with valid filename and try again. Finally, storing image or binary file into database is not good, put them into directory instead. - Original Message - From: "Darren McPhee" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 05, 2002 11:24 PM Subject: [PHP] MYSQL and PHP Storing and retrieving images getting corrupted > I have written 2 programs (which are very common PHP > programs) that A) Allows me to upload image files into a MYSQL database > using a simple form. And B) Allows me to retrieve and display the image > using a PHP script. This is my problem:- > > I can upload the images ok. I store the binary code, image type, name, and > size within the MYSQL database. On checking the database directly using > DBTools, I can see that the files have uploaded. The file sizes reflect > exactly what was originally on the hard disk of my PC (not sure if this is a > correct gauge). > > When I run my PHP program to display the images, maybe only 1 out of 10 > actually displays correctly. The rest are broken up or non displayable > images. One image even made a prompt window appear and somehow now causes > Windows paint to load the image instead of the browser. God only knows how > that occurred !! > > Below are my (designed by others) 2 programs. The first program is the > upload form. This seems to work ok. > > > > > Store binary data into SQL Database > > > // code that will be executed if the form has been submitted: > > if ($submit) { > > // connect to the database > > require_once('../../Connections/TestServer.php'); > mysql_select_db($database_TestServer, $TestServer); > > $data = addslashes(fread(fopen($form_data, "r"), filesize($form_data))); > > $result=MYSQL_QUERY("INSERT INTO master_products > (image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t > ype) ". > "VALUES > ('$data','$form_data_name','$form_data_size','$form_data_type')"); > > $id= mysql_insert_id(); > print "This file has the following Database ID: $id"; > > MYSQL_CLOSE(); > > } else { > > // else show the form to submit new data: > ?> > > enctype="multipart/form-data"> > > File to upload/store in database: > > > > > > } > > ?> > > > > > Here is the code to display the image:- > > if($id) { > require_once('../Connections/TestServer.php'); > mysql_select_db($database_TestServer, $TestServer); > $query = "select image_thumbnail,image_thumbnail_type from > master_products where item_id=$id"; > $result = @MYSQL_QUERY($query); > $data = @MYSQL_RESULT($result,0,"image_thumbnail"); > $type = @MYSQL_RESULT($result,0,"image_thumbnail_type"); > Header( "Content-type: $type"); > echo $data; > }; > ?> > > I run the above program in the following way: > http://192.168.0.11/htdocs/displayimage2.php?id=9 The ID is the item_id > primary key field for whichever record I want to display. > > I have tried these programs on a test server here in my room to a test > Apache server and MYSQL test database, and also from my ISP to a MYSQL > database at a server at my ISP. I get exactly the same problem. When I run > the display image program, the images being displayed are always being > displayed the same. Which points the problem towards the upload process > (maybe). If anybody can tell me what the heck is wrong here, I'll give them > a medal !! There is basically some kind of binary corruption going on (it > looks like) > > For added information, below is my database table structure. At the moment, > the only part I am actually using relates to the image_thumbnail sections. > > Darren. > > > > CREATE TABLE master_products ( > item_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, > item_code VARCHAR (10) UNIQUE, > item_dateadded DATETIME DEFAULT '-00-00 00:00:00', > item_datemodifi
Re: [PHP] MYSQL and PHP Storing and retrieving images getting corrupted
Try adding header('Content-length: ' .strlen($data)); header Darren McPhee wrote: I have written 2 programs (which are very common PHP programs) that A) Allows me to upload image files into a MYSQL database using a simple form. And B) Allows me to retrieve and display the image using a PHP script. This is my problem:- I can upload the images ok. I store the binary code, image type, name, and size within the MYSQL database. On checking the database directly using DBTools, I can see that the files have uploaded. The file sizes reflect exactly what was originally on the hard disk of my PC (not sure if this is a correct gauge). When I run my PHP program to display the images, maybe only 1 out of 10 actually displays correctly. The rest are broken up or non displayable images. One image even made a prompt window appear and somehow now causes Windows paint to load the image instead of the browser. God only knows how that occurred !! Below are my (designed by others) 2 programs. The first program is the upload form. This seems to work ok. Store binary data into SQL Database // code that will be executed if the form has been submitted: if ($submit) { // connect to the database require_once('../../Connections/TestServer.php'); mysql_select_db($database_TestServer, $TestServer); $data = addslashes(fread(fopen($form_data, "r"), filesize($form_data))); $result=MYSQL_QUERY("INSERT INTO master_products (image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t ype) ". "VALUES ('$data','$form_data_name','$form_data_size','$form_data_type')"); $id= mysql_insert_id(); print "This file has the following Database ID: $id"; MYSQL_CLOSE(); } else { // else show the form to submit new data: ?> enctype="multipart/form-data"> File to upload/store in database: } ?> Here is the code to display the image:- if($id) { require_once('../Connections/TestServer.php'); mysql_select_db($database_TestServer, $TestServer); $query = "select image_thumbnail,image_thumbnail_type from master_products where item_id=$id"; $result = @MYSQL_QUERY($query); $data = @MYSQL_RESULT($result,0,"image_thumbnail"); $type = @MYSQL_RESULT($result,0,"image_thumbnail_type"); Header( "Content-type: $type"); echo $data; }; ?> I run the above program in the following way: http://192.168.0.11/htdocs/displayimage2.php?id=9 The ID is the item_id primary key field for whichever record I want to display. I have tried these programs on a test server here in my room to a test Apache server and MYSQL test database, and also from my ISP to a MYSQL database at a server at my ISP. I get exactly the same problem. When I run the display image program, the images being displayed are always being displayed the same. Which points the problem towards the upload process (maybe). If anybody can tell me what the heck is wrong here, I'll give them a medal !! There is basically some kind of binary corruption going on (it looks like) For added information, below is my database table structure. At the moment, the only part I am actually using relates to the image_thumbnail sections. Darren. CREATE TABLE master_products ( item_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, item_code VARCHAR (10) UNIQUE, item_dateadded DATETIME DEFAULT '-00-00 00:00:00', item_datemodified DATETIME DEFAULT '-00-00 00:00:00', category ENUM ("none","single herbs","general vitality","ageing","arthritis","eyesite","prostate","ahlzheimers", "weight loss","menopause","depression","fatigue","headaches","insomnia","colds and flues","allergies", "healthy heart","cancer prevention","aphrodisiacs","sexual herbs","for women","for men","books"), name VARCHAR (30), name_dateadded DATETIME DEFAULT '-00-00 00:00:00', name_datemodified DATETIME DEFAULT '-00-00 00:00:00', INDEX idx_name (name), desc_brief VARCHAR (255), desc_brief_dateadded DATETIME DEFAULT '-00-00 00:00:00', desc_brief_datemodified DATETIME DEFAULT '-00-00 00:00:00', INDEX idx_desc_brief (desc_brief), desc_long TEXT, desc_long_dateadded DATETIME DEFAULT '-00-00 00:00:00', desc_long_datemodified DATETIME DEFAULT '-00-00 00:00:00', price DECIMAL (7,2), price_dateadded DATETIME DEFAULT '-00-00 00:00:00', price_datemodified DATETIME DEFAULT '-00-00 00:00:00', image LONGBLOB, image_name VARCHAR (50), image_size INT UNSIGNED, image_type VARCHAR (50), image_dateadded DATETIME DEFAULT '-00-00 00:00:00', image_datemodified DATETIME DEFAULT '-00-00 00:00:00', image_thumbnail LONGBLOB, image_thumbnail_name VARCHAR (50), image_thumbnail_size INT UNSIGNED, image_thumbnail_type VARCHAR (50), image_thumbnail_dateadded DATETIME DEFAULT '-00-00 00:00:00', image_thumbnail_datemodified DATETIME DEFAULT '-00-00 00:00:00' ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MYSQL and PHP Storing and retrieving images getting corrupted
I have written 2 programs (which are very common PHP programs) that A) Allows me to upload image files into a MYSQL database using a simple form. And B) Allows me to retrieve and display the image using a PHP script. This is my problem:- I can upload the images ok. I store the binary code, image type, name, and size within the MYSQL database. On checking the database directly using DBTools, I can see that the files have uploaded. The file sizes reflect exactly what was originally on the hard disk of my PC (not sure if this is a correct gauge). When I run my PHP program to display the images, maybe only 1 out of 10 actually displays correctly. The rest are broken up or non displayable images. One image even made a prompt window appear and somehow now causes Windows paint to load the image instead of the browser. God only knows how that occurred !! Below are my (designed by others) 2 programs. The first program is the upload form. This seems to work ok. Store binary data into SQL Database This file has the following Database ID: $id"; MYSQL_CLOSE(); } else { // else show the form to submit new data: ?> File to upload/store in database: Here is the code to display the image:- MYSQL_QUERY($query); $data = @MYSQL_RESULT($result,0,"image_thumbnail"); $type = @MYSQL_RESULT($result,0,"image_thumbnail_type"); Header( "Content-type: $type"); echo $data; }; ?> I run the above program in the following way: http://192.168.0.11/htdocs/displayimage2.php?id=9 The ID is the item_id primary key field for whichever record I want to display. I have tried these programs on a test server here in my room to a test Apache server and MYSQL test database, and also from my ISP to a MYSQL database at a server at my ISP. I get exactly the same problem. When I run the display image program, the images being displayed are always being displayed the same. Which points the problem towards the upload process (maybe). If anybody can tell me what the heck is wrong here, I'll give them a medal !! There is basically some kind of binary corruption going on (it looks like) For added information, below is my database table structure. At the moment, the only part I am actually using relates to the image_thumbnail sections. Darren. CREATE TABLE master_products ( item_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, item_code VARCHAR (10) UNIQUE, item_dateadded DATETIME DEFAULT '-00-00 00:00:00', item_datemodified DATETIME DEFAULT '-00-00 00:00:00', category ENUM ("none","single herbs","general vitality","ageing","arthritis","eyesite","prostate","ahlzheimers", "weight loss","menopause","depression","fatigue","headaches","insomnia","colds and flues","allergies", "healthy heart","cancer prevention","aphrodisiacs","sexual herbs","for women","for men","books"), name VARCHAR (30), name_dateadded DATETIME DEFAULT '-00-00 00:00:00', name_datemodified DATETIME DEFAULT '-00-00 00:00:00', INDEX idx_name (name), desc_brief VARCHAR (255), desc_brief_dateadded DATETIME DEFAULT '-00-00 00:00:00', desc_brief_datemodified DATETIME DEFAULT '-00-00 00:00:00', INDEX idx_desc_brief (desc_brief), desc_long TEXT, desc_long_dateadded DATETIME DEFAULT '-00-00 00:00:00', desc_long_datemodified DATETIME DEFAULT '-00-00 00:00:00', price DECIMAL (7,2), price_dateadded DATETIME DEFAULT '-00-00 00:00:00', price_datemodified DATETIME DEFAULT '-00-00 00:00:00', image LONGBLOB, image_name VARCHAR (50), image_size INT UNSIGNED, image_type VARCHAR (50), image_dateadded DATETIME DEFAULT '-00-00 00:00:00', image_datemodified DATETIME DEFAULT '-00-00 00:00:00', image_thumbnail LONGBLOB, image_thumbnail_name VARCHAR (50), image_thumbnail_size INT UNSIGNED, image_thumbnail_type VARCHAR (50), image_thumbnail_dateadded DATETIME DEFAULT '-00-00 00:00:00', image_thumbnail_datemodified DATETIME DEFAULT '-00-00 00:00:00' ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL and PHP
Brandon, Please do some 'homework': Will the native query run from the MySQL command line, or in a admin tool? Have you tried varying the number of fields? What are the column specifications? In and amongst this you might like to check where you should have spaces (a) for legibility (particularly if you're asking us to read it to help you), and (b) for machine parsing requirements. =dn - Original Message - From: "hugh danaher" <[EMAIL PROTECTED]> To: "Brandon Orther" <[EMAIL PROTECTED]> Cc: "Php-General" <[EMAIL PROTECTED]> Sent: 18 January 2002 01:14 Subject: Re: [PHP] MySQL and PHP > Brandon, > Try using single quotes rather than doubles in the values e.g. > ('something','something else') > hugh > - Original Message - > From: Brandon Orther <[EMAIL PROTECTED]> > To: PHP User Group <[EMAIL PROTECTED]> > Sent: Thursday, January 17, 2002 2:25 PM > Subject: [PHP] MySQL and PHP > > > > Hello, > > > > I am trying to use mysql through php. When I try to run the following > > query it does nothing. I am trying to figure out if it is the query or > > php I am having a problem with. Does anyone see a problem with the > > below query? (Note: This is for mysql) > > > > QUERY: > > INSERT INTO page_properties > > (page_name,open_menu,top_image,title_image,side_images) > > VALUES("30daypolicy","comp_info2","top_aboutus","titlebar_aboutus","30da > > y"); > > > > Thanx for your help, > > Brandon > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] MySQL and PHP
Brandon, Try using single quotes rather than doubles in the values e.g. ('something','something else') hugh - Original Message - From: Brandon Orther <[EMAIL PROTECTED]> To: PHP User Group <[EMAIL PROTECTED]> Sent: Thursday, January 17, 2002 2:25 PM Subject: [PHP] MySQL and PHP > Hello, > > I am trying to use mysql through php. When I try to run the following > query it does nothing. I am trying to figure out if it is the query or > php I am having a problem with. Does anyone see a problem with the > below query? (Note: This is for mysql) > > QUERY: > INSERT INTO page_properties > (page_name,open_menu,top_image,title_image,side_images) > VALUES("30daypolicy","comp_info2","top_aboutus","titlebar_aboutus","30da > y"); > > Thanx for your help, > Brandon > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] MySQL and PHP
What is the error that you are getting? --Sam - Original Message - From: "Brandon Orther" <[EMAIL PROTECTED]> To: "PHP User Group" <[EMAIL PROTECTED]> Sent: Thursday, January 17, 2002 5:25 PM Subject: [PHP] MySQL and PHP > Hello, > > I am trying to use mysql through php. When I try to run the following > query it does nothing. I am trying to figure out if it is the query or > php I am having a problem with. Does anyone see a problem with the > below query? (Note: This is for mysql) > > QUERY: > INSERT INTO page_properties > (page_name,open_menu,top_image,title_image,side_images) > VALUES("30daypolicy","comp_info2","top_aboutus","titlebar_aboutus","30da > y"); > > Thanx for your help, > Brandon > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] MySQL and PHP
Hello, I am trying to use mysql through php. When I try to run the following query it does nothing. I am trying to figure out if it is the query or php I am having a problem with. Does anyone see a problem with the below query? (Note: This is for mysql) QUERY: INSERT INTO page_properties (page_name,open_menu,top_image,title_image,side_images) VALUES("30daypolicy","comp_info2","top_aboutus","titlebar_aboutus","30da y"); Thanx for your help, Brandon
[PHP] MySQL and PHP problem
[Reposting cos left error message out, sorry] Had a fully working installation of MySQL 3.23 with PHP 6.0.6. I then foolishly installed PGP which included PGPNet and I cant access my MySQL database from PHP. When I try to connect I get error 'Access denied for user: '@GREEN' to database 'subvert_cd' ', another strange thing is under MyODBC it says 'Not Found'. I have re-installed both PHP and MySQL (actually installed 3.23.42) after first de-installing PHP but still no luck. Regards, Ben -- This Email account is protected by http://www.spamcop.net ALL spam is reported to ISP and there network provider *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+ * Ben Edwards [EMAIL PROTECTED] +352 091 429995 * * Homepagehttp://www.gifford.co.uk/~bedwards * * i-Contact Progressive Videohttp://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol's radical newshttp://www.bristle.co.uk * * Open Directory Project http://www.dmoz.org * *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] mysql and php
On Thursday 05 April 2001 02:15, you wrote: > I'm sending this command to mysql > > UPDATE fusuario u, fgrupos g SET g.cdgrupo=1, u.celular="99823640", > u.nome="Augusto X", u.sobrenome="Cesar Castoldi", > u.cidade="Florinópolis", u.emailpessoal="[EMAIL PROTECTED]", > u.idade="19", u.sexo="M", u.operadora="T", u.email="", u.ddd="048" > WHERE g.cdgrupo=1 and u.cdusuario=g.cdusuario and u.cdusuario=1 and > u.celular="99823640" and u.ddd="048" and u.ativo=1 and g.ativo=1 > > and I receive this error message: > > Mensagens do MySQL : You have an error in your SQL syntax near 'u, > fgrupos g SET g.cdgrupo=1, u.celular="99823640", u.nome="Augusto X", > u.sobren' at line 1 > > Why? How can I update with 2 or more tables? use separate queries -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Error 032: Recursion error - see error 032 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] mysql and php
I'm sending this command to mysql UPDATE fusuario u, fgrupos g SET g.cdgrupo=1, u.celular="99823640", u.nome="Augusto X", u.sobrenome="Cesar Castoldi", u.cidade="Florinópolis", u.emailpessoal="[EMAIL PROTECTED]", u.idade="19", u.sexo="M", u.operadora="T", u.email="", u.ddd="048" WHERE g.cdgrupo=1 and u.cdusuario=g.cdusuario and u.cdusuario=1 and u.celular="99823640" and u.ddd="048" and u.ativo=1 and g.ativo=1 and I receive this error message: Mensagens do MySQL : You have an error in your SQL syntax near 'u, fgrupos g SET g.cdgrupo=1, u.celular="99823640", u.nome="Augusto X", u.sobren' at line 1 Why? How can I update with 2 or more tables? regards, Augusto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] :: MySql and PHP Book
Here's what you wrote, 01-01-11: > I was looking for a good book that teaches you how to use PHP (mainly 3) >with MySql. I went to Amazon.com and found "MySql" by Paul Dubois, which was >supposed to be THE book for mySql programming. However, after reading some >of the customer reviews, it said that it was "light" in the PHP section. >Also the fact that the book was published in 1999 made me a little uneasy. >What are some books that you have used to learn MySql with php? The book definitely is THE book for MySQL programming. PHP is discussed as one of several APIs for interacting with MySQL. Nothing more, nothing less. This book is by far and away the best technical manual I have ever read. It was a joy to read, and even though his section on PHP was less than exhaustive, I learned more about good PHP programming in that section than I did in the two other PHP only books I bought. I think, given the complexity of database design (if you want to do it right), that it's worth it to really study MySQL in and of itself. Kristofer -- __ Kristofer Widholm Web Pharmacy [EMAIL PROTECTED] 191 Grand Street, Brooklyn NY 11211 718.599.4893 __ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] :: MySql and PHP Book
On Thu, 11 Jan 2001, Ray Iftikhar wrote: > I was looking for a good book that teaches you how to use PHP (mainly 3) > with MySql. I went to Amazon.com and found "MySql" by Paul Dubois, which was > supposed to be THE book for mySql programming. However, after reading some > of the customer reviews, it said that it was "light" in the PHP section. I don't think that any book can teach you both MySQL and PHP thoroughly. I would guess that if you know C and/or Perl than you should not have any trouble learning PHP. > Also the fact that the book was published in 1999 made me a little uneasy. > What are some books that you have used to learn MySql with php? I found a review at amazon.com which said that the book by DuBois covers the development release of MySQL 3.23 which is quite amazing in spite of the fact that Red Hat Linux 6.2 which was the latest release of Red Hat until last summer had an associated powertools 6.2 bundle with MySQL version only 3.20. The reviewer seemed to imply that a lot of MySQL 3.23 are included in the book. Here are some other things said about DuBois' book and MySQL: - Very well organized and pleasant to read. - The last chapter on Administration be read first. - Examples found in the book and errata should be posted on a web site. - The book is slightly better and more up to date than the O'Reilly book. - Has chapters on both Perl DBI and PHP although my feeling is that there is more on Perl DBI than on PHP. Covers PHP3 but not PHP4 but that is probably not that much of a big deal when you are learning the basics. - While this book covers MySQL it does not cover every aspect of SQL such as Transact-SQL and more advanced SQL constructs not available in MySQL but MySQL is still good for intermediate-scale databases and runs on a variety of operating systems, is more powerful than MSQL (Mini-SQL), and is supported by lots of database applications. The authoritative guides to SQL see http://webstore.ansi.org/and do a search but keep in mind that these unreasonably priced documents are for experts only. For instance, ISO/IEC 9075:1992 Information technology - Database languages - SQL is currently priced at US$235.00. I think this is the latest standard for SQL (Structured Query Language). A list of PHP books can be found at http://www.php.net/books.php Bye, Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] :: MySql and PHP Book
Hey Ray, I would suggest looking for books on SQL. I have one (and want more!), it is called "the practical sql handbook" and it's nice. Seems every PHP book deals with MySQL directly too. Anyway, my thought on the matter is go generic, go SQL. Philip On Thu, 11 Jan 2001, Ray Iftikhar wrote: > I was looking for a good book that teaches you how to use PHP (mainly 3) > with MySql. I went to Amazon.com and found "MySql" by Paul Dubois, which was > supposed to be THE book for mySql programming. However, after reading some > of the customer reviews, it said that it was "light" in the PHP section. > Also the fact that the book was published in 1999 made me a little uneasy. > What are some books that you have used to learn MySql with php? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] :: MySql and PHP Book
I was looking for a good book that teaches you how to use PHP (mainly 3) with MySql. I went to Amazon.com and found "MySql" by Paul Dubois, which was supposed to be THE book for mySql programming. However, after reading some of the customer reviews, it said that it was "light" in the PHP section. Also the fact that the book was published in 1999 made me a little uneasy. What are some books that you have used to learn MySql with php? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] mysql and php possibly causing problem
On 9 Jan 2001 21:04:26 -0800, [EMAIL PROTECTED] (James Mclean) wrote: >list, >ok her is the problem. i have a page taht works fine in one dir, but in a sub >dir, it doesnt even show up. here is my dir structure. >public_html/| >|website/| >||index.php >||admin/| >|| |admin.php >|| | > >now what happens, is if the file admin.php is in the admin dir, all i get in >the browser is the tags , but if i put the file >admin.php into the website dir, it works fine. please help!! > >using php4.0b3, mysql 3.22.32 apache latest debian 2.2 >please help!! Can we see the code that is giving you the problems? -- Michael Brunson 504.473.6643 [EMAIL PROTECTED] ICQ: 83163789 --- Intercosmos Media Group, Inc. --- www.intercosmos.comwww.directnic.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] mysql and php possibly causing problem
list, ok her is the problem. i have a page taht works fine in one dir, but in a sub dir, it doesnt even show up. here is my dir structure. public_html/| |website/| ||index.php ||admin/| || |admin.php || | now what happens, is if the file admin.php is in the admin dir, all i get in the browser is the tags , but if i put the file admin.php into the website dir, it works fine. please help!! using php4.0b3, mysql 3.22.32 apache latest debian 2.2 please help!! thanks james mclean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]