[PHP-DB] Re: Special Insertion Into MySQL - at a loss!
The following code is how you should retrieve the data from mySQL... if you wanted to update all of the information through one button, though, I would do it in a slightly different way... Cancel This Domain? as long as all these are from the same table... the update is easy... I recently did the same thing with ASP (and I wish we had PHP at work), but I don't have it here at home. It was slightly more complicated, in the way that each value relating to each row presented to the user had to be put into different tables according to the values. with the HTML form, you would put the fields like this (formatted without HTML for ease of viewing) this method is for updating only one table // start row "> "> "> // end row so basically you get the idea... what happens here is all the values are put into their respective arrays (when submitting the form) and you loop through the arrays on the next page on an insert query... like so... all the above could should work, although its untested things to watch out for is making sure you have single quotes around the text fields but none around the ID (which should be a number) if you have multiple tables to update, mail me and I'll tell you how to do that... its late and I don't want to explain unless u need it... also, I would probably also have a good look at how you are presenting the form to the user. my example might not be how you want it to look, but i think its the data transfer that you were worried about... any questions about the code?? just ask... Adam >I have a special set of information retrieved from a while loop that I would >like a person to be able to edit and send back into a MySQL table. > >I know all of the basic MySQL commands for doing such, but the PHP side to >get the input from the form to go in is really stumping me. > >This is what I have: > >- > >$or = 0; > >while($or < $orderidrows) { > > $orderinfo = mysql_fetch_row($orderidinfo); > $domain[$or] = $orderinfo[2]; > $cancel[$or] = $orderinfo[3]; > > print "face=Arial>$domain[$or]size=2 face=Arial>Cancel This Domain?face=Arial>size=3>"; > > $or++; > } > >-- > >The values I would normally insert into the MySQL from the form would be >$confirm - however, in this case, I have a number of rows with the same >name. How do I distinguish one from another? The [$or] doesn't work to do >it (didn't think it would). > >Thanks for any help! > >-Mike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php-mysql insert via web form problem
i think the query you are sending to mysql should be : insert into pages (page) values ('index') (without \) [EMAIL PROTECTED] a écrit : > Hi, > I am trying to write a web based form that I can put arbitrary sql > statements into and run them against my mysql db. the form is written using > php btw. > > For read operations this seems to work fine, i.e. select, describe, show > etc. However, when I try to do an insert to a table I get an sql syntax > error and I really can't see the problem. > > I am writting the query in a html textarea called query and then using > this like so: > $result=mysql_query($query,$link); > > I get this error in my browser when I run this: > > results of query: insert into pages (page) values (\'index\') > Error:You have an error in your SQL syntax near '\'index\')' at line 1 > > And the query that produced this error is: > insert into pages (page) values ('index') > > I've verified that this statement works using the commandline mysql > interface. > > As the web server and db I'm trying to get this to work on are remote I'm > not certain of the versions. I've tried using the insert into table_name set > column_name=value form in case it was an older version of mysql , but this > produces much the same error. > > Any suggestion greatly appreciated. > > ~:P > > Hush provide the worlds most secure, easy to use online applications - which >solution is right for you? > HushMail Secure Email http://www.hushmail.com/ > HushDrive Secure Online Storage http://www.hushmail.com/hushdrive/ > Hush Business - security for your Business http://www.hush.com/ > Hush Enterprise - Secure Solutions for your Enterprise http://www.hush.com/ > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Marius Ursache (3563 || 3494) \|/ \|/ "@'/ ,. \`@" /_| \__/ |_\ \__U_/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL problem
On Fri, 2002-02-22 at 09:37, Caleb Walker wrote: > I keep on getting this error statement: > Warning: Supplied argument is not a valid MySQL result resource in > /usr/local/www/data/phone/insert2.php on line 10 > 2 > > Can someone tell me what is wrong with the code below, I just cannot figure > it out... Thank you very much in advance. I am using php4. > > > session_start(); > include("info.inc.php"); > > mysql_connect("$host","$user","$pass") || die(mysql_error()); > mysql_select_db("$db") || die(mysql_error()); > > > $q = mysql_query("SELECT FName, LName FROM user_info WHERE (FName='$FName' && > LName='$LName')") || die(1); Try this out: $q = mysql_query("SELECT FName, LName FROM user_info WHERE (FName='$FName' && LName='$LName')",$db) || die(1); ^^^ It might help. Or it might not :) Cheers, Markus -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library [EMAIL PROTECTED] +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php-mysql insert via web form problem
Hi, I am trying to write a web based form that I can put arbitrary sql statements into and run them against my mysql db. the form is written using php btw. For read operations this seems to work fine, i.e. select, describe, show etc. However, when I try to do an insert to a table I get an sql syntax error and I really can't see the problem. I am writting the query in a html textarea called query and then using this like so: $result=mysql_query($query,$link); I get this error in my browser when I run this: results of query: insert into pages (page) values (\'index\') Error:You have an error in your SQL syntax near '\'index\')' at line 1 And the query that produced this error is: insert into pages (page) values ('index') I've verified that this statement works using the commandline mysql interface. As the web server and db I'm trying to get this to work on are remote I'm not certain of the versions. I've tried using the insert into table_name set column_name=value form in case it was an older version of mysql , but this produces much the same error. Any suggestion greatly appreciated. ~:P Hush provide the worlds most secure, easy to use online applications - which solution is right for you? HushMail Secure Email http://www.hushmail.com/ HushDrive Secure Online Storage http://www.hushmail.com/hushdrive/ Hush Business - security for your Business http://www.hush.com/ Hush Enterprise - Secure Solutions for your Enterprise http://www.hush.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL problem
I keep on getting this error statement: Warning: Supplied argument is not a valid MySQL result resource in /usr/local/www/data/phone/insert2.php on line 10 2 Can someone tell me what is wrong with the code below, I just cannot figure it out... Thank you very much in advance. I am using php4. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Secure Encrypt/Decrypt Functions
I too need a solution for this, but I don't think mcrypt will work. Why? I need public key/private key encryption, as I don't want to risk leaving the key on the server. >From what I understand by reading the mcrypt docs, you encrypt and decrypt with the same key, so if someone were to be able to read the script that does the crypting, they would be able to view (or find then view) the key. I've started to try to accomplish this with PGP, but am having trouble getting PHP to call PGP successfully. Anyway, is there any way to do public key/private key encryption with PHP? Thanks, Peter Janett New Media One Web Services New Upgrades Are Now Live!!! Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1 Sun Solaris (UNIX) accounts - PHP 4.0.6, mod_perl/1.25, Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43 PostgreSQL coming soon! http://www.newmediaone.net [EMAIL PROTECTED] (303)828-9882 - Original Message - From: "Hunter, Ray" <[EMAIL PROTECTED]> To: "'Jonathan Hilgeman'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, February 21, 2002 12:02 PM Subject: RE: [PHP-DB] Secure Encrypt/Decrypt Functions > You can use the mcrypt functions of php. You can look in the php manual > here: http://www.php.net/manual/en/ref.mcrypt.php . You will also need to > compile php with mcrypt. I use mcrypt with no problems. > > > > Ray Hunter > Firmware Engineer > > ENTERASYS NETWORKS > > > -Original Message- > From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 21, 2002 11:59 AM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Secure Encrypt/Decrypt Functions > > > Does anyone know of a fairly simple, but secure technique for encrypting and > decrypting text? > > - Jonathan > > -- > 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] user administration using PHP 'n MySQL
Hi... Help me pls, how to make auto-logout and function to logout user by admin. Thank you. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Premature end of Script header
May its Help Reload\n"); print("Reload\n"); /*/ produce 1st Link : http://kijo/tmp/test.php?foo 2nd Link : http://kijo/tmp/test.php?SID Good idea is to use $PHP_SELF /*/ ?> ---Original Message--- From: Alvin Ang Date: Friday, February 22, 2002 10:53:08 AM To: PHP Subject: [PHP-DB] Premature end of Script header Hi there, I encountered INTERNAL SERVER ERROR and when i look at the error log, it shows "premature end of script header". I tried to look for answers in many forum but nothing seems to help. Please help. Reload\n); ?> Thanks! Alvin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
[PHP-DB] Re: Premature end of Script header
Try It looks like your quotes are out of whack. All those slashes are a little redundant too. Try print("Reload\n"); HTML does not mandate quotes around a parameter's value. I'm only guesing that your reference to SID was supposed to be a variable and that your reference to test.php was not. Also, given that the link is called 'Reload', you can probably replace test.php with $PHP_SELF. Alvin Ang wrote: > Hi there, > > I encountered INTERNAL SERVER ERROR and when i look at the error log, it > shows "premature end of script header". I tried to look for answers in many > forum but nothing seems to help. Please help. > > > print("Reload\n); > > ?> > > Thanks! > > Alvin > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] slow result
Hi, When I select data from table with mysql prompt or mysql-front-end, it display result fast. But when I put this sql into php, it used more time to display the result. How could I fix this problem or track the problem? Sommai -- Please be informed that all e-mail which are addressing to thaithanakit.co.th will need to be changed to BTsecurities.com by March 1, 2002 Thank you. :-) -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Premature end of Script header
Hi Wayne, Thanks, but din work! :( -Original Message- From: Wayne Bastow [mailto:[EMAIL PROTECTED]] Sent: Friday, February 22, 2002 10:29 PM To: Alvin Ang Cc: PHP Subject: Re: [PHP-DB] Premature end of Script header Try print("Reload\n"); Alvin Ang wrote: >Hi there, > >I encountered INTERNAL SERVER ERROR and when i look at the error log, it >shows "premature end of script header". I tried to look for answers in many >forum but nothing seems to help. Please help. > > >print("Reload\n); > >?> > >Thanks! > >Alvin > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Premature end of Script header
Try print("Reload\n"); Alvin Ang wrote: >Hi there, > >I encountered INTERNAL SERVER ERROR and when i look at the error log, it >shows "premature end of script header". I tried to look for answers in many >forum but nothing seems to help. Please help. > > >print("Reload\n); > >?> > >Thanks! > >Alvin > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Premature end of Script header
Hi there, I encountered INTERNAL SERVER ERROR and when i look at the error log, it shows "premature end of script header". I tried to look for answers in many forum but nothing seems to help. Please help. Reload\n); ?> Thanks! Alvin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Help needed - need to access a value from DB into all pages
Hi there :) One of the most common methods of achieving this is by using session variables. First the user logins in through a form with a username and a password, you check these against the database to make sure they are who they say they are, once that is established you could create a session variable called "$USERID" (or something a little less intutive:) once retrieving the $USERID, and do a check within every page to see what $USERID they are and perform the appropriate actions. Check out sessions at : http://www.php.net/manual-lookup.php?pattern=sessions Cheers, Joe :) Wg4- Cook <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi there, > > I am struggling with a concept and can't seem to find a way to do it so > hoping you all can help. > > We want to use PHP with MySql Db. > For security reasons on the DB, it is to be accessed only through this front > end i.e. via the internal web > Each user will have a number of levels of access to various parts of the > system, so the obvious design is one where there is only 1 real login to the > MySQL db (i.e. the system will auto log everyone in as this without them > knowing it), and then the user is validated against a table in my DB which > holds the access rights. I can get through the login OK, and get my table to > return "USERID" for this person. Now I need that "USERID" available to ALL > other pages so I can use it to determine what parts of screens to show, and > what to allow them to do. > > My question is how do I make this variable available to all pages?? Do I > have to include it with the variables passed to each page or is there a > simpler way of doing it. Can I put the variable in an include file and > include it in every page - will that work?. > > Surely someone must have had a similar situation before and can tell me how > they solved it. > > Many thanks > > Janet > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] RE: [PHP] Help needed - need to access a value from DB into all pages
Sessions seems to be the popular way to go. It's stored at the server, so you don't have to worry about any clients disabling cookie support. -- William Fong - [EMAIL PROTECTED] Phone: 626.968.6424 x210 | Fax: 626.968.6877 Wireless #: 805.490.7732| Wireless E-mail: [EMAIL PROTECTED] - Original Message - From: "Martin Towell" <[EMAIL PROTECTED]> To: "'WG4- Cook, Janet'" <[EMAIL PROTECTED]>; "PHP db list" <[EMAIL PROTECTED]>; "PHP List" <[EMAIL PROTECTED]> Sent: Thursday, February 21, 2002 4:06 PM Subject: [PHP-DB] RE: [PHP] Help needed - need to access a value from DB into all pages : I can think of three ways you could do this. : : 1. as a cookie : 2. using sessions : 3. put it in every link : : Martin : : -Original Message- : From: WG4- Cook, Janet [mailto:[EMAIL PROTECTED]] : Sent: Friday, February 22, 2002 10:59 AM : To: PHP db list; PHP List : Subject: [PHP] Help needed - need to access a value from DB into all : pages : : : Hi there, : : I am struggling with a concept and can't seem to find a way to do it so : hoping you all can help. : : We want to use PHP with MySql Db. : For security reasons on the DB, it is to be accessed only through this front : end i.e. via the internal web : Each user will have a number of levels of access to various parts of the : system, so the obvious design is one where there is only 1 real login to the : MySQL db (i.e. the system will auto log everyone in as this without them : knowing it), and then the user is validated against a table in my DB which : holds the access rights. I can get through the login OK, and get my table to : return "USERID" for this person. Now I need that "USERID" available to ALL : other pages so I can use it to determine what parts of screens to show, and : what to allow them to do. : : My question is how do I make this variable available to all pages?? Do I : have to include it with the variables passed to each page or is there a : simpler way of doing it. Can I put the variable in an include file and : include it in every page - will that work?. : : Surely someone must have had a similar situation before and can tell me how : they solved it. : : Many thanks : : Janet : : : : : -- : PHP General Mailing List (http://www.php.net/) : To unsubscribe, visit: http://www.php.net/unsub.php : -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: [PHP] Help needed - need to access a value from DB into all pages
I can think of three ways you could do this. 1. as a cookie 2. using sessions 3. put it in every link Martin -Original Message- From: WG4- Cook, Janet [mailto:[EMAIL PROTECTED]] Sent: Friday, February 22, 2002 10:59 AM To: PHP db list; PHP List Subject: [PHP] Help needed - need to access a value from DB into all pages Hi there, I am struggling with a concept and can't seem to find a way to do it so hoping you all can help. We want to use PHP with MySql Db. For security reasons on the DB, it is to be accessed only through this front end i.e. via the internal web Each user will have a number of levels of access to various parts of the system, so the obvious design is one where there is only 1 real login to the MySQL db (i.e. the system will auto log everyone in as this without them knowing it), and then the user is validated against a table in my DB which holds the access rights. I can get through the login OK, and get my table to return "USERID" for this person. Now I need that "USERID" available to ALL other pages so I can use it to determine what parts of screens to show, and what to allow them to do. My question is how do I make this variable available to all pages?? Do I have to include it with the variables passed to each page or is there a simpler way of doing it. Can I put the variable in an include file and include it in every page - will that work?. Surely someone must have had a similar situation before and can tell me how they solved it. Many thanks Janet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help needed - need to access a value from DB into all pages
Hi there, I am struggling with a concept and can't seem to find a way to do it so hoping you all can help. We want to use PHP with MySql Db. For security reasons on the DB, it is to be accessed only through this front end i.e. via the internal web Each user will have a number of levels of access to various parts of the system, so the obvious design is one where there is only 1 real login to the MySQL db (i.e. the system will auto log everyone in as this without them knowing it), and then the user is validated against a table in my DB which holds the access rights. I can get through the login OK, and get my table to return "USERID" for this person. Now I need that "USERID" available to ALL other pages so I can use it to determine what parts of screens to show, and what to allow them to do. My question is how do I make this variable available to all pages?? Do I have to include it with the variables passed to each page or is there a simpler way of doing it. Can I put the variable in an include file and include it in every page - will that work?. Surely someone must have had a similar situation before and can tell me how they solved it. Many thanks Janet -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: ORDER BY question
Good article on phpbuilder.com Slapping together a search engine for your database is easy with PHP and MySQL http://phpbuilder.com/columns/clay19990421.php3 [ p i x e l p e t e r ] [EMAIL PROTECTED] "Chris Payne" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 000c01c1bb1c$e049dce0$0200a8c0@chris">news:000c01c1bb1c$e049dce0$0200a8c0@chris... Hi there everyone, Using PHP and MySQL, how can I do an ORDER BY where city = $city? What happens is this, I have a search engine which works nicely, but I want to bring up the closest matches to the search first at the top, how can I do this? Say you enter Munich Hotels, I want all entries with Munich Hotels to appear first before the rest, any ideas? Thanks everyone. Chris Payne http://www.planetoxygene.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] debugging?
Your $sql already contains a mysql_query. Why are you running it against it again, unless you have changed something. If $sql only contains your delete statement(without calling mysql_query), then do not put quotes around $sql,$dbh Otherwise, come back with what $sql and $dbh are assigned to be. That would probably help determine what the problem is. MB jas <[EMAIL PROTECTED]> said: > Ok now that the sql statement is working I am getting an error on my result > function... here is the result function > $result = mysql_query("$sql, $dbh") or die(mysql_error()); > and here is the error I am recieving > You have an error in your SQL syntax near '1, 1' at line 1 > I dont know enough about php and mysql to understand what this means... is > there some kind of chart or definitions for error messages? I tried looking > on mysql.org and couldnt find anything specific. In any event, thanks in > advance. > Jas > <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Here is what your delete statement should look like: > > > > $sql = mysql_query("DELETE FROM $table_name WHERE id = '$id'",$dbh) or > > die(mysql_error()); > > > > Note the field name without the $ in front of it and the variable you are > > comparing it to with the $. > > > > One other note, in your table, you have id as a varchar(30) > auto_increment. > > As far as I know, auto_increment can only be used on INT() field types, > > unless I missed something there. If you do end up changing the field type > to > > INT, make sure you take the '' around the $id out. > > > > HTH > > > > MB > > > > > > > > > > jas <[EMAIL PROTECTED]> said: > > > > > Ok now that I can see the error message how can I fix it... the syntax > looks > > > correct and the error I am recieving is as follows > > > > > > You have an error in your SQL syntax near '= 'id'' at line 1 > > > > > > And this is my statement, > > > $sql = mysql_query("DELETE FROM $table_name WHERE $id = 'id'",$dbh) or > > > die(mysql_error()); > > > Is there anywhere on php.net or mysql.org that give exact error > meanings? > > > Thanks again, > > > Jas > > > "Olinux" <[EMAIL PROTECTED]> wrote in message > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > jas, > > > > > > > > Try this: > > > > - Remove the @, it suppresses the error > > > > - change die("Could not execute query, please try > > > > again later"); to die(mysql_error()); > > > > > > > > > > > > $sql = mysql_query("DELETE FROM $table_name WHERE $id > > > > = 'id'",$dbh) or > > > > die(mysql_error()); > > > > > > > > olinux > > > > > > > > --- jas <[EMAIL PROTECTED]> wrote: > > > > > Can someone tell me how I can find out why I am > > > > > getting errors executing > > > > > queries when I try to delete items from a table? I > > > > > have 2 files... > > > > > file 1. - Queries database, displays results with > > > > > option to delete record > > > > > using a check box, code is as follows... > > > > > > > > > > > > > > > > > > > > __ > > > > Do You Yahoo!? > > > > Yahoo! Sports - Coverage of the 2002 Olympic Games > > > > http://sports.yahoo.com > > > > > > > > > > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > -- > > > > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] debugging?
Ok jas > Ok now that I can see the error message how can I fix it... the syntax looks > correct and the error I am recieving is as follows > > You have an error in your SQL syntax near '= 'id'' at line 1 > > And this is my statement, > $sql = mysql_query("DELETE FROM $table_name WHERE $id = 'id'",$dbh) or > die(mysql_error()); > Is there anywhere on php.net or mysql.org that give exact error meanings? Possible confusion between PHP code and SQL. Do you really mean "...WHERE id = '$id' "? =dn > Thanks again, > Jas > "Olinux" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > jas, > > > > Try this: > > - Remove the @, it suppresses the error > > - change die("Could not execute query, please try > > again later"); to die(mysql_error()); > > > > > > $sql = mysql_query("DELETE FROM $table_name WHERE $id > > = 'id'",$dbh) or > > die(mysql_error()); > > > > olinux > > > > --- jas <[EMAIL PROTECTED]> wrote: > > > Can someone tell me how I can find out why I am > > > getting errors executing > > > queries when I try to delete items from a table? I > > > have 2 files... > > > file 1. - Queries database, displays results with > > > option to delete record > > > using a check box, code is as follows... > > > > > > > > > > __ > > Do You Yahoo!? > > Yahoo! Sports - Coverage of the 2002 Olympic Games > > http://sports.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
Re: [PHP-DB] debugging?
Ok now that the sql statement is working I am getting an error on my result function... here is the result function $result = mysql_query("$sql, $dbh") or die(mysql_error()); and here is the error I am recieving You have an error in your SQL syntax near '1, 1' at line 1 I dont know enough about php and mysql to understand what this means... is there some kind of chart or definitions for error messages? I tried looking on mysql.org and couldnt find anything specific. In any event, thanks in advance. Jas <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Here is what your delete statement should look like: > > $sql = mysql_query("DELETE FROM $table_name WHERE id = '$id'",$dbh) or > die(mysql_error()); > > Note the field name without the $ in front of it and the variable you are > comparing it to with the $. > > One other note, in your table, you have id as a varchar(30) auto_increment. > As far as I know, auto_increment can only be used on INT() field types, > unless I missed something there. If you do end up changing the field type to > INT, make sure you take the '' around the $id out. > > HTH > > MB > > > > > jas <[EMAIL PROTECTED]> said: > > > Ok now that I can see the error message how can I fix it... the syntax looks > > correct and the error I am recieving is as follows > > > > You have an error in your SQL syntax near '= 'id'' at line 1 > > > > And this is my statement, > > $sql = mysql_query("DELETE FROM $table_name WHERE $id = 'id'",$dbh) or > > die(mysql_error()); > > Is there anywhere on php.net or mysql.org that give exact error meanings? > > Thanks again, > > Jas > > "Olinux" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > jas, > > > > > > Try this: > > > - Remove the @, it suppresses the error > > > - change die("Could not execute query, please try > > > again later"); to die(mysql_error()); > > > > > > > > > $sql = mysql_query("DELETE FROM $table_name WHERE $id > > > = 'id'",$dbh) or > > > die(mysql_error()); > > > > > > olinux > > > > > > --- jas <[EMAIL PROTECTED]> wrote: > > > > Can someone tell me how I can find out why I am > > > > getting errors executing > > > > queries when I try to delete items from a table? I > > > > have 2 files... > > > > file 1. - Queries database, displays results with > > > > option to delete record > > > > using a check box, code is as follows... > > > > > > > > > > > > > > > __ > > > Do You Yahoo!? > > > Yahoo! Sports - Coverage of the 2002 Olympic Games > > > http://sports.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
Re: [PHP-DB] debugging?
Here is what your delete statement should look like: $sql = mysql_query("DELETE FROM $table_name WHERE id = '$id'",$dbh) or die(mysql_error()); Note the field name without the $ in front of it and the variable you are comparing it to with the $. One other note, in your table, you have id as a varchar(30) auto_increment. As far as I know, auto_increment can only be used on INT() field types, unless I missed something there. If you do end up changing the field type to INT, make sure you take the '' around the $id out. HTH MB jas <[EMAIL PROTECTED]> said: > Ok now that I can see the error message how can I fix it... the syntax looks > correct and the error I am recieving is as follows > > You have an error in your SQL syntax near '= 'id'' at line 1 > > And this is my statement, > $sql = mysql_query("DELETE FROM $table_name WHERE $id = 'id'",$dbh) or > die(mysql_error()); > Is there anywhere on php.net or mysql.org that give exact error meanings? > Thanks again, > Jas > "Olinux" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > jas, > > > > Try this: > > - Remove the @, it suppresses the error > > - change die("Could not execute query, please try > > again later"); to die(mysql_error()); > > > > > > $sql = mysql_query("DELETE FROM $table_name WHERE $id > > = 'id'",$dbh) or > > die(mysql_error()); > > > > olinux > > > > --- jas <[EMAIL PROTECTED]> wrote: > > > Can someone tell me how I can find out why I am > > > getting errors executing > > > queries when I try to delete items from a table? I > > > have 2 files... > > > file 1. - Queries database, displays results with > > > option to delete record > > > using a check box, code is as follows... > > > > > > > > > > __ > > Do You Yahoo!? > > Yahoo! Sports - Coverage of the 2002 Olympic Games > > http://sports.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
Re: [PHP-DB] debugging?
Ok now that I can see the error message how can I fix it... the syntax looks correct and the error I am recieving is as follows You have an error in your SQL syntax near '= 'id'' at line 1 And this is my statement, $sql = mysql_query("DELETE FROM $table_name WHERE $id = 'id'",$dbh) or die(mysql_error()); Is there anywhere on php.net or mysql.org that give exact error meanings? Thanks again, Jas "Olinux" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > jas, > > Try this: > - Remove the @, it suppresses the error > - change die("Could not execute query, please try > again later"); to die(mysql_error()); > > > $sql = mysql_query("DELETE FROM $table_name WHERE $id > = 'id'",$dbh) or > die(mysql_error()); > > olinux > > --- jas <[EMAIL PROTECTED]> wrote: > > Can someone tell me how I can find out why I am > > getting errors executing > > queries when I try to delete items from a table? I > > have 2 files... > > file 1. - Queries database, displays results with > > option to delete record > > using a check box, code is as follows... > > > > > __ > Do You Yahoo!? > Yahoo! Sports - Coverage of the 2002 Olympic Games > http://sports.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ORDER BY question
Hi there everyone, Using PHP and MySQL, how can I do an ORDER BY where city = $city? What happens is this, I have a search engine which works nicely, but I want to bring up the closest matches to the search first at the top, how can I do this? Say you enter Munich Hotels, I want all entries with Munich Hotels to appear first before the rest, any ideas? Thanks everyone. Chris Payne http://www.planetoxygene.com
Re: [PHP-DB] Errors Deleting...
I wish I could get this to work... it has not been able to work at all. I made the changes you have suggested and tried different variations concerning the results items and so far no dice. Here is my delete sql statement as of right now... I keep getting an error on the result portion, I have double, and triple checked my table names, my db connection (which has error checking on it so I know I am connecting fine). I am wondering would it be beneficial to actually put a select statement in for the database table? I would think declaring the variable would work fine. In any event I also changed the checkbox name to id to match the variable in the delete statement. For readability sake here is the form code as well Current Inventory"; $count = -1; while ($myrow = mysql_fetch_row($result)) { $count ++; echo "Type Of Car: "; printf(mysql_result($result,$count,"car_type")); echo "remove \n"; echo "rest of table and cell output"; } echo ""; ?> "Gurhan Ozen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Jas, > You still have cars as your checkbox name.. change it to id.. > and make sure that you assign $table_name to the table name you want to > delete from in your done2.php3 file.. > > Gurhan > > -Original Message- > From: jas [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 21, 2002 3:28 AM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Errors Deleting... > > > Can someone tell me how I can find out why I am getting errors executing > queries when I try to delete items from a table? I have 2 files... > file 1. - Queries database, displays results with option to delete record > using a check box, code is as follows... > require '../scripts/db.php'; > $result = mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not > execute query, please try again later"); > echo " name=\"rem_inv\" method=\"post\" action=\"done2.php3\"> > Current > Inventory"; > $count = -1; > while ($myrow = mysql_fetch_row($result)) { > $count ++; > echo "Type Of Car: "; > printf(mysql_result($result,$count,"car_type")); > echo " value=\"".$myrow[id]."\">remove > \n"; > echo "Model Of Car: "; > printf(mysql_result($result,$count,"car_model")); > echo "\n"; > echo "Year Of Car: "; > printf(mysql_result($result,$count,"car_year")); > echo "\n"; > echo "Price Of Car: $"; > printf(mysql_result($result,$count,"car_price")); > echo "\n"; > echo "VIN Of Car: "; > printf(mysql_result($result,$count,"car_vin")); > echo "\n"; > } > echo " value=\"delete\">"; > ?> > file 2. - takes variable of checkbox and then queries db trying to delete > any record based on the id. code is as follows... > require '../scripts/db.php'; > $table_name = "cur_inv"; > $sql = @mysql_query("DELETE FROM $table_name WHERE $id = 'id'",$dbh) or > die("Could not execute query, please try again later"); > print("changes made"); > ?> > I have been trying everything under the sun and cannot get this to work. > please help. > Jas > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] debugging?
jas, Try this: - Remove the @, it suppresses the error - change die("Could not execute query, please try again later"); to die(mysql_error()); $sql = mysql_query("DELETE FROM $table_name WHERE $id = 'id'",$dbh) or die(mysql_error()); olinux --- jas <[EMAIL PROTECTED]> wrote: > Can someone tell me how I can find out why I am > getting errors executing > queries when I try to delete items from a table? I > have 2 files... > file 1. - Queries database, displays results with > option to delete record > using a check box, code is as follows... > __ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Errors Deleting...
Jas, You still have cars as your checkbox name.. change it to id.. and make sure that you assign $table_name to the table name you want to delete from in your done2.php3 file.. Gurhan -Original Message- From: jas [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 3:28 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Errors Deleting... Can someone tell me how I can find out why I am getting errors executing queries when I try to delete items from a table? I have 2 files... file 1. - Queries database, displays results with option to delete record using a check box, code is as follows... Current Inventory"; $count = -1; while ($myrow = mysql_fetch_row($result)) { $count ++; echo "Type Of Car: "; printf(mysql_result($result,$count,"car_type")); echo "remove \n"; echo "Model Of Car: "; printf(mysql_result($result,$count,"car_model")); echo "\n"; echo "Year Of Car: "; printf(mysql_result($result,$count,"car_year")); echo "\n"; echo "Price Of Car: $"; printf(mysql_result($result,$count,"car_price")); echo "\n"; echo "VIN Of Car: "; printf(mysql_result($result,$count,"car_vin")); echo "\n"; } echo ""; ?> file 2. - takes variable of checkbox and then queries db trying to delete any record based on the id. code is as follows... I have been trying everything under the sun and cannot get this to work. please help. Jas -- 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] Errors Deleting...
Can someone tell me how I can find out why I am getting errors executing queries when I try to delete items from a table? I have 2 files... file 1. - Queries database, displays results with option to delete record using a check box, code is as follows... Current Inventory"; $count = -1; while ($myrow = mysql_fetch_row($result)) { $count ++; echo "Type Of Car: "; printf(mysql_result($result,$count,"car_type")); echo "remove \n"; echo "Model Of Car: "; printf(mysql_result($result,$count,"car_model")); echo "\n"; echo "Year Of Car: "; printf(mysql_result($result,$count,"car_year")); echo "\n"; echo "Price Of Car: $"; printf(mysql_result($result,$count,"car_price")); echo "\n"; echo "VIN Of Car: "; printf(mysql_result($result,$count,"car_vin")); echo "\n"; } echo ""; ?> file 2. - takes variable of checkbox and then queries db trying to delete any record based on the id. code is as follows... I have been trying everything under the sun and cannot get this to work. please help. Jas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] debugging?
Can someone tell me how I can find out why I am getting errors executing queries when I try to delete items from a table? I have 2 files... file 1. - Queries database, displays results with option to delete record using a check box, code is as follows... Current Inventory"; $count = -1; while ($myrow = mysql_fetch_row($result)) { $count ++; echo "Type Of Car: "; printf(mysql_result($result,$count,"car_type")); echo "remove \n"; echo "Model Of Car: "; printf(mysql_result($result,$count,"car_model")); echo "\n"; echo "Year Of Car: "; printf(mysql_result($result,$count,"car_year")); echo "\n"; echo "Price Of Car: $"; printf(mysql_result($result,$count,"car_price")); echo "\n"; echo "VIN Of Car: "; printf(mysql_result($result,$count,"car_vin")); echo "\n"; } echo ""; ?> file 2. - takes variable of checkbox and then queries db trying to delete any record based on the id. code is as follows... I have been trying everything under the sun and cannot get this to work. please help. Jas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Secure Encrypt/Decrypt Functions
You can use the mcrypt functions of php. You can look in the php manual here: http://www.php.net/manual/en/ref.mcrypt.php . You will also need to compile php with mcrypt. I use mcrypt with no problems. Ray Hunter Firmware Engineer ENTERASYS NETWORKS -Original Message- From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 11:59 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Secure Encrypt/Decrypt Functions Does anyone know of a fairly simple, but secure technique for encrypting and decrypting text? - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Secure Encrypt/Decrypt Functions
Does anyone know of a fairly simple, but secure technique for encrypting and decrypting text? - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Parse Error
According to your code, if the checkbox next to the word 'remove' is checked, then the value of $cars passed to the form is "checkbox". Then in the done2.php3 page, you are trying to delete where checkbox='array of values listed'. Is there a field in your database called checkbox? If so, what field type is it set to? If not, there is your problem. HTH MB jas <[EMAIL PROTECTED]> said: > Here is the code from the file that queries the db and pulls the current > contents of the db and provides a check box form for each record to delete > the items in the db. I dont know if this will help but like I said before > any insight would be great. Thanks in advance. > Jas > > require '../scripts/db.php'; > $result = mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not > execute query, please try again later"); > echo " name=\"rem_inv\" method=\"post\" action=\"done2.php3\"> > Current > Inventory"; > $count = -1; > while ($myrow = mysql_fetch_row($result)) { > $count ++; > echo "Type Of Car: "; > printf(mysql_result($result,$count,"car_type")); > echo " value=\"checkbox\">remove > \n"; > echo "Model Of Car: "; > printf(mysql_result($result,$count,"car_model")); > echo "\n"; > echo "Year Of Car: "; > printf(mysql_result($result,$count,"car_year")); > echo "\n"; > echo "Price Of Car: $"; > printf(mysql_result($result,$count,"car_price")); > echo "\n"; > echo "VIN Of Car: "; > printf(mysql_result($result,$count,"car_vin")); > echo "\n"; > } > echo " value=\"delete\">"; > ?> > > After this file is pulled and the user selects which record to delete it > jumps to the other snippit of code in done2.php3 which is > > > > $db_name = "test"; > > > $table_name = "inventory"; > > > $connection = @mysql_connect("localhost", "root", "password") or die > > > ("Could > > > not connect to database. Please try again later."); > > > $db = @mysql_select_db("$db_name",$connection) or die ("Could not select > > > database table. Please try again later."); > > > $sql = "DELETE FROM $table_name WHERE $cars = > > > > \"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dl > > > r_num\""); > > > $result = @mysql_query($sql, $connection) or die ("Could not execute > > > query. > > > > > > Any insight would be great... thanks again. > > > Jas > > > > > > > > > > > > > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > -- > > > > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Parse Error
Could you maybe give me an example of how to associate the checkbox with the id? Thanks again, Jas "Gurhan Ozen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Ok then it sure will not work.. because you have : > > "DELETE FROM $table_name WHERE $cars > =\"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$d > lr_num\""); > > 1- $cars is set to the value "checkbox" which doesn't exist in your test > table > 2- The end of the statement $dlr_num\""); is not right , that > parenthesis isn't supposed to be there > 3- The delete statement is wrong...You are storing all that info in the > separate fields but you are giving all combined as a condition in only one > field ($cars). > 3- Rewrite your delete statement to delete the rows identified by the id > column as "DELETE FROM $table WHERE id ='id'"; Of course in the page where > you list the cars to be deleted associate each checkbox with the car's id. > > Hope this helps.. > > Gurhan > > > -Original Message- > From: jas [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 21, 2002 1:02 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Parse Error > > > Here is the dump for the cars table... > test ( >id varchar(30) NOT NULL auto_increment, >car_type varchar(30), >car_model varchar(30), >car_year varchar(15), >car_price varchar(15), >car_vin varchar(25), >dlr_num varchar(25), >PRIMARY KEY (id), >KEY id (id) > test VALUES ('1', 'Ford', 'Bronco', '1969', '4500', 'vin897655', 'none'); > > Sorry about that... still a bit of a newbie here. =) > Jas > > "Gurhan Ozen" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Jas.. > > First of all you don't have the variable $cars assigned.. > > Second of all, we still don't know what the "test" table looks like? Does > it > > only have one column with all the infos about cars populated in it??? > > > > Gurhan > > > > > > -Original Message- > > From: jas [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, February 21, 2002 12:48 AM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP-DB] Parse Error > > > > > > Here is the code from the file that queries the db and pulls the current > > contents of the db and provides a check box form for each record to delete > > the items in the db. I dont know if this will help but like I said before > > any insight would be great. Thanks in advance. > > Jas > > > > > require '../scripts/db.php'; > > $result = mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not > > execute query, please try again later"); > > echo " > name=\"rem_inv\" method=\"post\" action=\"done2.php3\"> > > Current > > Inventory"; > > $count = -1; > > while ($myrow = mysql_fetch_row($result)) { > > $count ++; > > echo "Type Of Car: "; > > printf(mysql_result($result,$count,"car_type")); > > echo " > value=\"checkbox\">remove > > \n"; > > echo "Model Of Car: "; > > printf(mysql_result($result,$count,"car_model")); > > echo "\n"; > > echo "Year Of Car: "; > > printf(mysql_result($result,$count,"car_year")); > > echo "\n"; > > echo "Price Of Car: $"; > > printf(mysql_result($result,$count,"car_price")); > > echo "\n"; > > echo "VIN Of Car: "; > > printf(mysql_result($result,$count,"car_vin")); > > echo "\n"; > > } > > echo " > value=\"delete\">"; > > ?> > > > > After this file is pulled and the user selects which record to delete it > > jumps to the other snippit of code in done2.php3 which is > > > > > > $db_name = "test"; > > > > $table_name = "inventory"; > > > > $connection = @mysql_connect("localhost", "root", "password") or die > > > > ("Could > > > > not connect to database. Please try again later."); > > > > $db = @mysql_select_db("$db_name",$connection) or die ("Could not > select > > > > database table. Please try again later."); > > > > $sql = "DELETE FROM $table_name WHERE $cars = > > > > > > > \"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dl > > > > r_num\""); > > > > $result = @mysql_query($sql, $connection) or die ("Could not execute > > > > query. > > > > > > > > Any insight would be great... thanks again. > > > > Jas > > > > > > > > > > > > > > > > > > > > -- > > > > PHP Database Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Parse Error
Ok then it sure will not work.. because you have : "DELETE FROM $table_name WHERE $cars =\"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$d lr_num\""); 1- $cars is set to the value "checkbox" which doesn't exist in your test table 2- The end of the statement $dlr_num\""); is not right , that parenthesis isn't supposed to be there 3- The delete statement is wrong...You are storing all that info in the separate fields but you are giving all combined as a condition in only one field ($cars). 3- Rewrite your delete statement to delete the rows identified by the id column as "DELETE FROM $table WHERE id ='id'"; Of course in the page where you list the cars to be deleted associate each checkbox with the car's id. Hope this helps.. Gurhan -Original Message- From: jas [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 1:02 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Parse Error Here is the dump for the cars table... test ( id varchar(30) NOT NULL auto_increment, car_type varchar(30), car_model varchar(30), car_year varchar(15), car_price varchar(15), car_vin varchar(25), dlr_num varchar(25), PRIMARY KEY (id), KEY id (id) test VALUES ('1', 'Ford', 'Bronco', '1969', '4500', 'vin897655', 'none'); Sorry about that... still a bit of a newbie here. =) Jas "Gurhan Ozen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Jas.. > First of all you don't have the variable $cars assigned.. > Second of all, we still don't know what the "test" table looks like? Does it > only have one column with all the infos about cars populated in it??? > > Gurhan > > > -Original Message- > From: jas [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 21, 2002 12:48 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Parse Error > > > Here is the code from the file that queries the db and pulls the current > contents of the db and provides a check box form for each record to delete > the items in the db. I dont know if this will help but like I said before > any insight would be great. Thanks in advance. > Jas > > require '../scripts/db.php'; > $result = mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not > execute query, please try again later"); > echo " name=\"rem_inv\" method=\"post\" action=\"done2.php3\"> > Current > Inventory"; > $count = -1; > while ($myrow = mysql_fetch_row($result)) { > $count ++; > echo "Type Of Car: "; > printf(mysql_result($result,$count,"car_type")); > echo " value=\"checkbox\">remove > \n"; > echo "Model Of Car: "; > printf(mysql_result($result,$count,"car_model")); > echo "\n"; > echo "Year Of Car: "; > printf(mysql_result($result,$count,"car_year")); > echo "\n"; > echo "Price Of Car: $"; > printf(mysql_result($result,$count,"car_price")); > echo "\n"; > echo "VIN Of Car: "; > printf(mysql_result($result,$count,"car_vin")); > echo "\n"; > } > echo " value=\"delete\">"; > ?> > > After this file is pulled and the user selects which record to delete it > jumps to the other snippit of code in done2.php3 which is > > > > $db_name = "test"; > > > $table_name = "inventory"; > > > $connection = @mysql_connect("localhost", "root", "password") or die > > > ("Could > > > not connect to database. Please try again later."); > > > $db = @mysql_select_db("$db_name",$connection) or die ("Could not select > > > database table. Please try again later."); > > > $sql = "DELETE FROM $table_name WHERE $cars = > > > > \"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dl > > > r_num\""); > > > $result = @mysql_query($sql, $connection) or die ("Could not execute > > > query. > > > > > > Any insight would be great... thanks again. > > > Jas > > > > > > > > > > > > > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > -- > > > > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] illegal operation when accessing a php file!
Hi there, I am doing a school project on inventory management system, running very short on time. :( I just completed a php file for authenticating users accessing my site, but encountered illegal operation when trying to access the file. please help!!! Login Page for Inventory Management System "; echo "Invalid Login - Please try again"; echo ""; echo ""; session_destroy(); } //this message is if the wrong username/password pair is entered if ($error==2){ echo ""; echo "Unauthorized Access - Please Login"; echo ""; echo ""; session_destroy(); } //this message is if the cookie has expired if ($error==3){ echo ""; echo "Session has expired - Please Login"; echo ""; echo ""; session_destroy(); } ?> User Login: Password Thanks!! Alvin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] mysql connect, while and close big problem
What type of connections are you making persistent or non-persistent? Ray Hunter Firmware Engineer ENTERASYS NETWORKS -Original Message- From: Killer Angel Clark [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 10:17 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] mysql connect, while and close big problem I make a connection A to get an array of result. Then use a while loop to use the array. In the while loop, I use the data to select other data by making a new connection. After printing the data, I close this new connection. After the while loop, I close the first connection too. If only have the first connection, it has no problem. But with the select in the while loop and close the new connection, it has an error on closing. Does anyone know why and how to fix it?? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql connect, while and close big problem
I make a connection A to get an array of result. Then use a while loop to use the array. In the while loop, I use the data to select other data by making a new connection. After printing the data, I close this new connection. After the while loop, I close the first connection too. If only have the first connection, it has no problem. But with the select in the while loop and close the new connection, it has an error on closing. Does anyone know why and how to fix it?? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Parse Error
Here is the dump for the cars table... test ( id varchar(30) NOT NULL auto_increment, car_type varchar(30), car_model varchar(30), car_year varchar(15), car_price varchar(15), car_vin varchar(25), dlr_num varchar(25), PRIMARY KEY (id), KEY id (id) test VALUES ('1', 'Ford', 'Bronco', '1969', '4500', 'vin897655', 'none'); Sorry about that... still a bit of a newbie here. =) Jas "Gurhan Ozen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Jas.. > First of all you don't have the variable $cars assigned.. > Second of all, we still don't know what the "test" table looks like? Does it > only have one column with all the infos about cars populated in it??? > > Gurhan > > > -Original Message- > From: jas [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 21, 2002 12:48 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Parse Error > > > Here is the code from the file that queries the db and pulls the current > contents of the db and provides a check box form for each record to delete > the items in the db. I dont know if this will help but like I said before > any insight would be great. Thanks in advance. > Jas > > require '../scripts/db.php'; > $result = mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not > execute query, please try again later"); > echo " name=\"rem_inv\" method=\"post\" action=\"done2.php3\"> > Current > Inventory"; > $count = -1; > while ($myrow = mysql_fetch_row($result)) { > $count ++; > echo "Type Of Car: "; > printf(mysql_result($result,$count,"car_type")); > echo " value=\"checkbox\">remove > \n"; > echo "Model Of Car: "; > printf(mysql_result($result,$count,"car_model")); > echo "\n"; > echo "Year Of Car: "; > printf(mysql_result($result,$count,"car_year")); > echo "\n"; > echo "Price Of Car: $"; > printf(mysql_result($result,$count,"car_price")); > echo "\n"; > echo "VIN Of Car: "; > printf(mysql_result($result,$count,"car_vin")); > echo "\n"; > } > echo " value=\"delete\">"; > ?> > > After this file is pulled and the user selects which record to delete it > jumps to the other snippit of code in done2.php3 which is > > > > $db_name = "test"; > > > $table_name = "inventory"; > > > $connection = @mysql_connect("localhost", "root", "password") or die > > > ("Could > > > not connect to database. Please try again later."); > > > $db = @mysql_select_db("$db_name",$connection) or die ("Could not select > > > database table. Please try again later."); > > > $sql = "DELETE FROM $table_name WHERE $cars = > > > > \"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dl > > > r_num\""); > > > $result = @mysql_query($sql, $connection) or die ("Could not execute > > > query. > > > > > > Any insight would be great... thanks again. > > > Jas > > > > > > > > > > > > > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > -- > > > > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Parse Error
Jas.. First of all you don't have the variable $cars assigned.. Second of all, we still don't know what the "test" table looks like? Does it only have one column with all the infos about cars populated in it??? Gurhan -Original Message- From: jas [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 12:48 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Parse Error Here is the code from the file that queries the db and pulls the current contents of the db and provides a check box form for each record to delete the items in the db. I dont know if this will help but like I said before any insight would be great. Thanks in advance. Jas Current Inventory"; $count = -1; while ($myrow = mysql_fetch_row($result)) { $count ++; echo "Type Of Car: "; printf(mysql_result($result,$count,"car_type")); echo "remove \n"; echo "Model Of Car: "; printf(mysql_result($result,$count,"car_model")); echo "\n"; echo "Year Of Car: "; printf(mysql_result($result,$count,"car_year")); echo "\n"; echo "Price Of Car: $"; printf(mysql_result($result,$count,"car_price")); echo "\n"; echo "VIN Of Car: "; printf(mysql_result($result,$count,"car_vin")); echo "\n"; } echo ""; ?> After this file is pulled and the user selects which record to delete it jumps to the other snippit of code in done2.php3 which is > > $db_name = "test"; > > $table_name = "inventory"; > > $connection = @mysql_connect("localhost", "root", "password") or die > > ("Could > > not connect to database. Please try again later."); > > $db = @mysql_select_db("$db_name",$connection) or die ("Could not select > > database table. Please try again later."); > > $sql = "DELETE FROM $table_name WHERE $cars = > > \"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dl > > r_num\""); > > $result = @mysql_query($sql, $connection) or die ("Could not execute > > query. > > > > Any insight would be great... thanks again. > > Jas > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Parse Error
Not enough information given to figure out what's going on, but looking at your query i see: "WHERE $cars = "$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dlr _num\""); do you keep 6 different values separated by commas in the field referenced by $cars??? If this is correct what values you are passing for all those variables? Is the $cars variable set to a valid column name in the "test" table?? What is the data type for the column that $cars references? Gurhan -Original Message- From: jas [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 12:26 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Parse Error I hate to post this again but I have looked in a couple of php and mysql books but cannot seem to figure this one out. I am getting a parse error when trying to use php to delete records from a table. The error I am recieving is as follows Parse error: parse error in /path/to/php/done2.php3 on line 22 Here is the file that is giving me the error, any help would be great... I think that my problem is that I left out a variable to hold the $cars data but I am not sure. Here is the code... $db_name = "test"; $table_name = "inventory"; $connection = @mysql_connect("localhost", "root", "password") or die ("Could not connect to database. Please try again later."); $db = @mysql_select_db("$db_name",$connection) or die ("Could not select database table. Please try again later."); $sql = "DELETE FROM $table_name WHERE $cars = \"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dl r_num\""); $result = @mysql_query($sql, $connection) or die ("Could not execute query. Any insight would be great... thanks again. Jas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Parse Error
Here is the code from the file that queries the db and pulls the current contents of the db and provides a check box form for each record to delete the items in the db. I dont know if this will help but like I said before any insight would be great. Thanks in advance. Jas Current Inventory"; $count = -1; while ($myrow = mysql_fetch_row($result)) { $count ++; echo "Type Of Car: "; printf(mysql_result($result,$count,"car_type")); echo "remove \n"; echo "Model Of Car: "; printf(mysql_result($result,$count,"car_model")); echo "\n"; echo "Year Of Car: "; printf(mysql_result($result,$count,"car_year")); echo "\n"; echo "Price Of Car: $"; printf(mysql_result($result,$count,"car_price")); echo "\n"; echo "VIN Of Car: "; printf(mysql_result($result,$count,"car_vin")); echo "\n"; } echo ""; ?> After this file is pulled and the user selects which record to delete it jumps to the other snippit of code in done2.php3 which is > > $db_name = "test"; > > $table_name = "inventory"; > > $connection = @mysql_connect("localhost", "root", "password") or die > > ("Could > > not connect to database. Please try again later."); > > $db = @mysql_select_db("$db_name",$connection) or die ("Could not select > > database table. Please try again later."); > > $sql = "DELETE FROM $table_name WHERE $cars = > > \"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dl > > r_num\""); > > $result = @mysql_query($sql, $connection) or die ("Could not execute > > query. > > > > Any insight would be great... thanks again. > > Jas > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: Special Insertion Into MySQL - at a loss!
> > The following code is how you should retrieve the data from mySQL... > if you wanted to update all of the information through one button, > though, I would do it in a slightly different way... > > > $sql = "SELECT whatever FROM whatever..."; > > $result = mysql_query($sql); > > while ($row = mysql_fetch_array($result)){ > $domain = $row[0]; // first item in array > $cancel = $row[1]; // second item in array > ?> > > > > Cancel This Domain? > value='' size=3> > > > > > > as long as all these are from the same table... the update is easy... > Actually, the data is fetched based from table 2 based on data from table1 - however, all of the data shown, being from table2, would be updated to table 2. So, on the second page, when a 'submit' is done, the information would be updated in mysql likehow? That is the major problem I am having - how to keep the arrays in separate identities so that I can update row by row into the table - based on domain name since they are all unique. Thanks for your help, -Mike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] formating problem
jas, Replace > echo " value=\"delete\">"; With: > echo " value=\"delete\">"; - Original Message - From: "jas" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 19, 2002 3:12 AM Subject: [PHP-DB] formating problem > I feel kinda dumb for posting this but here it is... I am trying to query a > table then format the results so it looks like the rest of the site and the > darn delete button to remove db entries keeps showing up at the top. Here > is the code... Thanks in advance. > Jas > require '../scripts/db.php'; > $result = mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not > execute query, please try again later"); > echo " name=\"rem_inv\" method=\"post\" action=\"done2.php3\"> > Current > Inventory"; > $count = -1; > while ($myrow = mysql_fetch_row($result)) { > $count ++; > echo "Type Of Car: "; > printf(mysql_result($result,$count,"car_type")); > echo " value=\"checkbox\">remove > \n"; > echo "Model Of Car: "; > printf(mysql_result($result,$count,"car_model")); > echo "\n"; > echo "Year Of Car: "; > printf(mysql_result($result,$count,"car_year")); > echo "\n"; > echo "Price Of Car: $"; > printf(mysql_result($result,$count,"car_price")); > echo "\n"; > echo "VIN Of Car: "; > printf(mysql_result($result,$count,"car_vin")); > echo "\n"; > } > echo " value=\"delete\">"; > ?> > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Parse Error
Is $cars an array field? If not, you are trying to compare $cars to an list/array of values (I am not sure this would work even if $cars was an array field) 'WHERE $cars = "$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dlr _num\"");'. Normally, you would have to compare each individual value in each requested field to a variable. Hard to say without more code. MB jas <[EMAIL PROTECTED]> said: > I hate to post this again but I have looked in a couple of php and mysql > books but cannot seem to figure this one out. I am getting a parse error > when trying to use php to delete records from a table. The error I am > recieving is as follows > > Parse error: parse error in /path/to/php/done2.php3 on line 22 > > Here is the file that is giving me the error, any help would be great... I > think that my problem is that I left out a variable to hold the $cars data > but I am not sure. Here is the code... > > $db_name = "test"; > $table_name = "inventory"; > $connection = @mysql_connect("localhost", "root", "password") or die > ("Could > not connect to database. Please try again later."); > $db = @mysql_select_db("$db_name",$connection) or die ("Could not select > database table. Please try again later."); > $sql = "DELETE FROM $table_name WHERE $cars = > \"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dl > r_num\""); > $result = @mysql_query($sql, $connection) or die ("Could not execute > query. > > Any insight would be great... thanks again. > Jas > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] [OpenLink][ODBC][Driver]No key columns found for table referenced by keyset driven cursor
Paulo, This error is caused because odbc_connect is setting a dynamic cursor by default. This is usually not a problem, but a cursor needs a primary key. If no primary key exists on your table or if you are selecting against a view there will be a problem. I suggest you try adding a primary key. Alternatively a workaround exists to prevent odbc_connect from automatically selecting a dynamic cursor when connecting - edit php_odbc.h and comment out: #define HAVE_SQL_EXTENDED_FETCH 1 and recompile your php/apache setup. If you run into additional problems you may wish to open a support case at http://www.openlinksw.com/support/suppindx.htm Best regards, Andrew Hill Director of Technology Evangelism http://www.openlinksw.com/virtuoso/whatis.htm OpenLink Virtuoso Internet Data Integration Server > -Original Message- > From: Paulo Freitas [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 20, 2002 11:09 AM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] [OpenLink][ODBC][Driver]No key columns found for table > referenced by keyset driven cursor > > > Hi, > I'm running True64 UNIX with ingres 6.4 and openlink ODBC. > > > When i connect thru cgi(C/C++) it works fine but when i connect via PHP > 4.1.1 gives me this error: > [OpenLink][ODBC][Driver]No key columns found for table referenced > by keyset > driven cursor., SQL state IM909 in SQLPrepare > > > I compiled php like this: > > ./configure' '--with-odbc=/usr/soft/openlink/odbcsdk' > '--with-apache=../apache_1.3.22' '--enable-track-vars' > > I didn´t install iodbc because it's has a problem with snprintf > > Cal anyone help me with this? > > > P Freitas > > > > -- > 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] Parse Error
I hate to post this again but I have looked in a couple of php and mysql books but cannot seem to figure this one out. I am getting a parse error when trying to use php to delete records from a table. The error I am recieving is as follows Parse error: parse error in /path/to/php/done2.php3 on line 22 Here is the file that is giving me the error, any help would be great... I think that my problem is that I left out a variable to hold the $cars data but I am not sure. Here is the code... $db_name = "test"; $table_name = "inventory"; $connection = @mysql_connect("localhost", "root", "password") or die ("Could not connect to database. Please try again later."); $db = @mysql_select_db("$db_name",$connection) or die ("Could not select database table. Please try again later."); $sql = "DELETE FROM $table_name WHERE $cars = \"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dl r_num\""); $result = @mysql_query($sql, $connection) or die ("Could not execute query. Any insight would be great... thanks again. Jas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Help on PHP vs JAVA
Hi Any consultant will tell you that all you need to do is define the comparison criteria and you can choose the winner easily. PHP: ease of use, low cost of ownership, etc. Java: scalability, choice of implementations, etc. I just hope you can live with your choices! Regards, John Berlina <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello to everybody, > > I need some help for writting a comparison of PHP vs JAVA, and of course, I > need that PHP wins > ;-D > > Any ideas? > Any comparison wrote? > > Advanced Thanks, > F.P. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Double Dipping
Ah Ha! I got it. This was a clear case of RTFM... Based on what you said, I went back and re-read page 67 of "MySQL" by Paul DuBouis and sure enough, it made sense this time... Here is what I came up with: SELECT gamedate, gametime, divisions.name as division, t1.name as teama, t2.name as teamb FROM divisions, teams as t1, teams as t2, games WHERE games.leagueID = '$leagueID' AND t1.ID = hometeamID AND t2.ID = awayteamID group by gamedate, gametime Thanks again for all your help!! John --- DL Neil <[EMAIL PROTECTED]> wrote: > Howdy John, > > > Sorry for the lack of information in the subject > line, > > but I didn't know how else to explain it > briefly... > > =don't be sorry, re-word it! > > > I have 2 tables and they look like this: > > > > There are 2 other tables involved, but they don't > come > > into play for this portion of the problem so I > won't > > bother you with the details. > > > > Some sample data may look like this: > > > > Table: teams > > | ID | leagueID | divisionID | name| > > | 11 | 1| 5 | Dodgers | > > | 12 | 1| 5 | Cobras | > > | 13 | 1| 5 | Bombers | > > > > Table: games > > | ID | leagueID | divisionID | hometeamID | > awayteamID > > | gamedate | gametime | > > | 1 | 1| 1 | 12 | 13 > > | 2002-02-21 | 15:30:00 | > > | 2 | 1| 1 | 11 | 12 > > | 2002-02-26 | 15:30:00 | > > > > Here's the issue... > > > > I want to be able to have it pull in the name for > each > > of the teams (home and away) from the database. My > > existing query looks like the following: > > (note: $leagueID = 1 in the following line) > > > > SELECT gdate, gtime, divisions.name as division, > > teams.name as teama, teams.name as teamb FROM > > divisions, teams, games WHERE games.leagueID = > > '$leagueID' group by gamedate, gametime > > > > This has gotten me close, but, not over the hump. > > > > As always, I hope I have explained this well > enough! > > > The missing item that might have been helpful is a > sample output of what you have so far. I'll guess > that it's > something like: > > gdate, gtime, division, teama, teamb > -02-21 15:30 1 blank blank > > If you substitute/add hometeamID and awayteamID in > the resultset (purely for debugging purposes) then > you should > see the IDs 12 and 13 appearing, but still no team > names under teama or teamb. > > You probably know that you are missing the join > between games and teams. There is no reason why you > cannot have > two joins - "double dipping". Did you try it? > > WHERE...teams.ID=hometeamID AND teams.ID=awayteamID > > NB the above does not imply (as some might at first > think) that hometeamID would have to equal > awayteamID for > this to work, the two ANDs/the two joins are > independently arranged. > > Let us know how you get on! > =dn > > __ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] configuring php for oracle...
Can anybody tell me how could I configuring php for work with oracle 8...I read that the dll requieres otrher libraries but dont know wichs Greetings... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP & ODBC
Hi, I'm running True64 UNIX with ingres 6.4 and openlink ODBC. When i connect thru cgi(C/C++) it works fine but when i connect via PHP 4.1.1 gives me this error: [OpenLink][ODBC][Driver]No key columns found for table referenced by keyset driven cursor., SQL state IM909 in SQLPrepare I compiled php like this: ./configure' '--with-odbc=/usr/soft/openlink/odbcsdk' '--with-apache=../apache_1.3.22' '--enable-track-vars' I didn´t install iodbc because it's has a problem with snprintf Cal anyone help me with this? P Freitas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: mysql_insert_id?
"Wee Chua" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > Is it possible that I would get the wrong ID (Not the ID I just inserted in > Auto_Increment field) by using mysql_insert_id function if someone is also > inserting record at the same time? How does mysql_insert_id work accurately? > > Thanks, > Wee You can get the last auto_inc with the following query: "SHOW TABLE STATUS 'my_table_having_an_autoinc'" and then lookup the field "Auto_increment" in the result set. Best regards Christian -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Parse error
You know this was a real bad stupid on my part. I saved the file in the wrong place. After "moving" the file to my web folder and not saving to the web folder I was using the original parse error file in the temp dir. I re-saved in the web folder and what do ya know it worked. Sorry for wasting all your time. I'll try to think better in the future. Thanks Jen "Jennifer Downey" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Can someone tell me why I am getting a parse error in this little snip? > > > $origVar = 100; > echo "Original value is $origVar"; > > $origVar += 25; > echo "Added a value, now it's $origVar"; > > $origVar -= 12; > echo "Subtracted a value, now it's $origVar"; > > $origVar .= " chickens"; > echo "Final answer: $origVar"; > > ?> > > Thanks in advance > Jen Downey > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] selecting question
Ahha, thats true :) Clever :) - Original Message - From: "William Fong" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 21, 2002 1:31 AM Subject: Re: [PHP-DB] selecting question > That's what I'm talking about. Make that one table and put a 'status' > column. Because then, wouldn't you be concerned on adding an entry to > tbl.buildings and removing one from tbl.building_queue. > > -- > William Fong - [EMAIL PROTECTED] > Phone: 626.968.6424 x210 | Fax: 626.968.6877 > Wireless #: 805.490.7732| Wireless E-mail: [EMAIL PROTECTED] > > > > > - Original Message - > From: "ACEAlex" <[EMAIL PROTECTED]> > To: "William Fong" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, February 20, 2002 3:33 PM > Subject: Re: [PHP-DB] selecting question > > > : As i discribed (or did i??) building_info is for the different types of > : buildings. Buildings are for those who are currently built, and > : building_queue are for those who are on queue. I also have a key called > : planet_id that says on which planet we are looking at. > : > : /Alexander > : > : - Original Message - > : From: "William Fong" <[EMAIL PROTECTED]> > : To: <[EMAIL PROTECTED]> > : Sent: Thursday, February 21, 2002 12:24 AM > : Subject: Re: [PHP-DB] selecting question > : > : > : > Ok... so tbl.building_info contains all the different types of > buildings. > : > Didn't get that... :) > : > > : > So what are the other types for then? They seem to be identical. > : > > : > -- > : > William Fong - [EMAIL PROTECTED] > : > Phone: 626.968.6424 x210 | Fax: 626.968.6877 > : > Wireless #: 805.490.7732| Wireless E-mail: > [EMAIL PROTECTED] > : > > : > > : > > : > > : > - Original Message - > : > From: "ACEAlex" <[EMAIL PROTECTED]> > : > To: "William Fong" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > : > Sent: Wednesday, February 20, 2002 1:56 PM > : > Subject: Re: [PHP-DB] selecting question > : > > : > > : > : Because the buildings that are avaible are stored in building info. > : There > : > : are the info that says what the benifit is of that building to :) They > : are > : > : not identical. A building "type" can exist on several places :) > : > : > : > : /Alexander > : > : > : > : - Original Message - > : > : From: "William Fong" <[EMAIL PROTECTED]> > : > : To: <[EMAIL PROTECTED]> > : > : Sent: Wednesday, February 20, 2002 10:46 PM > : > : Subject: Re: [PHP-DB] selecting question > : > : > : > : > : > : > Hmmm... Why do you want two or three tables? Why not just one? > : > : > tbl.buildings and tbl.building_queue looks identical. Looks like > you > : > can > : > : > merge the two and stick it in tbl.building_info. Just add in > : > : > tbl.building_info a 'status' column. In that, I'd store say '1' for > : > : > building in progress, and '2' for finished buildings. > : > : > > : > : > ??? > : > : > > : > : > -w > : > : > > : > : > -- > : > : > William Fong - [EMAIL PROTECTED] > : > : > Phone: 626.968.6424 x210 | Fax: 626.968.6877 > : > : > Wireless #: 805.490.7732| Wireless E-mail: > : > [EMAIL PROTECTED] > : > : > > : > : > > : > : > > : > : > > : > : > - Original Message - > : > : > From: "ACEAlex" <[EMAIL PROTECTED]> > : > : > To: "Rick Emery" <[EMAIL PROTECTED]>; "php-db" <[EMAIL PROTECTED]> > : > : > Sent: Wednesday, February 20, 2002 12:53 PM > : > : > Subject: Re: [PHP-DB] selecting question > : > : > > : > : > > : > : > : I could make a rutine in php to make it work but i want to make > the > : > : > : datagrabbing thing in mysql :( > : > : > : > : > : > : - Original Message - > : > : > : From: "Rick Emery" <[EMAIL PROTECTED]> > : > : > : To: "'ACEAlex'" <[EMAIL PROTECTED]> > : > : > : Sent: Wednesday, February 20, 2002 6:25 PM > : > : > : Subject: RE: [PHP-DB] selecting question > : > : > : > : > : > : > : > : > : > > : > : > : > I'm still trying to work this. There MUST be an easy answer... > : > : > : > rick > : > : > : > > : > : > : > -Original Message- > : > : > : > From: ACEAlex [mailto:[EMAIL PROTECTED]] > : > : > : > Sent: Wednesday, February 20, 2002 9:30 AM > : > : > : > To: Markus Lervik > : > : > : > Cc: php-db > : > : > : > Subject: Re: [PHP-DB] selecting question > : > : > : > > : > : > : > > : > : > : > Ok. i think i have to make things clearer :).. Here, is my real > : > mysql > : > : > : thing. > : > : > : > I and a friend are trying to make a silly space game and i have > : > : problems > : > : > : > with this query. > : > : > : > Ok, if i set up a database with this > : > : > : > > : > : > : > CREATE TABLE building_info ( > : > : > : > id int(11) NOT NULL auto_increment, > : > : > : > name varchar(32) default NULL, > : > : > : > description text, > : > : > : > PRIMARY KEY (id) > : > : > : > ) TYPE=MyISAM; > : > : > : > INSERT INTO building_info VALUES (1,'Factory','N/A'); > : > : > : > INSERT INTO building_info VALUES (2,'Smaltvark','N/A'); > : > : > : > INSERT INTO building_info VALUES (3,'Superfarm','
RE: [PHP-DB] Parse error
Hi Jenn, The code looked ok to me , so I copied and pasted the code you posted and it worked for me.. Where are you getting the parsing error? Is it the whole code anyway? Gurhan -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 9:33 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Parse error Can someone tell me why I am getting a parse error in this little snip? Original value is $origVar"; $origVar += 25; echo "Added a value, now it's $origVar"; $origVar -= 12; echo "Subtracted a value, now it's $origVar"; $origVar .= " chickens"; echo "Final answer: $origVar"; ?> Thanks in advance Jen Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Parse error
try: Original value is".$origVar.""; $origVar += 25; echo "Added a value, now it's ".$origVar.""; $origVar -= 12; echo "Subtracted a value, now it's ".$origVar.""; $origVar .= " chickens"; echo "Final answer: ".$origVar.""; ?> Cami -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 2:33 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Parse error Can someone tell me why I am getting a parse error in this little snip? Original value is $origVar"; $origVar += 25; echo "Added a value, now it's $origVar"; $origVar -= 12; echo "Subtracted a value, now it's $origVar"; $origVar .= " chickens"; echo "Final answer: $origVar"; ?> Thanks in advance Jen Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help on PHP vs JAVA
That's a pretty naive question to ask. For what specific task do you want to compare them ? Besides if you can't write a comparison article on PHP vs. JAVa , how can you set the outcome in PHP's favor? I would advise you to sit down and try to do the task both in Java and PHP , and compare both . They both are free, they both are cross-platform, but you can compare them in terms of their capabilities to do things, performance, speed, easiness to write and maintain the code , etc. And the result would differ according to the project you are working on... Gurhan -Original Message- From: Berlina [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 4:08 AM To: php-general-list; php-dev-list; php-db-list Subject: [PHP-DB] Help on PHP vs JAVA Hello to everybody, I need some help for writting a comparison of PHP vs JAVA, and of course, I need that PHP wins ;-D Any ideas? Any comparison wrote? Advanced Thanks, F.P. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] How do I add multiple var to a if clause ?
If you are looking for speed and efficiency in your code then Mat has touched on it. This example will execute the fastest... If( $var <= 3 ) {} If you do or statements or and statements all of the if statement needs to be evaluated. So if you have an "or" or "and" all the statements in the if clause needs to be evaluated. Just some technical crap for the insane... Ray Hunter Firmware Engineer ENTERASYS NETWORKS -Original Message- From: matt stewart [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 3:47 AM To: php List Subject: RE: [PHP-DB] How do I add multiple var to a if clause ? either if (($var <= 3)&&($var >= 1)){ } if you want it to just be somewhere between one and 3, or $my_array = array ("1", "2", "3"); if (in_array($variable, $my_array)) { } if you want it to be just one of those exact values. -Original Message- From: Dave Carrera [mailto:[EMAIL PROTECTED]] Sent: 21 February 2002 10:40 To: php List Subject: [PHP-DB] How do I add multiple var to a if clause ? Hi All If($var == 1,2,3){ } This is wrong so what is the right way. I am try to find out a if var equals either 1 2 or 3 do something type thing but cant find answers anywhere Thanks in Advance Dave Carrera Php / MySql Development Web Design Site Marketing http://www.davecarrera.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.323 / Virus Database: 180 - Release Date: 08/02/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.323 / Virus Database: 180 - Release Date: 08/02/02 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Parse error
Can someone tell me why I am getting a parse error in this little snip? Original value is $origVar"; $origVar += 25; echo "Added a value, now it's $origVar"; $origVar -= 12; echo "Subtracted a value, now it's $origVar"; $origVar .= " chickens"; echo "Final answer: $origVar"; ?> Thanks in advance Jen Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Join
Thank you Beau, Appreciate that clarification. Jen "Beau Lebens" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > what you are referring to actually has nothing to do with PHP Jen - that's > why the manual wasn't much help :) > > JOIN is an SQL command, so check out the manual of your RDBMS (ie. > http://www.mysql.com/doc/J/O/JOIN.html for MySQL) > > good luck :) > > Beau > > // -Original Message- > // From: Jennifer Downey [mailto:[EMAIL PROTECTED]] > // Sent: Thursday, 21 February 2002 10:47 AM > // To: [EMAIL PROTECTED] > // Subject: [PHP-DB] Join > // > // > // Could someone point me in the right direction for joining > // tables? I have > // searched the php manual for it but only found info on joining arrays. > // > // If someone could point me to a code snip or a tutorial I would much > // appreciate it. > // > // Thanks in advance > // > // Jen Downey > // > // > // > // -- > // 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] Problems connecting to MySQL from a vhost
I'm developing php from a win2k box and recently added vhosts to the httpd.conf file, as shown below #+ NameVirtualHost * ServerAdmin webmaster@localhost DocumentRoot "D:/Internet/crestar/web/" ServerName localhost ErrorLog logs/crestar-error_log CustomLog logs/localhost-access_log common ServerAdmin webmaster@crestar DocumentRoot "D:/Internet/crestar/web/" ServerName crestar ErrorLog logs/crestar-error_log CustomLog logs/crestar-access_log common ServerAdmin webmaster@dev DocumentRoot "D:/Internet/Dev/Web" ServerName dev ErrorLog logs/dev-error_log CustomLog logs/dev-access_log common ServerAdmin webmaster@agent DocumentRoot "D:/Internet/Agent/Web" ServerName agent ErrorLog logs/agent-error_log CustomLog logs/agent-access_log common ServerAdmin webmaster@new DocumentRoot "D:/Internet/New/Web" ServerName new ErrorLog logs/new-error_log CustomLog logs/new-access_log common #+ but as soon as i add a vhost to apache I cannot connect to mysql. can anyone help? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] newbe: how to import a whole db from an .sql file
Hi Steven, The problem is that when doing mysql_query (et al) from PHP, you DON'T specify the semicolon (;) at the end of a query. If you want to import this back into MySQL, do the following: 1. Go into mysql and recreate the database manually -- the dump from mysqldump does NOT have a command to recreate the db. 2. Run "mysql < textfile.sql", where textfile.sql is the dumpfile that was created. Be sure to use the -p option if you need to specify a password. Good luck. -bsh steven wrote: >I'm moving a mySQL db from my own server over to an external hosting >company. there I don't have any root access of course... so I log in the >mySQL-console. > >I made a 'db-dump' of my mySQL db (with Webmin), so I've got a textfile with >a large amount of SQL-statements inside. (CREATE TABLE and INSERT INTO's) > >I tried the usual connection to the db, and then: > >@mysql_db_query('dbname', $myQ, $lid); > >where $myQ is a string of the whole textfile. I get this error: > >1064You have an error in your SQL syntax near '; INSERT INTO ISshipping >VALUES (8,'966637132','EWW','Emery Worldwide','EWW93' at line 20 > >it seems as if the first sql-statement is ok, but the query command from php >can't handle multiple statements devided by the ';'... > >How can I import the whole file? > >tnx for any help! > > > -- === Billy S Halsey Software Problem Resolution ESP Solaris Software Email [EMAIL PROTECTED]Sun Microsystems, Inc -NO DAY BUT TODAY- === -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Parse error (a bit OT)
Glad you figured it out :) Cheers, Joe :) "Markus Lervik" <[EMAIL PROTECTED]> wrote in message 1014295168.26036.27.camel@hal9000">news:1014295168.26036.27.camel@hal9000... > On Thu, 2002-02-21 at 14:36, Lerp wrote: > > > Hi there :) I think you just might be missing two curly braces. Like below. > > if ($next_week) { > > while(date("W",mktime(0,0,0,$m,$d,$Y))==$week) { > > ...blablabla... > > } > > > > } > > Well, I intentionally left a few lines and curly brackets and stuff off > the mail, so that wasn't the problem. I've solved it though (sort of). > Turns out I was blind, after all. See, I use a Finnish layout on my > keyboard. I get curly brackets by pressing AltGr+7/AltGr+0. > > I seem to have accidentally held down AltGR and pressed space after a > curly bracket, which results in some sort of empty character, but a > character nevertheless. ;) I have the same problem in my gnome terminal > too, typing, for example 'ps -aux | grep whatever'. I get, every now and > then, complaints about bash not being able to find ' grep'. ;) > > Cheers, > Markus > > > > Can anyone tell me what's wrong with line 68? I get a parse error on > > > line 68 trying to run this. The strange thing is that it doesn't > > > complain about line 54. Either I'm blind, stupid, or there's somehing > > > very wrong here. I've checked above line 67 too, but there doesn't seem > > > to be any missing brackets or semicolons... > > > > > > Cheers, > > > Markus > > > > > > > > > > > > > > > > > > 53: if ($prev_week) { > > > 54:while(date("W",mktime(0,0,0,$m,$d,$Y))==$week) { > > > ...blababla... > > > } > > > > > > 67: if ($next_week) { > > > 68:while(date("W",mktime(0,0,0,$m,$d,$Y))==$week) { > > > ...blablabla... > > > } > > -- > Markus Lervik > Linux-administrator with a kungfoo grip > Vaasa City Library - Regional Library > [EMAIL PROTECTED] > +358-6-325 3589 / +358-40-832 6709 > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] newbe: how to import a whole db from an .sql file
I'm moving a mySQL db from my own server over to an external hosting company. there I don't have any root access of course... so I log in the mySQL-console. I made a 'db-dump' of my mySQL db (with Webmin), so I've got a textfile with a large amount of SQL-statements inside. (CREATE TABLE and INSERT INTO's) I tried the usual connection to the db, and then: @mysql_db_query('dbname', $myQ, $lid); where $myQ is a string of the whole textfile. I get this error: 1064You have an error in your SQL syntax near '; INSERT INTO ISshipping VALUES (8,'966637132','EWW','Emery Worldwide','EWW93' at line 20 it seems as if the first sql-statement is ok, but the query command from php can't handle multiple statements devided by the ';'... How can I import the whole file? tnx for any help! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Parse error (a bit OT)
On Thu, 2002-02-21 at 14:36, Lerp wrote: > Hi there :) I think you just might be missing two curly braces. Like below. > if ($next_week) { > while(date("W",mktime(0,0,0,$m,$d,$Y))==$week) { > ...blablabla... > } > > } Well, I intentionally left a few lines and curly brackets and stuff off the mail, so that wasn't the problem. I've solved it though (sort of). Turns out I was blind, after all. See, I use a Finnish layout on my keyboard. I get curly brackets by pressing AltGr+7/AltGr+0. I seem to have accidentally held down AltGR and pressed space after a curly bracket, which results in some sort of empty character, but a character nevertheless. ;) I have the same problem in my gnome terminal too, typing, for example 'ps -aux | grep whatever'. I get, every now and then, complaints about bash not being able to find ' grep'. ;) Cheers, Markus > > Can anyone tell me what's wrong with line 68? I get a parse error on > > line 68 trying to run this. The strange thing is that it doesn't > > complain about line 54. Either I'm blind, stupid, or there's somehing > > very wrong here. I've checked above line 67 too, but there doesn't seem > > to be any missing brackets or semicolons... > > > > Cheers, > > Markus > > > > > > > > > > > > 53: if ($prev_week) { > > 54:while(date("W",mktime(0,0,0,$m,$d,$Y))==$week) { > > ...blababla... > > } > > > > 67: if ($next_week) { > > 68:while(date("W",mktime(0,0,0,$m,$d,$Y))==$week) { > > ...blablabla... > > } -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library [EMAIL PROTECTED] +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Parse error (a bit OT)
Hi there :) I think you just might be missing two curly braces. Like below. if ($prev_week) { while(date("W",mktime(0,0,0,$m,$d,$Y))==$week) { ...blababla... } } if ($next_week) { while(date("W",mktime(0,0,0,$m,$d,$Y))==$week) { ...blablabla... } } Hope this helps, Joe :) "Markus Lervik" <[EMAIL PROTECTED]> wrote in message 1014290431.26064.10.camel@hal9000">news:1014290431.26064.10.camel@hal9000... > Hello, > > Can anyone tell me what's wrong with line 68? I get a parse error on > line 68 trying to run this. The strange thing is that it doesn't > complain about line 54. Either I'm blind, stupid, or there's somehing > very wrong here. I've checked above line 67 too, but there doesn't seem > to be any missing brackets or semicolons... > > Cheers, > Markus > > > > > > 53: if ($prev_week) { > 54:while(date("W",mktime(0,0,0,$m,$d,$Y))==$week) { > ...blababla... > } > > 67: if ($next_week) { > 68:while(date("W",mktime(0,0,0,$m,$d,$Y))==$week) { > ...blablabla... > } > > > > > -- > Markus Lervik > Linux-administrator with a kungfoo grip > Vaasa City Library - Regional Library > [EMAIL PROTECTED] > +358-6-325 3589 / +358-40-832 6709 > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Parse error (a bit OT)
Hello, Can anyone tell me what's wrong with line 68? I get a parse error on line 68 trying to run this. The strange thing is that it doesn't complain about line 54. Either I'm blind, stupid, or there's somehing very wrong here. I've checked above line 67 too, but there doesn't seem to be any missing brackets or semicolons... Cheers, Markus 53: if ($prev_week) { 54:while(date("W",mktime(0,0,0,$m,$d,$Y))==$week) { ...blababla... } 67: if ($next_week) { 68:while(date("W",mktime(0,0,0,$m,$d,$Y))==$week) { ...blablabla... } -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library [EMAIL PROTECTED] +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How do I add multiple var to a if clause ?
You can use: if ( ($var == 1) or ($var == 2) or ($var == 3)) { ... } - Original Message - From: "Dave Carrera" <[EMAIL PROTECTED]> To: "php List" <[EMAIL PROTECTED]> Sent: Thursday, February 21, 2002 12:40 PM Subject: [PHP-DB] How do I add multiple var to a if clause ? > Hi All > > If($var == 1,2,3){ > } > This is wrong so what is the right way. > > I am try to find out a if var equals either 1 2 or 3 do something type > thing but cant find answers anywhere > > Thanks in Advance > > Dave Carrera > Php / MySql Development > Web Design > Site Marketing > http://www.davecarrera.com > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] How do I add multiple var to a if clause ?
either if (($var <= 3)&&($var >= 1)){ } if you want it to just be somewhere between one and 3, or $my_array = array ("1", "2", "3"); if (in_array($variable, $my_array)) { } if you want it to be just one of those exact values. -Original Message- From: Dave Carrera [mailto:[EMAIL PROTECTED]] Sent: 21 February 2002 10:40 To: php List Subject: [PHP-DB] How do I add multiple var to a if clause ? Hi All If($var == 1,2,3){ } This is wrong so what is the right way. I am try to find out a if var equals either 1 2 or 3 do something type thing but cant find answers anywhere Thanks in Advance Dave Carrera Php / MySql Development Web Design Site Marketing http://www.davecarrera.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.323 / Virus Database: 180 - Release Date: 08/02/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.323 / Virus Database: 180 - Release Date: 08/02/02 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] How do I add multiple var to a if clause ?
Hi All If($var == 1,2,3){ } This is wrong so what is the right way. I am try to find out a if var equals either 1 2 or 3 do something type thing but cant find answers anywhere Thanks in Advance Dave Carrera Php / MySql Development Web Design Site Marketing http://www.davecarrera.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Double Dipping
Howdy John, > Sorry for the lack of information in the subject line, > but I didn't know how else to explain it briefly... =don't be sorry, re-word it! > I have 2 tables and they look like this: > > There are 2 other tables involved, but they don't come > into play for this portion of the problem so I won't > bother you with the details. > > Some sample data may look like this: > > Table: teams > | ID | leagueID | divisionID | name| > | 11 | 1| 5 | Dodgers | > | 12 | 1| 5 | Cobras | > | 13 | 1| 5 | Bombers | > > Table: games > | ID | leagueID | divisionID | hometeamID | awayteamID > | gamedate | gametime | > | 1 | 1| 1 | 12 | 13 > | 2002-02-21 | 15:30:00 | > | 2 | 1| 1 | 11 | 12 > | 2002-02-26 | 15:30:00 | > > Here's the issue... > > I want to be able to have it pull in the name for each > of the teams (home and away) from the database. My > existing query looks like the following: > (note: $leagueID = 1 in the following line) > > SELECT gdate, gtime, divisions.name as division, > teams.name as teama, teams.name as teamb FROM > divisions, teams, games WHERE games.leagueID = > '$leagueID' group by gamedate, gametime > > This has gotten me close, but, not over the hump. > > As always, I hope I have explained this well enough! The missing item that might have been helpful is a sample output of what you have so far. I'll guess that it's something like: gdate, gtime, division, teama, teamb -02-21 15:30 1 blank blank If you substitute/add hometeamID and awayteamID in the resultset (purely for debugging purposes) then you should see the IDs 12 and 13 appearing, but still no team names under teama or teamb. You probably know that you are missing the join between games and teams. There is no reason why you cannot have two joins - "double dipping". Did you try it? WHERE...teams.ID=hometeamID AND teams.ID=awayteamID NB the above does not imply (as some might at first think) that hometeamID would have to equal awayteamID for this to work, the two ANDs/the two joins are independently arranged. Let us know how you get on! =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP-DEV] Help on PHP vs JAVA
On Thu, 2002-02-21 at 01:07, Berlina wrote: > Hello to everybody, > > I need some help for writting a comparison of PHP vs JAVA, and of course, I > need that PHP wins > ;-D Wins what? For what task? This is quite a nebulous question. And if you've decided which will win before you've done the research, that research won't be worth much, will it? However, here's one place to start: try typing words like 'comparison', 'php', and 'java' together into Google. I just found a pile of articles on the topic in under 3 seconds of looking. > Any ideas? > Any comparison wrote? > > Advanced Thanks, > F.P. P.S. Please, pick *one* mailing list. This question has nothing to do with either php-dev or php-db. -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help on PHP vs JAVA
Hello to everybody, I need some help for writting a comparison of PHP vs JAVA, and of course, I need that PHP wins ;-D Any ideas? Any comparison wrote? Advanced Thanks, F.P. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SELECT where something exists but something else does not
I think I forgot something usefull... - Original Message - From: "Beau Lebens" <[EMAIL PROTECTED]> To: "PHP DB (E-mail)" <[EMAIL PROTECTED]> Sent: Thursday, February 21, 2002 3:59 AM Subject: [PHP-DB] SELECT where something exists but something else does not > Hey guys, > I am a little stuck here, i know how to botch a solution together using a > bunch of queries and PHP manipulation, but i am sure there is a more elegant > way to do this one; > > i have some tables (i won't put their full defs, just bits that are relevant > (they are huge)) > > TABLE students > FIELDS > studentID > fname > lname > title > studentNo > > TABLE theses > FIELDS > thesisID > studentID > title > > TABLE thesis_reports > FIELDS > reportID > thesisID > year > > > now, what we are dealing with here is records of theses and the reports that > students are required to submit relating to them (yearly). i need to be able > to pull up a record of students who have a record of a thesis (something in > table "theses") but do NOT have an entry in "thesis_reports" for this year > yet. > > an attempt at some SQL that sort of pretends to do the right thing :) > > SELECT DISTINCT(students.studentID), students.title, students.fname, > students.lname, students.studentNo FROM students, theses, thesis_reports > WHERE theses.studentID=students.studentID AND > thesis_reports.thesisID=theses.thesisID AND thesis_reports.year != '2002' > > does that make sense? > what it actually returns is just any student with any record in the DB under > thesis_reports that doesn't eqal '2002', even if they happen to also have > one that *is* for 2002 (ie. my test student has a report for 1999, 2001 and > 2002, but still gets selected by that > > > -- > Beau Lebens, Technical Officer > Science and Mathematics Education Centre > Curtin University of Technology, > GPO Box U1987 Perth, Western Australia 6845 > CRICOS provider code 00301J > > t: +61 8 9266-7297 (has voice-mail) > f: +61 8 9266-2503 (ATT: Beau Lebens) > e: [EMAIL PROTECTED] > w: http://learnt.smec.curtin.edu.au/ > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > thesis_test.zip Description: application/compressed -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SELECT where something exists but something else does not
Hi! I think I have solved your problem... I have attached an sql file to create the sample DB I created for my test and a PHP file for you to run to see how I have implemented it. First create the tables with the .sql file an then execute the .php file from your browser. Hope these help. - Original Message - From: "Beau Lebens" <[EMAIL PROTECTED]> To: "PHP DB (E-mail)" <[EMAIL PROTECTED]> Sent: Thursday, February 21, 2002 3:59 AM Subject: [PHP-DB] SELECT where something exists but something else does not > Hey guys, > I am a little stuck here, i know how to botch a solution together using a > bunch of queries and PHP manipulation, but i am sure there is a more elegant > way to do this one; > > i have some tables (i won't put their full defs, just bits that are relevant > (they are huge)) > > TABLE students > FIELDS > studentID > fname > lname > title > studentNo > > TABLE theses > FIELDS > thesisID > studentID > title > > TABLE thesis_reports > FIELDS > reportID > thesisID > year > > > now, what we are dealing with here is records of theses and the reports that > students are required to submit relating to them (yearly). i need to be able > to pull up a record of students who have a record of a thesis (something in > table "theses") but do NOT have an entry in "thesis_reports" for this year > yet. > > an attempt at some SQL that sort of pretends to do the right thing :) > > SELECT DISTINCT(students.studentID), students.title, students.fname, > students.lname, students.studentNo FROM students, theses, thesis_reports > WHERE theses.studentID=students.studentID AND > thesis_reports.thesisID=theses.thesisID AND thesis_reports.year != '2002' > > does that make sense? > what it actually returns is just any student with any record in the DB under > thesis_reports that doesn't eqal '2002', even if they happen to also have > one that *is* for 2002 (ie. my test student has a report for 1999, 2001 and > 2002, but still gets selected by that > > > -- > Beau Lebens, Technical Officer > Science and Mathematics Education Centre > Curtin University of Technology, > GPO Box U1987 Perth, Western Australia 6845 > CRICOS provider code 00301J > > t: +61 8 9266-7297 (has voice-mail) > f: +61 8 9266-2503 (ATT: Beau Lebens) > e: [EMAIL PROTECTED] > w: http://learnt.smec.curtin.edu.au/ > > -- > 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