Re: [PHP-DB] adding a mysql query as text into a history table... ?
On Wednesday 23 June 2004 17:14, Gawie Marais wrote: i would like to add the whole query into a text field in the 'history' table, but i get errors when i try to add it... can anyone help ? this is the error :- Invalid query: You have an error in your SQL syntax near '2004-06-23 11:09:57', date_modified = '-00-00 00:00:00', date_closed =' at line 6 You'll need to escape the string containing the query before you can insert it. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* If you always postpone pleasure you will never have it. Quit work and play for once! */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Erroneous date and time
On Wednesday 16 June 2004 03:36, Philip Thompson wrote: Maybe there's something I'm doing incorrectly, but I cannot get the date() function to return the appropriate time. It's always 12 hours off. I've tried using 24-hour time and 12-hour time (with AM/PM), but they both give the wrong time. I even emailed the server admin to make sure that the server clock was set correctly, and he said that it was. I don't know... Here's my PHP: $problemDateTime = date(Y-m-d g:i:s A); which returns: 2004-06-13 11:24:21 PM To the untrained eye ;), that might appear correct. But that was actually submitted at 11:24 AM, not PM. So, that's my code. Any suggestions?? Try gmdate() and see whether that gives the expected result. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* You know it's going to be a bad day when you want to put on the clothes you wore home from the party and there aren't any. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] compile 4.3.6
On Tuesday 20 April 2004 09:31, Craig Hoffman wrote: Here is what I am running: ./configure --with-zlib-dir=/usr/local --with-libjpeg-dir=/sw --with-libpng-dir=/sw --with-libtiff-dir=/sw --with-gd --with-mysql=/usr/local/mysql --with-xml --with-freetype=/sw --with-pdflib=/sw --enable-ftp --enable-ldap --with-freetype-dir=/sw --with-curl=/sw --with-apxs=/usr/sbin/apxs Your configuration options seems to be a complete mess. AFAIK there are no options such as --with-libjpeg-dir etc. Use './configure --help | less' to see what you should really e using. What's interesting is I update another machine with PHP 4.3.5 with GD / Fink and it work perfectly. Anyone have any ideas? It's only interesting if both machines have the exact same configuration. Otherwise find out what the difference is to figure out why one is working and the other not. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* enhance, v.: To tamper with an image, usually to its detriment. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Link to do query
On Friday 16 April 2004 12:15, JeRRy wrote: I have a Tipster Website that lists a Tipster Ladder. So it shows their name and their current score. What I want to do is make their name clickable and upon clicking the name it loads that persons profile which is fetched from the mysql db. Now which would be the best way to do this? I have NEVER done a link query before but am familiar with forms. OK, do what you need to do using a form. Set the form to use the GET method. Now when you submit your form your URL will show something like ... Would I best best to have it something like this: http://mydomain.com/profile.php?user=blah ... so just construct your links in a similar manner. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* This must be morning. I never could get the hang of mornings. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: postgresql
if i remember correctly you have to do this su su postgres createuser your-user-id Adam Williams wrote: Hi, I know this isn't PHP related but I have a quick question about postgresql. I come from a mysql enviroment so I'm a little clueless, even after reading the postgresql docs. I am moving a postgresql database from one server to another. As the user that owns the database, lculber, I ran pg_dump sroom1 sroom1.database but on the server I'm moving the database to, I can't figure out how to get into psql to create the user lculber so I can do psql sroom1 sroom1.database so how can I create the users lculber in postgresql. I can't even connect to psql. any advice? :) below is my command. I'm not trying to database root, I just want to get the psql prompt so I can create the user lculber. [EMAIL PROTECTED] root]# psql -U root psql: FATAL: Database root does not exist in the system catalog. [EMAIL PROTECTED] root]# createuser lculber Shall the new user be allowed to create databases? (y/n) y Shall the new user be allowed to create more new users? (y/n) y psql: FATAL: user root does not exist createuser: creation of user lculber failed -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql_escape_string()
On Saturday 10 April 2004 00:47, Chris Baechle wrote: The mysql_escape_string() function escapes ' (single quote) and (double quote) characters. When php recieves information data through a form, it automatically escapes these characters (tested with php 4.3.5). php.ini - disable 'magic_quotes_gpc' I also noticed mysql_escape_string() is only meant to escape binary data to be inserted. It will escape any characters that needs to be escaped ... Consequently it does not escape all metacharacters as defined by the w3c. ... and is in no way related to metacharacters as defined by the w3c. If you are having a particular problem please elaborate. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* We'll be recording at the Paradise Friday night. Live, on the Death label. -- Swan, Phantom of the Paradise */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Confused: Using wrong Unix Socket
On Friday 09 April 2004 02:38, Noah Davis wrote: How can I get PHP to not get confused about which .sock file to use? php.ini Do I need to recompile PHP? No. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* It is the quality rather than the quantity that matters. - Lucius Annaeus Seneca (4 B.C. - A.D. 65) */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Stumped with proper query and display
On Wednesday 07 April 2004 21:18, Mignon Hunter wrote: I never saw this email come across - I think it got caught in spam software on 4-1 Check the archives. Well I'm still working on this off and on - still having problems :| I couldnt get the foreach to work properly..I keep getting: Invalid argument supplied for foreach() . I've tried lots of different stuff but here's an example: * $query = SELECT * FROM cust; $res = mysql_query($query, $ups_conn) or die(mysql_error()); $query2 = SELECT * FROM contact; $res2 = mysql_query($query2, $ups_conn) or die(mysql_error()); while ($row = mysql_fetch_assoc($res)) { while ($row2 = mysql_fetch_assoc($res2)) { I've no idea what you're trying to do. Are the tables 'cust' and 'contact' related in any way? What is the relation? And shouldn't the relation be reflected in your queries? And if so your second query should be inside your outer while-loop. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Now I lay me back to sleep. The speaker's dull; the subject's deep. If he should stop before I wake, Give me a nudge for goodness' sake. -- Anonymous */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Rounding
On Thursday 08 April 2004 09:56, Ng Hwee Hwee wrote: is there a way to do rounding up to the nearest tenth? can't use ROUND() cos i need something like this: 6.11 -- 6.2 6.15 -- 6.2 6.19 -- 6.2 6.20 -- 6.2 i know there is a ceil() function but that rounds up to the nearest integer.. i need one decimal place still.. multiply by 10 ceil() divide by 10 -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* In Oz, never say krizzle kroo to a Woozy. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Drop down menu with PHP
On Monday 05 April 2004 10:01, The Image Builder wrote: I have code for a drop down menu that works fine. But, though I only want the results from one row to fill the form, I want it to show 2 rows in the drop down menu. What exactly do you mean by that? If you want to increase the size of the drop down box so that it displays 2 rows at a time then it is an HTML question and the anwser can be found in any decent HTML reference. Otherwise please elaborate. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Home is the place where, when you have to go there, they have to take you in. -- Robert Frost, The Death of the Hired Man */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] INSERT problem--Need help urgently
On Tuesday 30 March 2004 19:46, [EMAIL PROTECTED] wrote: sorie it was my typo error. actually in my code there is already {} with my first if statement and there is also a space after VALUES... Whenever you post code, use copy and paste, or be extremely meticulous that you do not introduce typos. This will ensure that people can focus on your real problem and not on your erroneously introduced typos. I still need some help here with my code...how can I prevent it from inserting a duplicate row of null values??? echo() your $sql statement just before you execute it. Are you doing any redirections or refreshing the page? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* I've read SEVEN MILLION books!! */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] INSERT problem--Need help urgently
On Tuesday 30 March 2004 20:13, [EMAIL PROTECTED] wrote: okay I have echoed $sql and before I did enter anything into the form, the form is already inserting null values into the database. Maybe that is the reason for the duplicate row of null values. Yes, that would be the reason. Do you know how can I prevent this from happening??Hope to hear from you soon. You're not performing any checks on the input you're getting from your form. The most simple check for whether the form was submitted is to use: if (!empty($_POST)) { // form was submitted } or if (!empty($_GET)) { // form was submitted } In addition you should always perform sanity checks on values of the individual form elements. Search the archives/web for 'sql injection' for more info. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Place me on a BUFFER counter while you BELITTLE several BELLHOPS in the Trianon Room!! Let me one of your SUBSIDIARIES! */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] BLOB
On Monday 15 March 2004 17:24, Ng Hwee Hwee wrote: Use md5. I can't use md5 because i want to retrieve it and send emails to my users if they forgot their password.. If they forget their password shoot them. Or depending on how secure your application needs to be: - generate a new password, send it to the user and ask them to login using new password then change it - send them an email containing a token (you need to generate a token and insert into database), give them a page where they can enter that token and allow them to change password. Refer to the archives for details and maybe other methods for dealing with lost passwords. md5 is only a one way encryption, It is not an encryption, it's a one-way hash. thus i have to resort to using encode('$password', '$salt') where $salt is a value that i have assigned.. because I know the value of $salt, I would be able to decode the password easily by looking at my database and running decode. If your database and webserver are both located on the same server then encoding (or encrypting) anything is largely a waste of effort. If a hostile user ever gets access to your database they would (most likely) will have access to your decryption key as well - in this case your salt. Encryption is only useful where the data and the means of decrypting it are stored in separate locations and compromise of one does not neccessarily lead to the compromise of the other. with blob, i can't see the encoded password easily and thus there is 'maximum security'. haha.. but i'm still open to any form of suggestions! So pretending that you cannot 'see' the password increases the security!?! Like the myth about ostriches burying their heads in the sand to 'hide' from their enemies? If you don't want to accidently see people's passwords why not just rot13 it (apparently some companies seems to think that is a secure enough form of encryption). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Steckel's Rule to Success: Good enough is never good enough. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP - MSSQL connects, but can't query
I changed the mssql_select_db line as suggested by another person here but it didn't change a thing. I still get the exact same error message. Is there anyone else here connecting to a MS SQL server using TDS v8.0 ?? Thanks! Jason -Original Message- From: Jason Morrill [mailto:[EMAIL PROTECTED] Sent: Friday, March 12, 2004 8:36 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP - MSSQL connects, but can't query I've got a very simple PHP script for testing my MS SQL Server connection. I've installed FreeTDS and I can connect and query the database with TSQL. With PHP I can connect and disconnect properly but I can't query or attach to different databases. Here is my sample PHP followed by what the web server throws back at me: sql-test.php html body bgcolor=white ?php $dbproc = mssql_connect(roger,sa,admin); #$dbproc = sybase_connect(roger,sa,admin); if (! $dbproc) { print Can't connect to server; return; } print Connected to server.; $dbconnect = mssql_select_db(Northwind); if (! $dbconnect) { print Can't connect to Northwind; return; } print Connected to database; #$res = sybase_query(select * from test,$dbproc); #if (! $res) { # return; #} #while ($arr = sybase_fetch_array($res)) { # print $arr[i] . . $arr[v] . br\n; #} if (! mssql_close($dbproc)) { print Can't close server connection; return; } print Connection closed.; ? /body /html Output in browser when referencing the sql-test.php file: - Connected to server. Warning: Sybase: Server message: Line 1: Incorrect syntax near 'e'. (severity 15, procedure N/A) in /home/www/sql-test.php on line 12 Can't connect to Northwind Can anyone help me figure this one out?! Thanks! Jason Morrill IT Manager Child Family Agency SE Connecticut -- 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] PHP - MSSQL connects, but can't query
I've got a very simple PHP script for testing my MS SQL Server connection. I've installed FreeTDS and I can connect and query the database with TSQL. With PHP I can connect and disconnect properly but I can't query or attach to different databases. Here is my sample PHP followed by what the web server throws back at me: sql-test.php html body bgcolor=white ?php $dbproc = mssql_connect(roger,sa,admin); #$dbproc = sybase_connect(roger,sa,admin); if (! $dbproc) { print Can't connect to server; return; } print Connected to server.; $dbconnect = mssql_select_db(Northwind); if (! $dbconnect) { print Can't connect to Northwind; return; } print Connected to database; #$res = sybase_query(select * from test,$dbproc); #if (! $res) { # return; #} #while ($arr = sybase_fetch_array($res)) { # print $arr[i] . . $arr[v] . br\n; #} if (! mssql_close($dbproc)) { print Can't close server connection; return; } print Connection closed.; ? /body /html Output in browser when referencing the sql-test.php file: - Connected to server. Warning: Sybase: Server message: Line 1: Incorrect syntax near 'e'. (severity 15, procedure N/A) in /home/www/sql-test.php on line 12 Can't connect to Northwind Can anyone help me figure this one out?! Thanks! Jason Morrill IT Manager Child Family Agency SE Connecticut -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] win32 Timestamp problem
On Wednesday 10 March 2004 04:36, J. Kevin C. Burton wrote: Hey all, after reading documentation on the Win32 bug regarding Timestamps not being able to go prior than 1970.. I am in need of a way to calculate someone's age. Has anyone found a fix or workaround for this bug? Or a way to calculate age without using the timestamp? As you're asking on the PHP-DB list I would assume that your dates are stored in a database of some sort, in which case you could use your database's native functions to do your date calculations. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Neither spread the germs of gossip nor encourage others to do so. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] JPGRAPH, problem...
On Sunday 08 February 2004 05:16, Carlos D. Carrasco wrote: You're asking on the wrong list. As your problem does not involve the use of databases with PHP it should be asked on the php-general list. Also your clock is about a month slow, please fix it. I did resolve my problem about the graphic X,Y, very interesting, but CAN NOT include the image in the middle of a text, it say that can not start nothing befor the ?php please if you have did something with this library and solve this problem, let me know how. You cannot just output image data in the middle of an HTML page. All images in an HTML page are separate files and are each requested separately by your browser. Thus in your page where you want your image to appear you need your img tag looking something like: img src=/path/to/your/image_generation_script.php?optional_parameter_a=1 image_generation_script.php will obviously be the script that creates the graph and outputs the image. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Life is like a bowl of soup with hairs floating on it. You have to eat it nevertheless. -- Flaubert */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] CREATE TABLE $phpVariable_for_tableName --- help please!
On Wednesday 10 March 2004 15:11, AJ Seelund wrote: 11 //create a table 12 $sql = 'CREATE TABLE $newTable ( `daUser` VARCHAR( 255 ) NOT NULL ,' 13. ' `entryNumb` INT NOT NULL ,' 14. ' `priv` VARCHAR( 1 ) NOT NULL ,' 15. ' `comm` BLOB NOT NULL ,' 16. ' PRIMARY KEY ( `entryNumb` ) )'; 17 18 19 $resulter = mysql_query($sql) or die(There has been an error creating table: $newTable); on line 12 is where ive narrowed the error to. i know that the table name is what is supposed to be there but im trying to create this based on a post entry number and then adding _comms to the name.. Right so echo($sql) to find your error. so the comments table for post number 1 would be named: 1_comms im also having an issue with line 3, creating that name Use the concatenation operator, which is a period (.), a + is the mathematical addition operator. Also, always use mysql_error(). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Every journalist has a novel in him, which is an excellent place for it. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms and more forms?
On Friday 05 March 2004 17:10, [EMAIL PROTECTED] wrote: TO enable multiple deletions, I must place the whole table in another form. What happens is that no matter how many deletions I select, it only picks up the one at the top of the page, or none, if the top one isn't selected. print_r() or var_dump() every significant variable. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Planet Claire has pink hair. All the trees are red. No one ever dies there. No one has a head */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] No data being put into the DB
On Thursday 04 March 2004 08:08, Rich Hutchins wrote: Oh, and, normally, you reference the variables like so: $_POST[varname]. I typically use the following syntax: INSERT INTO tablename VALUES('.$_POST[varone].','.$_POST[vartwo].'); IMO it is better to use the braces syntax: insert into show values('','{$_POST['Accnt_name']}','{$_POST['acc_num']}', ...) In your query you have omitted the quotes. Don't know if that causes problems, but echoing out $addtocart would show that anyway. Also ... mysql_close(); $error = mysql_error(); call mysql_error() before you close the connection. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* If you give Congress a chance to vote on both sides of an issue, it will always do it. -- Les Aspin, D., Wisconsin */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] No data being put into the DB
On Thursday 04 March 2004 10:36, [EMAIL PROTECTED] wrote: IMO it is better to use the braces syntax: insert into show values('','{$_POST['Accnt_name']}','{$_POST['acc_num']}', ...) I'm not second guessing at all, just curious as to why? Is it less work on the parser? Do you find it cleaner? Consistent - items in arrays are always referenced by $array['item']. Clean - no jumping in and out of double-quotes I've often used Richard's method myself, for the color coding that shows in my editors(Ultraedit and VIM) when concatenating with . , mainly for readability...but have found myself, of late, using the braces more... The braces syntax highlights fine on Quanta. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Never go to bed mad. Stay up and fight. -- Phyllis Diller, Phyllis Diller's Housekeeping Hints */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL query... count?
On Monday 01 March 2004 18:53, [EMAIL PROTECTED] wrote: What I need to do for a new report, is say how many downloads were recorded for each Business unit? I can select the Business units using Distinct, but hhow can I then count them? I've tried: SELECT DISTINCT(bu)buname, COUNT(buname)bucount FROM $table_name But it doesn't work.. am I being dumb on this cold Monday morning? Don't use DISTINCT, use GROUP BY. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* One thought driven home is better than three left on base. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] User Authentication
On Friday 27 February 2004 22:26, Craig Hoffman wrote: I could use some help here. I have a script that checks a user name and password against the MySQL DB. I have it set as a function so I included/require it on the page. Here is the script: [snip] When I change the return false to return true in the first script (login) it authenticates, but logs any one in. Not good. Does anyone have any ideas or suggestions? You aren't actually performing any queries -- you're missing a mysql_query(). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* The average girl would rather have beauty than brains because she knows that the average man can see much better than he can think. -- Ladies' Home Journal */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] User Authentication
On Friday 27 February 2004 22:42, Craig Hoffman wrote: Thanks - I can't believe I missed that. :( And I'm sure you'll want to stick in a mysql_error() as well. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Write yourself a threatening letter and pen a defiant reply. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help w/ multidementional array in mysql
On Thursday 26 February 2004 01:04, PHELPS, SCOTT wrote: The problem is that it only prints one name. Also next() doesn't seem to be advancing the table so I am getting duplicates of the one name it does print to the table For starters, you're using next() incorrectly. It returns a value. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Everyone complains of his memory, no one of his judgement. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mail() and sendmail configuration
On Tuesday 24 February 2004 00:18, [EMAIL PROTECTED] wrote: This post is somewhat OT -- please forgive me. I've spent over 3 days trying to get sendmail configured and I've lost some patience and reasoning ability in the process. I have a Linux (RH9), Apache 2.0.48, PHP 4.3.4, MySQL GUI that creates a [snip] If anyone has suggestions or knows of helpful links or tutorials, I'd be deeply obliged. 0) Does the simplest mail() invocation work at all? 1) Check the php logs 2) Check the sendmail logs 3) Ask on the RedHat list 4) Ask on the sendmail list -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* To craunch a marmoset. -- Pedro Carolino, English as She is Spoke */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple values for a column
On Friday 20 February 2004 09:14, Shiloh Madsen wrote: I need to figure a way to create a table column that will allow for me to be able to say IF column = and then specify more than a single value. for instance, select all from the table where the column in question is either 1, 3, 4, and/or 7. If you're using MySQL have a look at the IN operator. However, I want this column to be able to hold more than just a single value. for instance its value would be 1, 4 or something similar like that. If you're using MySQL have a look at the column types SET and ENUM. However in general is it better not to store multiple values in a single column, they should be moved into a separate table. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Fred noticed his roommate had a black eye upon returning from a dance. What happened? I was struck by the beauty of the place. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] apache/php/mysql - guarenteed DB transaction
On Wednesday 04 February 2004 23:46, Matt Matijevich wrote: Once php has the request, hitting cancel on the browser or a browser dying will not stop the php script from executing all the way through. Actually whether the script runs through to completion depends on the 'ignore_user_abort' setting. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* I don't care who does the electing as long as I get to do the nominating. -- Boss Tweed */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] multiple fields all unique?
John W. Holmes wrote: From: Jas [EMAIL PROTECTED] Has anyone every performed such a feat as to check for matching fields before updating? And if so could you show me some code that used to accomplish this. I have written my own but the if - else statements are getting ridiculous. Are the columns actually declared UNIQUE in your database? That's the first step. Then you can just do the update, and if it fails with a specific error, you know you've hit a duplicate. The long way to do it is to just SELECT the data first, then update if there are no matches (assuming MySQL, here, but the concept is the same) $query = SELECT mac, ip FROM table WHERE mac = '{$_POST['mac']}' OR ip = '{$_POST['ip']}'; $result = mysql_query($query) or die(mysql_error()); if($row = mysql_fetch_assoc($result)) { if($_POST['mac'] == $row['mac']) { echo {$row['mac']} is already being used. ; } elseif($_POST['ip'] == $row['ip']) { echo {$row['ip'] is already being used. ; } } else { $query = UPDATE table SET mac = '{$_POST['mac']}', ip = '{$_POST['ip']}' WHERE hostname = '{$_POST['hostname']}'; $result = mysql_query($query) or die(mysql_error)); echo Record updated!; } If you want an example of the first (and better) method, let me know. ---John Holmes... Yeah, I have never used a unique field for the database, and you are right it is a mysql db. Jas -- Jason Gerfen Student Computing Group Marriott Library University of Utah (801) 585-9810 [EMAIL PROTECTED] I'm not a robot like you. I don't like having disks crammed into me... unless they're Oreos, and then only in the mouth. ~Phillip J. Fry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] db2 as a module
Hi. We run PHP as a DSO through Apache with IBM DB2 support enabled. We want to be able to run the same PHP DSO module on a second machine that will not have support for DB2. How can I configure PHP via the configuration file such that DB2 support is enabled on one host, and not on another? Thanks for any help you can provide. Jason Keltz [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] pop, php and mysql problem!
On 18 [EMAIL PROTECTED] 2004 06:54, JeRRy wrote: Could someone look/try my code below. It grabs emails from a mailbox and grabs emails within the BODY of the email and sends the details to a database to match and flag an account. Could you rephrase the above? I'm sure you meant to use email address somewhere. Anyway, in your code the while-loop and for-loop is essentially looping over the same thing. I hope you're not running a spam factory. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* No one so thoroughly appreciates the value of constructive criticism as the one who's giving it. -- Hal Chadwick */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Access and PHP problem
Hi, I am trying to INSERT into a MSAccess database using PHP 4.3 - I have a problem when I enter a name like O'Donnell. In mysql I would normally just backslash the single quote but this doesn't work with MSAccess. is there a fix for this?? Thanks in adv. Jason -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Database abstraction
On Wednesday 14 January 2004 06:04, Malte Starostik wrote: Why is there no modularization in this area, such that it'd be the _normal_ way not to write things like $dbh = ibase_pconnect( ... ), but $dbh = sql_connect( Firebird, ... ) and that would internally check if a Firebird/InterBase driver is available and if so, use it. Surely there are some differences in SQL conformance and syntax extensions, but even that could be handled by such a layer to some extent. Whilst there isn't a builtin database abstraction layer in PHP itself there are a number of projects which fills the gap. There's the semi-official PEAR-DB, also ADODB and Metabase. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Will you loan me $20.00 and only give me ten of it? That way, you will owe me ten, and I'll owe you ten, and we'll be even! */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Database abstraction
On Wednesday 14 January 2004 06:42, Martin Marques wrote: Why is it you say it's semi-official? I have always felt PEAR as much official. Well it's not in the PHP manual so I treat it as semi-official ;-) -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* QOTD: It's a cold bowl of chili, when love don't work out. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Saving arrays to databases?
On Tuesday 13 January 2004 10:59, Jeroen Wasteels wrote: Is it possible to save an array to a database? And if so, how can I display the entire array when I retreive it from the database? If not, is there some other way to store several data in one colomn/row? serialize() unserialize() -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* RAM wasn't built in a day. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Subject: grabbing text from a webpage and putting it in a query.
On Monday 05 January 2004 12:33, JeRRy wrote: Hi Neil, Could you please send me the code again please? Seems like my email client did a wibble last night and lost all my emails. :( Sorry about that. If it was a list posting from Neil that you require then look it up the archives. If you're requesting a resend of a private mail from Neil, shouldn't you be making this request in private? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Where will it all end? Probably somewhere near where it all began. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Undefined function mysql_connect
On Monday 05 January 2004 11:55, Richard Bewley wrote: I compiled mySQL 4.0.16 from source, and installed PHP 4 off the RH9 cd. I also have the php-mysql-4.2.2-17 rpm installed. But for some reason, I keep getting call to undefined function mysql_connect, and it won't connect to the mysql database. Any ideas? Either install both from source or both from RPMs. The file locations and default configs used by RH can be different from the bog-standard mysql install so there lies your problem. I recommend that you install mysql from the official rpms and apache/php from source. That way everything can be updated without relying on RH. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Love sometimes expresses itself in sacrifice. -- Kirk, Metamorphosis, stardate 3220.3 */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: BINARY not recognized ??
On Tuesday 06 January 2004 03:51, Monty wrote: Anyone ??? www.mysql.com ??? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* ...and scantily clad females, of course. Who cares if it's below zero outside (By Linus Torvalds) */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] file date upload
On Tuesday 06 January 2004 04:18, Larry Sandwick wrote: Is there a way for PHP to query a database and get the date that a data file was uploaded? Yes, as long as you've stored into the database the date that the data file was uploaded. A flat file gets uploaded on Monday Jan 5, 2004. Where can I query to get the timestamp of the upload? If it's uploaded into the filesystem then: manual Filesystem functions -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Out of the mouths of babes does often come cereal. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Shift_JIS Character Set
On Friday 12 December 2003 14:47, Ng Hwee Hwee wrote: i'm doing a form (form.php) 1) user comes to form.php 2) user enters details and press submit 3) details get passed to form action verify.php 4) verify.php puts all the $_POST into an array $formVars 5) verify.php session_register(formVars) 6) if there is an error, verify.php sends user back to form.php 7) form.php echos all the $formVars (i.e. details that user has previously entered) in their respective textfields, together with the error messages i need to stripslashes at Step7 because as you have mentioned in a previous post on this list, magic_quotes_gpc added slashes to all my $_POST. Thus, since I need to echo them, I need to stripslashes.. I tried echoing the $formVars without the stripslashes and I see all the slashes before the quotes and backslashes etc.. so, by right, with English characters, i still need to stripslashes. OK, if you *know* that the data has been through addslashes() (or equivalent eg magic_quotes_gpc) then doing a strip_slashes() should revert the data to its original form. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* The sheep that fly over your head are soon to land. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] More of a question rather than seeking code. :)
On Friday 12 December 2003 20:15, JeRRy wrote: [snip] I just recently added a flag in the database so if the email bounces I manully flag the account as a bad email so in future emails won't be sent to that users email unless they correct their email. This is time consuming. [snip] Do yourself a big favour and setup something using a real mailing-list software. Any decent mailing-list manager will handle bounces automatically. Sustained bounces from an email address will eventually lead it to being suspended or unsubscribed automatically. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Youth. It's a wonder that anyone ever outgrows it. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Slashes
On Thursday 11 December 2003 17:27, Ng Hwee Hwee wrote: can I know when does the magic_quotes_gpc start adding slashes and stripping slashes? magic_quotes_gpc is for incoming GET/POST/Cookie data (NB it does not strip slashes) ... I removed my EscapeShellCmd and my data is inserted and retrieved from the database just as i wanted. The problem now comes when I retrieve that data and immediately inserted them into another table.. ... you can enable magic_quotes_runtime if you want to automatically quote data retrieved from DB (and other runtime generated data) ... But you would be much better off if you disable all magic_quotes_* and do manual quoting and escaping where necessary. That way you will know exactly what is being done to your data. then I get a MySQL error 1064 whenever my value has a single-quote in it. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* ...the prevailing Catholic odor - incense, wax, centuries of mild bleating from the lips of the flock. -- Thomas Pynchon, _Gravity's Rainbow_ */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Shift_JIS Character Set
On Friday 12 December 2003 13:47, Ng Hwee Hwee wrote: i've read the following comment on PHP.net and found it very troubling because my database has Shift_JIS japanese words and my forms allow japanese input as well, so, does anyone know how can I stripslashes correctly when it comes to Japanese text? thanx thanx! Normally you would not need to use stripslashes() anyway. What are you trying to do? hash at samurai dot fm 01-Dec-2003 10:34 Might I warn readers that they should be vary careful with the use of stripslashes on Japanese text. The shift_jis character set includes a number of two-byte code charcters that contain the hex-value 0x5c (backslash) which will get stripped by this function thus garbling those characters. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* I've never been drunk, but often I've been overserved. -- George Gobel */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Splitting a string by a ,
On Friday 05 December 2003 15:23, Chris Payne wrote: I'm trying to split a string into an Array by a , but I kepe getting errors. Looking at the PHP manual, I thought it would be this way: $keywords = preg_split(,, $email); But it keeps saying that the , isn't an ending delimiter? Study and *understand* the examples liberally plastered all over the chapter Regular Expression Functions (Perl-Compatible). Even if you don't fully understand it, at least figure out the basic syntax of how to specify a regex. Hint: all you need to know is contained in the error message and the introductory paragraph. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* You cannot propel yourself forward by patting yourself on the back. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL join with variable table?
On Tuesday 18 November 2003 10:00, Jason Godesky wrote: In a MySQL database, I have several tables, including one central table that essentially keeps track of the records in the other tables. TABLE1 +---+---+---+ | id| str | val1 | +---+---+---+ | 123456789 | TABLE2| 987654321 | +---+---+---+ TABLE2 +---+---+ | id| val2 | +---+---+ | 123456789 | j00 r0xx0r | +---+---+ Currently, I'm selecting all the records for a given entry with two SELECT statements, one to the central table which gives me the name of the second table. My question is, is there any way to do this in a single query with a join? I suspect not, but I wanted to see if anybody on this list had any ideas before I give up on the possibility entirely. But why are you storing the tablenames in a central table? Maybe I'm too stupid but I can't see any advantage in doing so. And in doing so you're creating that little problem for yourself. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Fashions have done more harm than revolutions. -- Victor Hugo */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Read file
On Tuesday 18 November 2003 09:29, Ng Hwee Hwee wrote: can anyone enlighten me on how i can use PHP to read the contents of a file from the client's machine?? for eg, the client has a CSV file in his MyDocuments directory, how can I read the contents and publish them on the web? You have to ask them to upload it to the server: manual Handling file uploads -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* QOTD: My life is a soap opera, but who gets the movie rights? */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL join with variable table?
In a MySQL database, I have several tables, including one central table that essentially keeps track of the records in the other tables. TABLE1 +---+---+---+ | id| str | val1 | +---+---+---+ | 123456789 | TABLE2| 987654321 | +---+---+---+ TABLE2 +---+---+ | id| val2 | +---+---+ | 123456789 | j00 r0xx0r | +---+---+ Currently, I'm selecting all the records for a given entry with two SELECT statements, one to the central table which gives me the name of the second table. My question is, is there any way to do this in a single query with a join? I suspect not, but I wanted to see if anybody on this list had any ideas before I give up on the possibility entirely. -- Jason Godesky [EMAIL PROTECTED] http://www.tribaldawn.com/jason/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Read file
On Tuesday 18 November 2003 09:58, Ng Hwee Hwee wrote: the reason i don't want to read from the server is because i don't want to use up too much space and processing time on the server.. the file has 50,000 records of information.. is there another way other than uploading on the server side?? Two options: 1) You can recompile PHP with the startrek module and use startrek_transport() to instantly transfer anything (data, even physical objects) from anywhere to anywhere else. 2) You can use telepathic means to read the data stored on the client, then type it into a file and save onto the server. But technically speaking, both of the above are still variations of 'uploading' the file onto the server. So another option is: 3) Install a webserver on the client and serve the files from there instead. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* If a program actually fits in memory and has enough disk space, it is guaranteed to crash. -- Murphy's Computer Laws n5 */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] CSV Import Question
On Tuesday 18 November 2003 12:34, Chris Payne wrote: I have a 2 Column CSV file, and i'm trying to import it into the DB via a form, I have it importing fine with the first field (Called EMail) but I cannot get it to import the second column correctly (Called name). I know it's going to be something so obvious i'll pass out, but does anyone have any ideas? Here's the code: $row = 1; $handle = fopen ($userfile,r); while ($data = fgetcsv ($handle, 250, $delim)) { $num = count ($data); $row++; for ($c=0; $c $num; $c++) { mysql_query (INSERT INTO emaillist (EMail,name) VALUES ('$data[$c]','$data[$c]') When I import, it puts all data in the EMail field, even the name field. What's $delim? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Business will be either better or worse. -- Calvin Coolidge */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] CSV Import Question
On Tuesday 18 November 2003 13:07, Chris Payne wrote: any ideas? Here's the code: $row = 1; $handle = fopen ($userfile,r); while ($data = fgetcsv ($handle, 250, $delim)) { $num = count ($data); $row++; for ($c=0; $c $num; $c++) { mysql_query (INSERT INTO emaillist (EMail,name) VALUES ('$data[$c]','$data[$c]') When I import, it puts all data in the EMail field, even the name field. What exactly do you mean by puts all data in the EMail field? Does print_r($data) look OK? And you do realise that in your SQL statement you're inserting the same value for both EMail and name? What's $delim? Sorry, delim is from the form you use to select the CSV file, as you can select the char as the seperator (I have set the default to a COMMA though). By that you do mean: $delim = ','; and not $delim = COMMA; ? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Pilfering Treasury property is paticularly dangerous: big thieves are ruthless in punishing little thieves. -- Diogenes */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: imagecreatetruecolor ?
On Friday 14 November 2003 08:03, niclas meyer wrote: Thanks for ure time...It was a browser cache issue..I made my album on the fly finaly, it does as i wanted in the end.. make sure u have the latest PHP/GD support ..=) Niclas Meyer [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Hi all! I trying to create a true color Jpeg thumbnail, I take a picture (Jpg/jpeg) resized and copied - inserted to database and a thumbnail is saved in a diffrent folder BUTthe thumb looks wierd. It does NOT look like its made out of true color..lol where do I go wrong? =) //_---pic part of function -- $tmp_img = imagecreatetruecolor($new_width, $new_height); imagecopyresized($tmp_img, $img, 0, 0, 0, 0, $new_width, You most likely want to use imagecopyresampled() instead. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Ego sum ens omnipotens. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] CONVERT STRING VARIABLES TO DATES, THEN COMPARE (HOW?)
On Saturday 08 November 2003 02:44, Karen Resplendo wrote: Apache on NT using MS SQL Srvr 2000 PHP 4.03pl1 I return these dates into strings and now I want to compare my database date to see if it is later than today's date. Pretty sure my Expires field is a string: Here is the Expires field from the SQL: Convert(varchar, DATEADD(Year,3,DateCertified),101) AS Expires Here is my PHP code trying to compare dates: $today = date(m/d/Y); If ($today odbc_result($data,Expires)) { echo brbrLicense has expiredbrbr; } Else { echo brbrLicense has not expiredbrbr; } Sure could use a simple solution to a simple problem that has me simply confounded. Why not just do the comparison directly within the query? And if you want to get the above working, have you tried debugging it? Like: print($today); print(odbc_result($data,Expires)); Are they what you expected them to be? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Alaska: A prelude to No. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Using PHP to print using LP on Linux
This is what i use: exec (lpr -P $PrinterName $PostscriptFile,$printOut , $printReturn); Paul Fitz wrote: Hi Guys, I suppose this isn't a database specific question, but it is the only PHP mailing list I am subscribed to. Trying to trigger a printer in the office hooked up to a Mandrake 8 box with PHP 4.3 to print a file remotely, using the 'lp' command. Uses a postscript template to create the text that needs printing. Opens and edits the postscript fine, the printer refuses to work using the last section of code however. Does anybody have experience using lp with PHP and Linux? Any help appreciated. Cheers. My Code - $filename = new_user_letter.ps; $fp = fopen($filename,r); $fdata = fread($fp, filesize($filename)); fclose($fp); //search and replace all keywords $fdata = ereg_replace(%%full_name%%,$fullname,$fdata); $fdata = ereg_replace(%%street_address%%,$streetaddress,$fdata); $fdata = ereg_replace(%%town%%,strtoupper($town),$fdata); $fdata = ereg_replace(%%state%%,strtoupper($state),$fdata); $fdata = ereg_replace(%%postcode%%,strtoupper($postcode),$fdata); $fdata = ereg_replace(%%date%%,$long_date,$fdata); $fdata = ereg_replace(%%username%%,$username,$fdata); $fdata = ereg_replace(%%email_address%%,$username . @nor.com.au,$fdata); $fdata = ereg_replace(%%password%%,$password,$fdata); $fdata = ereg_replace(%%primary_dns%%,202.147.135.10,$fdata); $fdata = ereg_replace(%%secondary_dns%%,202.147.135.20,$fdata); $fdata = ereg_replace(%%pop_location_and_ph_number%%,$location . - . $dial_in_number,$fdata); $fdata = ereg_replace(%%domain_name%%,nor.com.au,$fdata); $fdata = ereg_replace(%%pop3_server%%,mail.nor.com.au,$fdata); $fdata = ereg_replace(%%smtp_server%%,mail.nor.com.au,$fdata); $fdata = ereg_replace(%%news_server%%,news.nor.com.au,$fdata); // Open the lp command for writing and pass the postscript to it. // The loop is to allow multiple copies to be printed, for ($copy_loop=0;$copy_loop$num_copies;$copy_loop++){ $fp = popen(/usr/bin/lp -d bw_laser_raw,w); fputs($fp,$fdata,strlen($fdata)); pclose($fp); echo .; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Form Variables
On Wednesday 22 October 2003 17:09, Ng Hwee Hwee wrote: i am using sessions already. in fact, header(Cache-control: private); worked in my other applications but not this one.. is it true that because page1.php is a https:// page so it can't cache my entries? Perhaps you had better start from the beginning and state what exactly you're trying to do, pages involved, how you're getting from one page to another, etc. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Design flaws travel in groups -- Sad Truths of Life n2 */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Form Variables
On Wednesday 22 October 2003 15:06, Ng Hwee Hwee wrote: got an urgent problem.. it's regarding forms. my system works like this.. 1) user on page1 fills up form 2) upon clicking submit button, it will go to verify.php to verify if the entries are correct 3) if there is any errors, verify.php brings user back to page1 with all the errors listed beside the incorrect field entries my problem is: how do i make the user's browser remember the data they filled up at page1? i tried header(Cache-control: private); but to no avail.. You don't. Your application has to remember the filled in values and when presenting page1.php again it pre-populates the form with the 'remembered' values. The easiest way to remember the values is to use sessions. Or alternatively you can one of the dozens of form validation classes that are available (www.phpclasses.org et al) to do the donkey work for you. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Famous quotations: -- Charlie Chaplin -- Harpo Marx -- Marcel Marceau */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Wrong Parament count
On Wednesday 22 October 2003 14:55, Tonya wrote: MYSQL and PHP 4.3.3 *sigh* I hate eregs and I'm really bad with them :/ I have a form that has a field in which the user is supposed to enter an IRC channel name. IRC channel names begin with a '#'. ereg(^#) does not work. I am getting the error Warning: Wrong parameter count for ereg() Jeez, at least make a token effort. See the manual entry for ereg()? It expects at least 2 parameters. Surely you can count past one? And surely the error message is explicit enough? Can someone give me a working ereg for this?? :) No. But here's a snippet using preg_match(): $input_string = #ircchannel; if (preg_match(/^#[a-zA-Z]+/, $input_string) { echo Looks like an irc channel; } else { echo Go check your input; } What the above checks for is: 1) A line that begins with a hash (#) 2) Followed by one or more letters (non case-sensitive) 3) And nothing else I don't know what letters/symbols/characters constitute a valid IRC channel so you may have to season the above to taste. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* The majority of husbands remind me of an orangutang trying to play the violin. -- Honor'e DeBalzac */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Wrong Parament count
On Wednesday 22 October 2003 16:15, Jason Wong wrote: $input_string = #ircchannel; if (preg_match(/^#[a-zA-Z]+/, $input_string) { echo Looks like an irc channel; } else { echo Go check your input; } Sorry that regex should look like: if (preg_match(/^#[a-zA-Z]+$/, $input_string) { -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* The problem that we thought was a problem was, indeed, a problem, but not the problem we thought was the problem. -- Mike Smith */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: textarea with multiple rows and mysql insert
dunno if this made it: Here's an example. In the first textbox of the form I write in the following link: http:///x/servlet/xAuthGW/wt.enterprise.URLProcessor/URLTemplateAction?u8oid=OR%3Awt.folder.SubFolder%3A492999action=ObjProps And in the second box: These are comments that I am writing in the textarea that is available for these. The resulting insert statement is: INSERT into aplicaciones set id = NULL, Nombre = AUTOCAD, Version = 2000, Modulo = , Fabricante = AUTODESK, mansycontratos = http:///x/servlet/xAuthGW/;, comentarios = These are comments that I am writing in the textar, cat_id = 1 Jay --- Viorel Dragomir [EMAIL PROTECTED] wrote: mysql_escape_string? [try to print what kind of values do you receive in post vars] vio- - Original Message - From: Jason End [EMAIL PROTECTED] To: George Patterson [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, October 13, 2003 10:35 AM Subject: Re: [PHP-DB] Re: textarea with multiple rows and mysql insert I'm using post Here's the code: --- html headtitleDetalles/title/head body bgcolor=white form method=post action=editarsoftsel.2.php table [...] tr tdfontManuales:/font/td tdtextarea name=manuales rows=2 cols=50? echo $formVars[mansycontrato] . http://;; ?/textarea/td /tr tr tdfontComentarios:/font/td tdtextarea name=comentarios rows=5 cols=50? echo $formVars[comentarios]; ?/textarea/td /tr tr tdbrinput type=image src=enviar.gif border=0 INPUT name=submit type=hidden value=1/td /tr /table /form /body /html --- --- George Patterson [EMAIL PROTECTED] wrote: On Sun, 12 Oct 2003 23:31:55 -0700 (PDT) Jason End [EMAIL PROTECTED] wrote: The type was already set to text. The problem isn't at the mysql level but at the form/php level. The insert statement that is formed extracting the values from the form is only giving that part of the url or comments. Jay Jason, Are you using the get or post form method?? If the method isn't specified, browser will default to Get. The get method is will truncate the data from the browser, whereas the Post method will allow alot more. Consider posting back the html for the form. The other possiblity is that you have carriage returns comming back from the form that you need to parse out. George Patterson --- Dan Brunner [EMAIL PROTECTED] wrote: What is your field length??? Varchar(10)?? You should set the column type to text. Dan On Oct 10, 2003, at 10:27 AM, [EMAIL PROTECTED] wrote: I have a form that includes two text areas that span multiple rows. The first textarea (rows=2, cols=50) is used to insert a pretty long url, while the second (rows=5, cols=50) is used for inserting free text (comments). When I process the form to create the mysqlinsert statement, the values inserted for both those text areas get cut off after the end of each row. How can I get the script to process the full contents? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: textarea with multiple rows and mysql insert
The type was already set to text. The problem isn't at the mysql level but at the form/php level. The insert statement that is formed extracting the values from the form is only giving that part of the url or comments. Jay --- Dan Brunner [EMAIL PROTECTED] wrote: What is your field length??? Varchar(10)?? You should set the column type to text. Dan On Oct 10, 2003, at 10:27 AM, [EMAIL PROTECTED] wrote: I have a form that includes two text areas that span multiple rows. The first textarea (rows=2, cols=50) is used to insert a pretty long url, while the second (rows=5, cols=50) is used for inserting free text (comments). When I process the form to create the mysql insert statement, the values inserted for both those text areas get cut off after the end of each row. How can I get the script to process the full contents? thanks __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.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 __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: textarea with multiple rows and mysql insert
I'm using post Here's the code: --- html headtitleDetalles/title/head body bgcolor=white form method=post action=editarsoftsel.2.php table [...] tr tdfontManuales:/font/td tdtextarea name=manuales rows=2 cols=50? echo $formVars[mansycontrato] . http://;; ?/textarea/td /tr tr tdfontComentarios:/font/td tdtextarea name=comentarios rows=5 cols=50? echo $formVars[comentarios]; ?/textarea/td /tr tr tdbrinput type=image src=enviar.gif border=0 INPUT name=submit type=hidden value=1/td /tr /table /form /body /html --- --- George Patterson [EMAIL PROTECTED] wrote: On Sun, 12 Oct 2003 23:31:55 -0700 (PDT) Jason End [EMAIL PROTECTED] wrote: The type was already set to text. The problem isn't at the mysql level but at the form/php level. The insert statement that is formed extracting the values from the form is only giving that part of the url or comments. Jay Jason, Are you using the get or post form method?? If the method isn't specified, browser will default to Get. The get method is will truncate the data from the browser, whereas the Post method will allow alot more. Consider posting back the html for the form. The other possiblity is that you have carriage returns comming back from the form that you need to parse out. George Patterson --- Dan Brunner [EMAIL PROTECTED] wrote: What is your field length??? Varchar(10)?? You should set the column type to text. Dan On Oct 10, 2003, at 10:27 AM, [EMAIL PROTECTED] wrote: I have a form that includes two text areas that span multiple rows. The first textarea (rows=2, cols=50) is used to insert a pretty long url, while the second (rows=5, cols=50) is used for inserting free text (comments). When I process the form to create the mysqlinsert statement, the values inserted for both those text areas get cut off after the end of each row. How can I get the script to process the full contents? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: textarea with multiple rows and mysql insert
Here's an example. In the first textbox of the form I write in the following link: http:///x/servlet/xAuthGW/wt.enterprise.URLProcessor/URLTemplateAction?u8oid=OR%3Awt.folder.SubFolder%3A492999action=ObjProps And in the second box: These are comments that I am writing in the textarea that is available for these. The resulting insert statement is: INSERT into aplicaciones set id = NULL, Nombre = AUTOCAD, Version = 2000, Modulo = , Fabricante = AUTODESK, mansycontratos = http:///x/servlet/xAuthGW/;, comentarios = These are comments that I am writing in the textar, cat_id = 1 Jay --- Viorel Dragomir [EMAIL PROTECTED] wrote: mysql_escape_string? [try to print what kind of values do you receive in post vars] vio- - Original Message - From: Jason End [EMAIL PROTECTED] To: George Patterson [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, October 13, 2003 10:35 AM Subject: Re: [PHP-DB] Re: textarea with multiple rows and mysql insert I'm using post Here's the code: --- html headtitleDetalles/title/head body bgcolor=white form method=post action=editarsoftsel.2.php table [...] tr tdfontManuales:/font/td tdtextarea name=manuales rows=2 cols=50? echo $formVars[mansycontrato] . http://;; ?/textarea/td /tr tr tdfontComentarios:/font/td tdtextarea name=comentarios rows=5 cols=50? echo $formVars[comentarios]; ?/textarea/td /tr tr tdbrinput type=image src=enviar.gif border=0 INPUT name=submit type=hidden value=1/td /tr /table /form /body /html --- --- George Patterson [EMAIL PROTECTED] wrote: On Sun, 12 Oct 2003 23:31:55 -0700 (PDT) Jason End [EMAIL PROTECTED] wrote: The type was already set to text. The problem isn't at the mysql level but at the form/php level. The insert statement that is formed extracting the values from the form is only giving that part of the url or comments. Jay Jason, Are you using the get or post form method?? If the method isn't specified, browser will default to Get. The get method is will truncate the data from the browser, whereas the Post method will allow alot more. Consider posting back the html for the form. The other possiblity is that you have carriage returns comming back from the form that you need to parse out. George Patterson --- Dan Brunner [EMAIL PROTECTED] wrote: What is your field length??? Varchar(10)?? You should set the column type to text. Dan On Oct 10, 2003, at 10:27 AM, [EMAIL PROTECTED] wrote: I have a form that includes two text areas that span multiple rows. The first textarea (rows=2, cols=50) is used to insert a pretty long url, while the second (rows=5, cols=50) is used for inserting free text (comments). When I process the form to create the mysqlinsert statement, the values inserted for both those text areas get cut off after the end of each row. How can I get the script to process the full contents? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] textarea with multiple rows and mysql insert
I have a form that includes two text areas that span multiple rows. The first textarea (rows=2, cols=50) is used to insert a pretty long url, while the second (rows=5, cols=50) is used for inserting free text (comments). When I process the form to create the mysql insert statement, the values inserted for both those text areas get cut off after the end of each row. How can I get the script to process the full contents? thanks __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] pathinformation from file-field
On Monday 06 October 2003 18:31, Ruprecht Helms wrote: how can I get the pathinformation you can see in the file-field if you chose one file within a formular for transfer. If you mean when you do an HTTP upload, then no, you cannot get the path info. All you get is the file name. This is for security reasons. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* I believe a little incompatibility is the spice of life, particularly if he has income and she is pattable. -- Ogden Nash */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Trouble with uploading a file via ftp_put
On Monday 06 October 2003 16:48, Ruprecht Helms wrote: I want that (B) can locate the file on (A) and upload it to the subdirectory on (B). This should also be possible in the case the user have no ftp-server on his local pc. If (A) does not have an ftp server installed then you're asking for the impossible. Why I want try it without the standart FTP client. The script is part of a portal and because of comfortreasons and securityreasons I want the upload and the entry in a database act with php on (B). The only standard way in which a website, ie (B), can get a file from a web browser, ie (A), is through HTTP upload. (B) has a ftpserver included. If the way over ftp is the wrong way, you can also tell me how to do this with the normay copy-command. (B) which is running the script is in effect the ftp client, it needs to be able to connect to an ftp server. COnnecting to itself isn't very useful. In other words you need an ftp server on (A). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* A fool-proof method for sculpting an elephant: first, get a huge block of marble; then you chip away everything that doesn't look like an elephant. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Trouble with uploading a file via ftp_put
On Sunday 05 October 2003 17:15, Ruprecht Helms wrote: by uploading a file via the ftp_put-command the upload is not done properly. Result is I have a file in the destinationdirectory but 0 bit in size, only the filename is transfered. How have I to write the script that the file I want upload should be uploaded within the correct size. The actual script you can see here. [code] $conn_id=ftp_connect('62.241.50.14'); ftp_login($conn_id,'user','password'); echo Current directory : , ftp_pwd($conn_id), \n; ftp_chdir($conn_id,html); echo Current directory is now : , ftp_pwd($conn_id), \n; $dstdir=html; $upload=ftp_put($conn_id,$bild,$dstdir./.$bild,FTP_BINARY); [/code] 1) You've got your source-file and destination-file mixed up. 2) You've already chdir into 'html' so destination-file so be just '$bild' and not '$dstdir./.$bild'. Unless your directory structure really is 'html/html/' -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Sometimes a cigar is just a cigar. -- Sigmund Freud */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Confused
On Sunday 05 October 2003 23:44, Robin Kopetzky wrote: I need to setup a user, 'commerce' with a password, that can be accessed from any web server in our farm 'blackmesa-isp.net'. What GRANT statement do I need to make this work? I've tried a bunch of the examples in the manual and can't get it right. Specifically, I need the user to CONNECT, SELECT, INSERT, UPDATE, DELETE and that's all for privileges. Any help is appreciated. This has *nothing* to do with PHP, try asking on the MySQL list. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Your computer account is overdrawn. Please reauthorize. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Trouble with uploading a file via ftp_put
On Sunday 05 October 2003 21:54, Ruprecht Helms wrote: actual I have the following script. I want to upload a image from the local pc into the subdir html of a webspace. You *are* running this script on the local pc aren't you? The file I want to upload is not stored in the destinationdirectory. Check your 'destinationdirectory': 1) it's missing a '/'. 2) '+' is an mathematical addition operator, '.' is a string concatenation operator This is my actual script ? ... $conn_id=ftp_connect('62.241.50.14'); ftp_login($conn_id,'user','password'); echo Current directory : , ftp_pwd($conn_id), \n; //ftp_chdir($conn_id,html); echo Current directory is now : , ftp_pwd($conn_id), \n; echo brBilddatei ; echo $bild; $upload=ftp_put($conn_id,'html'+$bild,$bild,FTP_BINARY); ? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Kafka's Law: In the fight between you and the world, back the world. -- Franz Kafka, RS's 1974 Expectation of Days */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SoS
Your if statement will only be TRUE if $id is set to FALSE, NULL or zero (0)--I think you're looking for if the variable is set. That would be: if (isset($id)) -- Jason Godesky [EMAIL PROTECTED] http://www.tribaldawn.com/jason/ I'm a beginner of PHP. While trying the code from a tutorial, I encountered the following problem. The variable $id can not be transfered to my server. You can find the code at the end of this email. When I visit http://mydomain.com/test.php?id=1 it always shows the list of the database instead of a perticular record. I appreciate your kind helps! Zhan Xu EECS Department Case Western Reserve University -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SoS
if the statement if (isset($id)) doesn't probably it because register_globals has been turned off maybe? How about if (isset($_GET[id])) ? And if you want to keep the flexibility of getting the variable from anywhere, you can always use if ((isset($_GET[id]))||(isset($id)))--that would cover query strings, and the case of any possible includes. -- Jason Godesky [EMAIL PROTECTED] http://www.tribaldawn.com/jason/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SoS
On Monday 06 October 2003 10:18, [EMAIL PROTECTED] wrote: I figured it out! The register_globals is turned off. To parse the id with this parameter off, I just need to judge whether $_GET[id] is set or not. The problem is that I wrote the SQL statement as: $SQLstr=SELECT * FROM employees WHERE id=$_GET[id]; That's a wrong one. To solve this, I do the following (a naive one): $tid=$_GET[id]; $SQLstr=SELECT * FROM employees WHERE id=$tid; And it's OK. You can do something like: $SQLstr=SELECT * FROM employees WHERE id={$_GET['id']}; But for security you should always check the integrity of any input that you receive from the user. For example, in this case you should verify that $_GET['id'] is indeed an integer and nothing else. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* God grant me the senility to accept the things I cannot change, The frustration to try to change things I cannot affect, and the wisdom to tell the difference. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] fopen : Supplied argument is not a valid File-Handle resource
On Tuesday 30 September 2003 18:35, Ferdian wrote: How about putting in some error checking code as per example in manual? The error was on : $ns = fsockopen($com_server,43); fputs($ns,$domname\r\n); That is *where* the error occurred. But *what* is the error? Again, refer to examples in manual. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Somehow I reached excess without ever noticing when I was passing through satisfaction. -- Ashleigh Brilliant */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Replacing + with question
On Wednesday 01 October 2003 01:06, Graeme McLaren wrote: This is what I have so far by the string replace function doesn't replace the spaces and display bla bla bla as I want: Probably it's because you're trying to replace spaces with +. Swap your first 2 parameters. $AddressLine1 = urlencode($AddressLine1); $AddressLine1 = str_replace( , +, $AddressLine1); -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Surprise your boss. Get to work on time. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] HELP-PHP install
On Wednesday 01 October 2003 01:39, Balazs Nemeth wrote: cd /apache/apache-xxx ./configure --prefix=/www cd /php/php-xxx ./configure --with-mysql --with-apache=/apache/apache-xxx --enable-track-vars make make install cd /apache/apache-xxx ./configure --activate-module=src/modules/php4/libphp4.a make make install cd /php/php-xxx cp php.ini-dist /usr/local/lib/php.ini Then I edited the httpd.conf: AddType application/x-httpd-php .php AddType application/x-httpd-php .html User=www Group=www(of course, the user and the group were created with the useradd www and groupadd www commands previously) Check that httpd.conf contains these lines: LoadModule php4_modulelibexec/libphp4.so AddModule mod_php4.c If not, add those lines -- placing them at the end of their respective groups. Here I started the apache(./apachectl start) which worked properly. Check the apache error log to see whether that gives any clues. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Asynchronous inputs are at the root of our race problems. -- D. Winker and F. Prosser */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Excel file into MySQL
On Wednesday 01 October 2003 02:23, Jonathan Villa wrote: On Tue, 2003-09-30 at 10:31, Jonathan Villa wrote: Is it possible to transfer information from an excel file (33,000 rows) into MySQL using phpMyAdmin or MySQL CC? Be patient! In the meantime how about reading the manuals/feature list for those two applications you mentioned? And asking on *their* mailing lists? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* The fundamental principle of science, the definition almost, is this: the sole test of the validity of any idea is experiment. -- Richard P. Feynman */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] fopen : Supplied argument is not a valid File-Handle resource
On Monday 29 September 2003 15:30, Ferdian wrote: Please post to the correct list, this has nothing to do with databases. Please do not post multiple times. Wait patiently for a response! I use this script [snip] $ns = fsockopen($com_server,43); fputs($ns,$domname\r\n); $result = ''; while(!feof($ns)) $result .= fgets($ns,128); fclose($ns); if (eregi($com_nomatch,$result)) { dispav($domname); } else { dispun($domname,$com_server); } } echo 'trtd colspan=5 class=separatornbsp;/td/tr'; } my PHP Version 4.1.2 And I get Warning : Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site1/web/whoisnew.php on line 584 [snip] How about putting in some error checking code as per example in manual? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Documentation: Instructions translated from Swedish by Japanese for English speaking persons. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to post code and avoid spam filter in Yahoo?
On Saturday 27 September 2003 00:04, Karen Resplendo wrote: I keep getting Spam warnings on this list whenever I post code. Is there anyway around this? I'm not sure my questions can be answered without showing the code that I am having trouble with. You're not doing anything wrong. It's a fellow list subscriber ([EMAIL PROTECTED]) who has an incorrectly configured SpamAssassin setup and is churning out these misleading warnings. If not, then I will have to get my boss to subscribe and post from his ISP account. No need. Just ignore those 'warnings'. Your posts are coming through fine. Could the List Moderator chuck this guy, [EMAIL PROTECTED], off the list? Or at least ask him to configure his mail system properly. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Don't abandon hope: your Tom Mix decoder ring arrives tomorrow. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql, finding the last record
On Saturday 27 September 2003 01:04, John Ryan wrote: is there any quick way of selecting the 'last' row in a mysql table?? i could write some messy code but id prefer an elegant solution. mysql_num_rows() mysql_data_seek() -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Sometimes when you look into his eyes you get the feeling that someone else is driving. -- David Letterman */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] fgetcsv() only returns half of the rows
On Friday 26 September 2003 23:46, Karen Resplendo wrote: There are 113 rows in my comma delimited text file and the code below only displays 62 of them. It executes very quickly so I'm not thinking there is a time out problem. Any ideas? //here is URL with fgetcsv() explanation: http://us3.php.net/manual/en/function.fgetcsv.php $uploadthis = 'C:/AsciiTestJohn/OR100012-09252003.txt'; $row = 1; $handle = fopen ($uploadthis,r); rewind($handle); while ($fieldarray = fgetcsv ($handle, 300, ,)) { $fieldcount = count ($fieldarray); print p $fieldcount fields in line $row: br\n; $row++; for ($c=0; $c $fieldcount; $c++) { print $fieldarray[$c] . br\n; } Your logic here seems a bit odd. In your WHILE clause you're reading chunks of 300 chars at a time. Then in the code below, you're reading in another chunk of 300 chars. Thus each iteration of the WHILE-loop reads in 600 chars from the file. Is that your real intention? $buffer = fgets($handle,300); $buffer = str_replace(\,,$buffer); print $buffer.br; } //end of while loop fclose ($handle); -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* ...there can be no public or private virtue unless the foundation of action is the practice of truth. - George Jacob Holyoake */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] fgetcsv() only returns half of the rows
On Saturday 27 September 2003 01:24, Karen Resplendo wrote: Does that mean that my length setting has to be exactly the length of the row? No. I don't know this because it is a comma delimited file, not a space delimited. The function description says: The length parameter must be greater than the longest line to be found in the CSV file (allowing for trailing line-end characters). So set it to [max line length]+10. I removed this block where I do an fgets() and then I get all rows displayed. Also, I was mistaken about total rows. There are 123 and I only display 62, which is half, so I'm thinking something is being incremented twice instead of once. Exactly, that block of code below is reading in another line. What is it's purpose anyway? What are you trying to achieve? What should I set the length at?: $buffer = fgets($handle,300); $buffer = str_replace(\,,$buffer); print $buffer.br; -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* The wise man seeks everything in himself; the ignorant man tries to get everything from somebody else. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Need some MySQL Optimization suggestions - uber slow queries
On Friday 26 September 2003 22:58, Matt Babineau wrote: I have a page that when all said and done is super slow. The queries are running a bunch of JOINs and SORTs and WHEREs. I recently implemented the my-large.cnf file in hopes it would help out the situation, but the change appears negligible. Does anyone have any suggestions for speeding up the query process...a lot? Try asking on the mysql list? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* There is no grief which time does not lessen and soften. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Email Application
On Thursday 25 September 2003 05:42, [EMAIL PROTECTED] wrote: I am not so new in PHP but I have a problem. I am trying to create a webmail program for my penpal site. I cant retrieve and desplay e-mails from my mail server. Any one with ideas? With the limited amount of information give, I would say there is something wrong with your code. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Marriage is the waste-paper basket of the emotions. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Reference to SQL qyery result ????????
On Sunday 21 September 2003 17:37, Evgeny wrote: When I run this query in MySqlAdmin the result is 124 but I can't retrieve the result by code $result = $DB_site-query(SELECT MAX(id) AS ID1 FROM chatbox ); $rangee = mysql_fetch_assoc($result) ; $identifiant = $rangee['id1'] ; What the problem ? Case-sensitivity issue? Did you try *any* debugging at all? Eg print_r($rangee)? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Love is in the offing. Be affectionate to one who adores you. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] set password on a page
On Monday 22 September 2003 00:17, SAGERAT wrote: How do I set up password on a page so that only restricted people can open it? google php user authentication tutorial -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* I consider the day misspent that I am not either charged with a crime, or arrested for one. -- Ratsy Tourbillon */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Passing variables between html forms and updating sql table
On Wednesday 17 September 2003 22:34, David wrote: I am putting together some pages where I will be able to update mysql database using php pages. I am having a problem with updating. I put a record into textboxes and when I press submit it passes the values to the next page. The problem I am having is updating the values. Here is my attempt [snip] And can you describe what this problem is? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* I learned to play guitar just to get the girls, and anyone who says they didn't is just lyin'! -- Willie Nelson */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Why varying functionality across php db apis for db metadata?
On Wednesday 17 September 2003 18:46, pete M wrote: Mike Klein wrote: For example, php mysql library supports list_dbs and list_tables commands as well as getting table metadata. MySQL sql also 'natively' supports these commands (show databases, show tables, describe tableName). Why not similar commands for Oracle, SQLServer, etc.? These are simply selects against certain system tables, no? Go and ask M$ and Oracle.. I doubt whether they have anything to do with it (although it's nice to blame everything on M$), but rather it is author(s) of the particular DB extensions who you have to thank for the current inconsistencies. I think some move is being made to make the commands consistent across the different DBs. Eg the names of the postgresql functions are being changed to match those of the mysql functions. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Hello? Enema Bondage? I'm calling because I want to be happy, I guess ... */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Passing variables between html forms and updating sql table
On Wednesday 17 September 2003 23:42, David wrote: Here is my original problem below as I am treated as spam. When it reaches the next page, when the update query is run, it does not update the database. *sigh* Could you please describe *exactly* what happens. Eg does your error messages kick-in? Does the php error logs show anything? etc -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* I am two fools, I know, for loving, and for saying so. -- John Donne */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Passing variables between html forms and updating sql table
On Thursday 18 September 2003 01:03, David wrote: I need a secure way of updating mysql on the website, phpadmin is not secure enough Why is phpadmin not secure enough? Or to put it another way, what are you doing differently that makes it more secure than php admin? So I have created these pages in order: A page to choose the databases Next a page to choose the table Next a list of the records in the table Next to edit the page using textboxes and textareas I pass the database name, table name, and the records to change to the page with the problem. The passed values have the same field name as the record in the database e.g. id The problem I can see is that I cannot access the passed variables, that is why the update is failing , Most likely register_globals (google or search archive or RTFM). although I do not get any errors. Have you set the highest level of error reporting? And set it to display errors (or log to file)? I am trying to access the passed variables with this line $fieldname2 = $.$fieldname; Not sure what you're trying to do here but ... ?php $MySQLLink = mysql_pconnect (davecp4, root, ) or die(Could not attach to database. Please try later or contact [EMAIL PROTECTED]); mysql_select_db($database_name, $MySQLLink) or die(ERROR--CAN'T CONNECT TO DB); $result = mysql_query(SELECT * FROM .$table_name) or die(Error: . mysql_error()); for($i = 1; $i mysql_num_fields($result); $i++) { $fieldname = mysql_field_name($result, $i); $fieldname2 = $.$fieldname; mysql_query(UPDATE $table_name SET $fieldname=$fieldname2 WHERE id =$id); echo $fieldname.br.$fieldname2.br; ... does the above echo display what you expected it to? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Every time I think I know where it's at, they move it. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] how many rows updated
When updating or deleting a table is there anyway to find out how many rows where affected using php?? I am using Postgresql 7.2 and php 4.2 using pgsql from the the command line I enter this query update teststock set item_num ='something' where item_num ='something'; and it returns UPDATE someamount in php if i use $result = pg_exec($conn, $query); it just returns whether or not the query failed. I tried this, but it fails because no object was returned from pg_exec() $data = pg_fetch_object ($result, 0); foreach ($data as $varName=$value) { print $varName nbsp; $value br; } Thanks for any help -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how many rows updated
Thanks, i could not find that function in the book i was using. sorry for the inconvenience. John W. Holmes wrote: Jason S Motes wrote: When updating or deleting a table is there anyway to find out how many rows where affected using php?? I don't even use PG, but it took me 5 seconds to find this: http://us2.php.net/manual/en/function.pg-affected-rows.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] date function
On Saturday 06 September 2003 06:01, Darryl wrote: I have some php code that pulls from the mysql database. Here it is: ?php mysql_connect(wildcat.osborneindustries.com, webuser, webpass); $mymonth = date('n'); $cyear = date('Y'); $query = SELECT name,hdate FROM emp2 where month(hdate)=$mymonth order by hdate; $result = mysql_db_query(iweb, $query); if ($result) { echo table align=center border=0 cellspacing=5 ; while ($r = mysql_fetch_array($result)) { $name = $r[name]; $hyear = date('Y',$r[hdate]); $timein = $cyear - $hyear; if ($timein 0) { echo trtd$name/ttd$timein/tdtd$cyear/tdtd$hyear/td/tr;} } echo /table; } else { echo No data.; } mysql_free_result($result); ? I'm trying to figure out years of employment based on hiredate. Its not working as expected. $timein is always 1969. Date in the database is -MM-DD. What have I screwed up ? date() in php expects a unix timestamp. Dates in MySQL are NOT stored in unix timestamp format. You can perform the calculations directly in MySQL mysql manual Tutorial Introduction Date Calculations -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* People with narrow minds usually have broad tongues. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL Returns Error
On Wednesday 06 August 2003 01:14, Jeff wrote: Well I did what you said, and now I get Parse error: parse error, unexpected T_ECHO in C:\FoxServ\www\encana_db.php on line 44 Try: $result = mysql_query($query, $link_id) OR die(mysql_error()); -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Byte your tongue. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Configuring PHP with Firebird
On Wednesday 06 August 2003 13:41, Evan Morris wrote: Basically, I want to know if it is possible to make PHP aware of Interbase/Firebird *without* recompiling PHP. It depends on how you've installed PHP. If it was installed from a distro's RPM then maybe there's no need to recompile -- ask on your relevant distro's mailing list. If using Windows then check out: http://www.ibphoenix.com/main.nfs?page=ibp_beginners_php (which you could have found by googling for firebird php) If it is not possible, I'd like to know what option to pass PHP at configure time when the Firebird installation is on a remote machine. Ie, the machine where PHP is running *does not* have Firebird installed. As Firebird is based on Interbase, I believe you can use PHP's Interbase interface: manual InterBase functions, for installation instructions. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* The best way to hold a man is in your arms -- Murphy's Laws on Sex n18 */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Database Design Issue
Yes, songs do span shows. However, the list of songs for each weeks show starts out as a *.asc (same a *.txt) space-separated file. This gets uploaded via a PHP file that formats each row and inserts it into the database. That's why even though I know there will be duplication it appears (to me at least) I'll just have to live with it. I have no guarentee that the songs will appear in the *exact same way* every time either (you really don't want to know why -- I'm getting a migrain just thinking about it). I've attached an example of the incoming files I have to deal with for your reference. Also, I'm just designing the website I will have no part in the everyday maintenance of the website -- except when the maintainer gets stuck. :) Jason CPT John W. Holmes wrote: From: "Jason Lange" [EMAIL PROTECTED] Here's my question. I'm creating a website for a weekly radio show. One of the items I would like to store in the database is the list of songs played in each show (there's normally between 20-25 songs per show), and the songs will be displayed by show. Should I put all of the songs in a single table with a field denoting what show they're from, or should I create a separate table for each weeks show and just request that entire table? I'm looking at this from both a long-term performance and *maintenance* issue. The first question is if songs can span multiple shows? If so, you need 3 tables. One to hold the songs, each song getting a unique id. One table to hold the shows, each show getting a unique id, and finally a third table that relates the two. You'd list the song_id and the show_id that it's used in. Add in a row for each song used in each show. If a song is not shared across shows, then you could go with two tables. A show table where each show gets a unique id and a song table with a column that has a show_id in it relating it to what show it's used in. You'd be better off with the first method, though, because sooner or later down the line there's going to be a song shared, I imagine. :) ---John Holmes... FOREVER WE WILL SING MICHAEL W. SMITHWORSHIP *DVD* (REUNION ) YOUR LOVE OH LORDTHIRD DAY OFFERINGS: A WORSHIP ALBUM (ESSENTIAL ) ENOUGH CHRIS TOMLINOUR LOVE IS LOUD (SPARROW ) LORD YOU'VE BEEN GOOD TO ME GRAHAM KENDRICK WHAT GRACE (FURIOUS ) LET THE RIVER FLOW DARRELL EVANS LET THE RIVER FLOW (INTEGRITY ) MY GOD REIGNSDARRELL EVANS LET THE RIVER FLOW (INTEGRITY ) I LAY ME DOWNDARRELL EVANS FREEDOM (VERTICAL ) I AM IN LOVE WITH YOUDARRELL EVANS FREEDOM (VERTICAL ) BREATH OF GODCHRISTY NOCKELS GIRLS OF GRACE (WORD ) SPOKEN FOR MERCY MESPOKEN FOR (INOTOF) PRAISES BE LINCOLN BREWSTERAMAZED (VERTICAL ) LORD OVER ALLSONIC FLOOD RESONATE (INO ) HUNGRY KATHRYN SCOTT HUNGRY (VINEYARD ) BE GLORIFIED TIM HUGHES ALL AROUND THE WORLD (WORSHIP T ) LORD YOU HAVE MY HEART DELIRIOUS CUTTING EDGE (SPARROW ) TRADING MY SORROWS DARRELL EVANS FREEDOM (INTEGRITY ) FIELDS OF GRACE DARRELL EVANS ALL I WANT IS YOU (VERTICAL ) ALL I WANT IS YOUDARRELL EVANS ALL I WANT IS YOU (VERTICAL ) WE WILL EMBRACE YOUR MOVEDARRELL EVANS LET THE RIVER FLOW (INTEGRITY ) LORD REIGN IN ME VINEYARD U.K. WINDS OF WORSHIP 12 (VINEYARD ) YOU SHINEBRIAN DOERKSEN YOU SHINE (INTEGRITY ) GOD OF WONDERS CAEDMON'S CALL IN THE COMPANY OF ANGELS (ESSENTIAL ) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Database Design Issue
Hello Everyone, Here's my question. I'm creating a website for a weekly radio show. One of the items I would like to store in the database is the list of songs played in each show (there's normally between 20-25 songs per show), and the songs will be displayed by show. Should I put all of the songs in a single table with a field denoting what show they're from, or should I create a separate table for each weeks show and just request that entire table? I'm looking at this from both a long-term performance and *maintenance* issue. TIA, Jason -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL
On Saturday 02 August 2003 01:46, Jeff wrote: I tried doing this through the news server, but something messed up. I just need to know how to make an HTML form write to a MySQL DB. This is what I have so far. [snip] And does it work? If it works then congratulations. If it doesn't work, *how* doesn't it work. If you're new to all this, you might want to start by reading some of the numerous tutorials available (google for them) and follow through a few of them. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Sometimes a man will tell his bartender things he'll never tell his doctor. -- Dr. Phillip Boyce, The Menagerie (The Cage), stardate unknown. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] not a valid MySQL result
On Saturday 02 August 2003 11:48, Lee Templeton wrote: The first row retrieved from the results list works and returns the row with Resource id #3 prefixed to the prinouts. After the first row all futher retrievals fail. The variable $results is stressed by being forced to do two different jobs. Try using another variable to help it out. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* There are two kinds of pedestrians... the quick and the dead. -- Lord Thomas Rober Dewar */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ANYONE KNOWS, can help me to link Linux to MS SQLserver 7 by ODBC
On Monday 28 July 2003 16:38, Nabil wrote: I have been trying so hard to get that done.. and i posted many here. but with no hope.. here is a summury of what i did: - I tried FreeTDS as a driver with unixODBC ... - Tried to remove mysql- apache - php and recomplied them with : iodbc - Tried to try openlink driver. - tried to upgrade from redhat 7.3 to 9 as i faced do much problem with gcc compiler when i compiled php and apache.. All the above with no hope so finaly , i formated the system then i installed a clean RedHat 9 with apache and php 4.2.2 and when i echo phpinfo() i got the following BUT WHAT IS dbx and there is Micrososft SQL server and when i call odbc_connect ... i got Warning: SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /var/www/html/louai.php on line 11 if my work was right .. how can i link the driver (FreeTDS and then the DSN..) Have you configured /etc/odbc.ini /etc/odbcinst.ini correctly? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* He who slings mud generally loses ground. -- Adlai Stevenson */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ANYONE KNOWS, can help me to link Linux to MS SQLserver 7 by ODBC
On Monday 28 July 2003 18:13, Nabil wrote: Please Jason help me to do this The sql server is on 192.168.0.101 IP address. Please give me a sample of how can i config these files : /etc/odbc.ini /etc/odbcinst.ini As an example my /etc/odbc.ini contains: [MySQL-test] Description = MySQL database test Driver = MySQL Server = localhost Database= test Port = 3306 Socket = Option = Stmt = and /etc/odbcinst.ini contains [PostgreSQL] Description = ODBC for PostgreSQL Driver = /usr/lib/libodbcpsql.so.2 Setup = /usr/lib/libodbcpsqlS.so.1 FileUsage = 1 [MySQL] Description = ODBC Driver for MySQL Driver = /usr/lib/libmyodbc.so.2 Setup = /usr/lib/libodbcmyS.so.1 FileUsate= 1 CPTimeout= CPReuse = Best refer to the unixODBC docs for more info. Should i add any entry to freetds.conf ... and can you tell me what is the .so file that works with MS SQL7 that i should point to. No idea, never used freetds before. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Children are like cats, they can tell when you don't like them. That's when they come over and violate your body space. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ANYONE KNOWS, can help me to link Linux to MS SQLserver 7 by ODBC
On Monday 28 July 2003 19:46, Nabil wrote: these are not working because i need to connect ro Micro$oft SQL server 7 NOT to mysql nor postgresql *sigh* They were meant to be examples of what *I* have. That's why you have to read the docs and see what needs to be done to use MSSQL. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Don't steal; thou'lt never thus compete successfully in business. Cheat. -- Ambrose Bierce */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Hackers?
On Tuesday 22 July 2003 18:14, [EMAIL PROTECTED] wrote: Now I am not an Apache guru, and my PHP/MySQL experience is all based around the coding side, not the instilation, security etc... So when I arrived at work yesterday, and discovered that several databases had been deleted, and a random database called 'sanij' has been created, My gut was to suspect hackers. None of my web site pages are unaffected, and the web site runs just fine, apart from those pages that need a MySQL database for content. Hmm, you have several databases missing, you suspect hackers, yet you continue to run the server so that ... This morning I come to work and ALL the databases have been deleted. As I said, I really don't know where to begin looking for evidence of hackers. ... they can delete ALL your databases? The golden rule is, at the first sign of any suspicious activity (yes having several databases deleted does count as suspicious activity!), take the server off-line, backup all your important data, and investigate. While I'm curious to know who did this, I think a better question to be asking is *how* they did this. Knowing that would stand you in good stead to prevent it from happenning in the future. Depending on the ability of the 'hacker' the logs may be a source of info. I guess my priority os to recover the lost data... is this possible...? See what you can salvage from the directory where MySQL keeps the databases. If there's nothing there then your only salvation are in the backups. I'm working off a RAQ4, hosted by NetBenefit... Any advise, ideas are gonna be apperciated at this point. I've got backups of alot of the databases, but several were created in the past few weeks, and I didn't back them up yet... I know I know... stupid man I am, but I'll slap myself later, for now... a solution is required 1) The RAQs and its siblings seems to be notoriously insecure. You really need to keep up with any new security updates. 2) A default installation of MySQL is also insecure in that you do not need a password to use the root account. As with all break-ins or suspected break-ins, to be on the safe side you should recover any data that you can (making sure that they haven't been tainted) then format the hard-disk (or better still, put in a new hard-disk, keeping the old one for analysis) and re-install. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Cats are intended to teach us that not everything in nature has a function. -- Garrison Keillor */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php