RE: [PHP] Problem with MySQL
2007. 03. 21, szerda keltezéssel 00.04-kor Richard Lynch ezt írta: > On Tue, March 20, 2007 11:08 am, Ford, Mike wrote: > >> what do you want with that '@' here? > >> that operator can be used to suppress error messages when calling > >> functions but not when using a variable > > This is most definitely way wrong. > > > What complete tosh! @ is a unary operator, so can be applied to any > > expression. > > > > Proof: > > > >> echo "no @ --", $HTTP_GET_VARS['bogus'], "\n"; > > echo "with @ --", @$HTTP_GET_VARS['bogus'], "\n"; > > ?> > > > > Result: > > > > no @ -- > > Warning: Undefined index: bogus in > > c:\www-lco\scripts_etc\lco\php\test.php on line 18 > > > > with @ -- > > > > > > Also: > > > >> $a = 123; > > echo "no @ --", $a/0, "\n"; > > echo "with @ --", @($a/0), "\n"; > > ?> > > > > Result: > > > > no @ -- > > Warning: Division by zero in c:\www-lco\scripts_etc\lco\php\test.php > > on line 19 > > > > with @ -- > > > > > > Not that I'm necessarily advocating this as a technique, but let's not > > spread disinformation! > > While it has now been proven that @ is "more" than a function > error-suppressant, I suspect it may technically be a Language > Construct rather than a simple unary operator... > > Not that I can come up with anything yet to prove it, as all my > examples so far were total syntax errors... > > Although I did find an interesting anomoly... > > What would you expect this to output? > > > Hint: > I figured it would apply the @ to no expression at all and do nothing. > I was wrong. > > I suppose I could try to read PHP source and figure all this out > someday... actually I tried it and the output suprised me also it was Parse error: syntax error, unexpected ';' in /var/www/tests/kukactest1.php on line 1 although I tried it with the unary operator ! that produces the same output so this behaviour is probably the way operators behave... but it is really interesting ;) greets Zoltán Németh > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with MySQL
On Tue, March 20, 2007 11:08 am, Ford, Mike wrote: >> what do you want with that '@' here? >> that operator can be used to suppress error messages when calling >> functions but not when using a variable This is most definitely way wrong. > What complete tosh! @ is a unary operator, so can be applied to any > expression. > > Proof: > >echo "no @ --", $HTTP_GET_VARS['bogus'], "\n"; > echo "with @ --", @$HTTP_GET_VARS['bogus'], "\n"; > ?> > > Result: > > no @ -- > Warning: Undefined index: bogus in > c:\www-lco\scripts_etc\lco\php\test.php on line 18 > > with @ -- > > > Also: > >$a = 123; > echo "no @ --", $a/0, "\n"; > echo "with @ --", @($a/0), "\n"; > ?> > > Result: > > no @ -- > Warning: Division by zero in c:\www-lco\scripts_etc\lco\php\test.php > on line 19 > > with @ -- > > > Not that I'm necessarily advocating this as a technique, but let's not > spread disinformation! While it has now been proven that @ is "more" than a function error-suppressant, I suspect it may technically be a Language Construct rather than a simple unary operator... Not that I can come up with anything yet to prove it, as all my examples so far were total syntax errors... Although I did find an interesting anomoly... What would you expect this to output? Hint: I figured it would apply the @ to no expression at all and do nothing. I was wrong. I suppose I could try to read PHP source and figure all this out someday... -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with MySQL
2007. 03. 20, kedd keltezéssel 16.08-kor Ford, Mike ezt írta: > On 20 March 2007 13:26, Németh Zoltán wrote: > > > 2007. 03. 20, kedd keltezéssel 15.09-kor Pavel Kaznarskiy ezt írta: > > > Hello ! > > > I have problem with access in mysql > > > > > > it is my code: > > > > > > SQL Query Sender > > > > > > > > $host=""; > > > $user=""; > > > $password=""; > > > /* Section that executes query */ > > > if(@$_GET['form'] == "yes") > > > > what do you want with that '@' here? > > that operator can be used to suppress error messages when calling > > functions but not when using a variable > > What complete tosh! @ is a unary operator, so can be applied to any > expression. > > Proof: > >echo "no @ --", $HTTP_GET_VARS['bogus'], "\n"; > echo "with @ --", @$HTTP_GET_VARS['bogus'], "\n"; > ?> > > Result: > > no @ -- > Warning: Undefined index: bogus in c:\www-lco\scripts_etc\lco\php\test.php > on line 18 > > with @ -- > > > Also: > >$a = 123; > echo "no @ --", $a/0, "\n"; > echo "with @ --", @($a/0), "\n"; > ?> > > Result: > > no @ -- > Warning: Division by zero in c:\www-lco\scripts_etc\lco\php\test.php on > line 19 > > with @ -- > > > Not that I'm necessarily advocating this as a technique, but let's not spread > disinformation! okay, sorry for my ignorance ;) greets Zoltán Németh > > Cheers! > > Mike > > - > Mike Ford, Electronic Information Services Adviser, > Learning Support Services, Learning & Information Services, > JG125, James Graham Building, Leeds Metropolitan University, > Headingley Campus, LEEDS, LS6 3QS, United Kingdom > Email: [EMAIL PROTECTED] > Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 > > > To view the terms under which this email is distributed, please go to > http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with MySQL
On 20 March 2007 13:26, Németh Zoltán wrote: > 2007. 03. 20, kedd keltezéssel 15.09-kor Pavel Kaznarskiy ezt írta: > > Hello ! > > I have problem with access in mysql > > > > it is my code: > > > > SQL Query Sender > > > > > $host=""; > > $user=""; > > $password=""; > > /* Section that executes query */ > > if(@$_GET['form'] == "yes") > > what do you want with that '@' here? > that operator can be used to suppress error messages when calling > functions but not when using a variable What complete tosh! @ is a unary operator, so can be applied to any expression. Proof: \n"; echo "with @ --", @$HTTP_GET_VARS['bogus'], "\n"; ?> Result: no @ -- Warning: Undefined index: bogus in c:\www-lco\scripts_etc\lco\php\test.php on line 18 with @ -- Also: \n"; echo "with @ --", @($a/0), "\n"; ?> Result: no @ -- Warning: Division by zero in c:\www-lco\scripts_etc\lco\php\test.php on line 19 with @ -- Not that I'm necessarily advocating this as a technique, but let's not spread disinformation! Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm
Re: [PHP] Problem with MySQL
Németh Zoltán wrote: > 2007. 03. 20, kedd keltezéssel 15.09-kor Pavel Kaznarskiy ezt írta: >> Hello ! ... > > what do you want with that '@' here? > that operator can be used to suppress error messages when calling > functions but not when using a variable > not true - although it's a lazy/bad* way of doing things, the following only emits 1 E_NOTICE: php -r ' error_reporting(E_ALL); if ($foo == "bar") echo "qux"; if (@$foo == "bar") echo "qux"; ' *take your pick ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with MySQL
> > > > Warning: mysql_select_db(): Access denied for user > 'ODBC'@'localhost' (using password: NO) in > z:\home\localhost\www\2.php on line 12 > > > > Warning: mysql_select_db(): A link to the server could not > be established in z:\home\localhost\www\2.php on line 12 > > > > Warning: mysql_query(): Access denied for user > 'ODBC'@'localhost' (using password: NO) in > z:\home\localhost\www\2.php on line 14 > > > > Warning: mysql_query(): A link to the server could not be > established in z:\home\localhost\www\2.php on line 14 > > Database Selected: i" > > > > what does it' mean? > > It just means that you are using a wrong username/password combination > to connect. Or that the user ODBC does not have access granted to the database or table he is trying to access. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL
On 3/20/07, Pavel Kaznarskiy <[EMAIL PROTECTED]> wrote: Hello ! I have problem with access in mysql it is my code: SQL Query Sender {$_POST['database']} Query: $queryResults"; if($result == 0) echo "Error ".mysql_errno().": ".mysql_error(). ""; elseif (@mysql_num_rows($result) == 0) echo("Query completed. No results returned. "); else { echo " "; for($i = 0;$i < mysql_num_fields($result);$i++) { echo "".mysql_field_name($result,$i). ""; } echo " "; for ($i = 0; $i < mysql_num_rows($result); $i++) { echo ""; $row = mysql_fetch_row($result); for($j = 0;$j" . $row[$j] . ""); } echo ""; } echo " "; } //end else echo " "; unset($form); exit(); } // endif form=yes /* Section that requests user input of query */ @$query=stripSlashes($_POST['query']); if (@$_POST['queryButton'] != "Edit Query") { $query = " "; } ?> Type in database name > Type in SQL query when i'm trying to execute it. such message appears: "Warning: mysql_connect(): Access denied for user 'ODBC'@'localhost' (using password: NO) in z:\home\localhost\www\2.php on line 11 Warning: mysql_select_db(): Access denied for user 'ODBC'@'localhost' (using password: NO) in z:\home\localhost\www\2.php on line 12 Warning: mysql_select_db(): A link to the server could not be established in z:\home\localhost\www\2.php on line 12 Warning: mysql_query(): Access denied for user 'ODBC'@'localhost' (using password: NO) in z:\home\localhost\www\2.php on line 14 Warning: mysql_query(): A link to the server could not be established in z:\home\localhost\www\2.php on line 14 Database Selected: i" what does it' mean? It just means that you are using a wrong username/password combination to connect. Tijnema -- Best regards, Pavelmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL
2007. 03. 20, kedd keltezéssel 15.09-kor Pavel Kaznarskiy ezt írta: > Hello ! > I have problem with access in mysql > > it is my code: > > SQL Query Sender > > $host=""; > $user=""; > $password=""; > /* Section that executes query */ > if(@$_GET['form'] == "yes") what do you want with that '@' here? that operator can be used to suppress error messages when calling functions but not when using a variable > { > mysql_connect($host,$user,$password); > mysql_select_db($_POST['database']); > $query = stripSlashes($_POST['query']); you should take care of sql injection, check those $_POST values first! > $result = mysql_query($query); > echo "Database Selected: {$_POST['database']} > Query: $queryResults"; > if($result == 0) if you want to check for errors, you should use if ($result === FALSE) > echo "Error ".mysql_errno().": ".mysql_error(). > ""; > elseif (@mysql_num_rows($result) == 0) > echo("Query completed. No results returned. > "); > else > { > echo " > > "; > for($i = 0;$i < mysql_num_fields($result);$i++) > { > echo "".mysql_field_name($result,$i). > ""; > } > echo " > > "; > for ($i = 0; $i < mysql_num_rows($result); $i++) > { > echo ""; > $row = mysql_fetch_row($result); > for($j = 0;$j { > echo("" . $row[$j] . ""); > } > echo ""; > } > echo " > "; > } //end else > echo " > > putting $_SERVER['PHP_SELF'] here might also be a security risk read this: http://blog.phpdoc.info/archives/13-XSS-Woes.html > > value={$_POST['database']}> > value=\"New Query\"> > value=\"Edit Query\"> > "; > unset($form); > exit(); > } // endif form=yes > /* Section that requests user input of query */ > @$query=stripSlashes($_POST['query']); > if (@$_POST['queryButton'] != "Edit Query") > { > $query = " "; > } > ?> > method="POST"> > > > Type in database name > value= > > > > > Type in SQL query > rows="10"> > > > > value="Submit Query"> > > > > > > when i'm trying to execute it. such message appears: > "Warning: mysql_connect(): Access denied for user 'ODBC'@'localhost' (using > password: NO) in z:\home\localhost\www\2.php on line 11 > > Warning: mysql_select_db(): Access denied for user 'ODBC'@'localhost' (using > password: NO) in z:\home\localhost\www\2.php on line 12 > > Warning: mysql_select_db(): A link to the server could not be established in > z:\home\localhost\www\2.php on line 12 > > Warning: mysql_query(): Access denied for user 'ODBC'@'localhost' (using > password: NO) in z:\home\localhost\www\2.php on line 14 > > Warning: mysql_query(): A link to the server could not be established in > z:\home\localhost\www\2.php on line 14 > Database Selected: i" > > what does it' mean? these errors mean that your mysql user 'ODBC' has no password, while you are providing a password when connecting. it is not recommended to have a user without password, so you should first give him a password with the mysql command "SET PASSWORD" or something greets Zoltán Németh > > -- > Best regards, > Pavelmailto:[EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with MySQL Query
Why are you using NOT LIKE for? NOT LIKE is used when you are doing a part search Try this.. $dbqueryshipping1 = "select * from tempuserpurchase where usersessionid = \"$User_Shopping_Id\" && day = \"1\" && type != \"Meal Plans\""; also from your original query you are closing off the line at day=" which could be a reason for it not completing Hope this helps -- Chris Kay (CK) Eleet Internet Services P: 0415 451 372 F: 02 4620 5076 E: [EMAIL PROTECTED] -Original Message- From: Phillip Blancher [mailto:[EMAIL PROTECTED] Sent: Thursday, 24 July 2003 8:24 AM To: David Nicholson Cc: PHP List Subject: Re: [PHP] Problem with MySQL Query Tried NOT LIKE and that didnt exclude it either. I am trying to exclude only 'Meal Plans' Phil - Original Message - From: "David Nicholson" <[EMAIL PROTECTED]> To: "Phillip Blancher" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, July 23, 2003 6:19 PM Subject: Re: [PHP] Problem with MySQL Query > Hello, > > This is a reply to an e-mail that you wrote on Wed, 23 Jul 2003 at > 22:54, lines prefixed by '>' were originally written by you. > > > > $dbqueryshipping1 = "select * from tempuserpurchase > where > > > (usersessionid="$User_Shopping_Id") and day="1" and > > > type<>'Meal Plans' > > Tryed both methods and it is still not excluding anything matching > > Meal > > Plans > > Is the data you are wanting to exclude exactly 'Meal Plans' (case > sensitive). If not, use: > > type NOT LIKE 'Meal Plans' > > David. > > -- > phpmachine :: The quick and easy to use service providing you with > professionally developed PHP scripts :: http://www.phpmachine.com/ > > Professional Web Development by David Nicholson > http://www.djnicholson.com/ > > QuizSender.com - How well do your friends actually know you? > http://www.quizsender.com/ > (developed entirely in PHP) > > -- > This message has been scanned for viruses and > dangerous content by Ontario Webs MailScanner, and is > believed to be clean. > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL Query
Tried NOT LIKE and that didnt exclude it either. I am trying to exclude only 'Meal Plans' Phil - Original Message - From: "David Nicholson" <[EMAIL PROTECTED]> To: "Phillip Blancher" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, July 23, 2003 6:19 PM Subject: Re: [PHP] Problem with MySQL Query > Hello, > > This is a reply to an e-mail that you wrote on Wed, 23 Jul 2003 at > 22:54, lines prefixed by '>' were originally written by you. > > > > $dbqueryshipping1 = "select * from tempuserpurchase > where > > > (usersessionid="$User_Shopping_Id") and day="1" and > > > type<>'Meal Plans' > > Tryed both methods and it is still not excluding anything matching > > Meal > > Plans > > Is the data you are wanting to exclude exactly 'Meal Plans' (case > sensitive). If not, use: > > type NOT LIKE 'Meal Plans' > > David. > > -- > phpmachine :: The quick and easy to use service providing you with > professionally developed PHP scripts :: http://www.phpmachine.com/ > > Professional Web Development by David Nicholson > http://www.djnicholson.com/ > > QuizSender.com - How well do your friends actually know you? > http://www.quizsender.com/ > (developed entirely in PHP) > > -- > This message has been scanned for viruses and > dangerous content by Ontario Webs MailScanner, and is > believed to be clean. > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL Query
Hello, This is a reply to an e-mail that you wrote on Wed, 23 Jul 2003 at 22:54, lines prefixed by '>' were originally written by you. > > $dbqueryshipping1 = "select * from tempuserpurchase where > > (usersessionid="$User_Shopping_Id") and day="1" and > > type<>'Meal Plans' > Tryed both methods and it is still not excluding anything matching > Meal > Plans Is the data you are wanting to exclude exactly 'Meal Plans' (case sensitive). If not, use: type NOT LIKE 'Meal Plans' David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL Query
> > $dbqueryshipping1 = "select * from tempuserpurchase where > > (usersessionid=\"$User_Shopping_Id\") and day=\"1\" and > > type<>'Meal Plans' > > > > Tryed both methods and it is still not excluding anything matching Meal > Plans Been a short while since I used SQL with my PHP, but try putting NOT instead of <>. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL Query
> > $dbqueryshipping1 = "select * from tempuserpurchase where > (usersessionid=\"$User_Shopping_Id\") and day=\"1\" and > type<>'Meal Plans' > Tryed both methods and it is still not excluding anything matching Meal Plans --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL Query
Hello, This is a reply to an e-mail that you wrote on Wed, 23 Jul 2003 at 22:28, lines prefixed by '>' were originally written by you. > As per your suggestion > $dbqueryshipping1 = "select * from tempuserpurchase where > (usersessionid="$User_Shopping_Id") and day="1" and type!='Meal > Plans' > $resultshipping1 = mysql_db_query($dbname,$dbqueryshipping1); > if(mysql_error()!=""){echo mysql_error();} >$result1 = mysql_num_rows($resultshipping1); > It is still not excluding "Meal Plans" from the listing. Try $dbqueryshipping1 = "select * from tempuserpurchase where (usersessionid=\"$User_Shopping_Id\") and day=\"1\" and type<>'Meal Plans' David -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL Query
As per your suggestion $dbqueryshipping1 = "select * from tempuserpurchase where (usersessionid=\"$User_Shopping_Id\") and day=\"1\" and type!='Meal Plans' "; $resultshipping1 = mysql_db_query($dbname,$dbqueryshipping1); if(mysql_error()!=""){echo mysql_error();} $result1 = mysql_num_rows($resultshipping1); It is still not excluding "Meal Plans" from the listing. > Take out the plus sign... type != 'Meal Plans' > > And using single quotes in your query might make things easier (no > escaping...) > > $dbqueryshipping1 = "select * from tempuserpurchase where > usersessionid='$User_Shopping_Id' and day='1' and type!='Meal Plans'"; > > You don't need quotes around '1' since it's an integer, but MySQL is > forgiving. > > ---John Holmes... > > - Original Message - > From: "Phillip Blancher" <[EMAIL PROTECTED]> > To: "PHP List" <[EMAIL PROTECTED]> > Sent: Wednesday, July 23, 2003 5:08 PM > Subject: [PHP] Problem with MySQL Query > > > Problem with mySQL Query > This is the query I have: > > $dbqueryshipping1 = "select * from tempuserpurchase where > (usersessionid=\"$User_Shopping_Id\") and day=\"1\" and type!=\"Meal+Plans\" > "; > > What I want to do is to select everything from tempuserpurchase that matchs > the user session and the day, so long as type is not "Meal Plans" > > However it is not excluding "Meal Plans" > > Any Suggestions. > > Thanks in advance, > > Phil > > > __ > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > This message has been scanned for viruses and > dangerous content by Ontario Webs MailScanner, and is > believed to be clean. > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL Query
Take out the plus sign... type != 'Meal Plans' And using single quotes in your query might make things easier (no escaping...) $dbqueryshipping1 = "select * from tempuserpurchase where usersessionid='$User_Shopping_Id' and day='1' and type!='Meal Plans'"; You don't need quotes around '1' since it's an integer, but MySQL is forgiving. ---John Holmes... - Original Message - From: "Phillip Blancher" <[EMAIL PROTECTED]> To: "PHP List" <[EMAIL PROTECTED]> Sent: Wednesday, July 23, 2003 5:08 PM Subject: [PHP] Problem with MySQL Query Problem with mySQL Query This is the query I have: $dbqueryshipping1 = "select * from tempuserpurchase where (usersessionid=\"$User_Shopping_Id\") and day=\"1\" and type!=\"Meal+Plans\" "; What I want to do is to select everything from tempuserpurchase that matchs the user session and the day, so long as type is not "Meal Plans" However it is not excluding "Meal Plans" Any Suggestions. Thanks in advance, Phil __ --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with mysql.
yeah i did send it to the right place. everything was configured as it should have been. thats why i dont get this. nothing i try works for this. it's perplexing. -Ryan >>> Tim Burden<[EMAIL PROTECTED]> 03/31/03 05:22PM >>> Right, defaults to /usr/local/ for the source versions of MySQL, in that case, use --with-mysql=/usr/local - Original Message - From: "Jon Haworth" <[EMAIL PROTECTED]> Newsgroups: php.general To: "Ryan Vennell" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, March 31, 2003 5:00 PM Subject: RE: [PHP] problem with mysql. > Hi Ryan, > > > when configuring php i use --with-mysql and it configures just > > fine. i've even added an =/path/to/php after it to no avail. > > Try --with-mysql=/path/to/mysql instead of --with-mysql=/path/to/php. > > Cheers > Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with mysql.
Right, defaults to /usr/local/ for the source versions of MySQL, in that case, use --with-mysql=/usr/local - Original Message - From: "Jon Haworth" <[EMAIL PROTECTED]> Newsgroups: php.general To: "Ryan Vennell" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, March 31, 2003 5:00 PM Subject: RE: [PHP] problem with mysql. > Hi Ryan, > > > when configuring php i use --with-mysql and it configures just > > fine. i've even added an =/path/to/php after it to no avail. > > Try --with-mysql=/path/to/mysql instead of --with-mysql=/path/to/php. > > Cheers > Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problem with mysql.
Sorry about that. i did use /path/to/mysql. i wasnt paying attention when writing my pervious post. -Ryan >>> Jon Haworth<[EMAIL PROTECTED]> 03/31/03 04:00PM >>> Hi Ryan, > when configuring php i use --with-mysql and it configures just > fine. i've even added an =/path/to/php after it to no avail. Try --with-mysql=/path/to/mysql instead of --with-mysql=/path/to/php. Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problem with mysql.
Hi Ryan, > when configuring php i use --with-mysql and it configures just > fine. i've even added an =/path/to/php after it to no avail. Try --with-mysql=/path/to/mysql instead of --with-mysql=/path/to/php. Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with mysql / auto increment fields.. ?
if you check on the FIRST insert (the primary table that holds "master" usernames) to ensure the uname doesn't exist, THEN do the other queries, there shouldn't be a problem. I think the key here is that you're using the username as the unique key, and putting that username in multiple tables... really, you should be taking advantage of mysql's auto-increment on an ID field... therefor the username "brad_is_the_best_2002" is an alias of userid "204"... all your other tables (bb etc) should be using "204" as the id, not "brad_is_the_best_2002"... 1. gives people the chance to change usernames, because the ID is primary, not the username 2. saves HEAPS of space: Consider using 10 character unames everywhere: 1000 users x 10 char uname x 10 BB posts each = 100k of data -- not too bad 5000 users x 10 char uname x 50 BB posts each = 2.5meg of data -- an issue 5000 users x 15 char uname x 50 BB posts each = 3.75meg of data -- an issue Then consider using 4 byte userIDs (like 1042) everywhere: 1000 users x 4 byte uid x 10 BB posts each = 40k of data -- better 5000 users x 4 byte uid x 50 BB posts each = 1 meg of data -- 60% space save 5000 users x 4 byte uid x 50 BB posts each = 1 meg of data -- 74% space save ... and in practice, the first 99 uid's will only be 2 bytes, the next 900 will only be 3 bytes, etc etc. I'm no database expert, but I guess that's the point behind relational databases... the same user can be related to many tables, using just a few bytes of data, rather than a 6-20 character username. So, after your first insert into the primary user table, you would find out what ID you just inserted with mysql_insert_id(), and use THAT to insert into the related tables... Of course, your BB may require a full username, and lots of your other architecture may have to be changed, but I'm just pointing out that it's worth getting this stuff right, because one day you'll copy the same code/structure to another site, and it may attract 100,000 users really quick, and you might end up with a MASSIVE data problem REALLY quick -- it's happened to me :) Justin French on 20/02/03 11:34 AM, Chris McCluskey ([EMAIL PROTECTED]) wrote: > MySql should insert a value into that column when you update if you are using > an auto_increment field. this value will always be unique. period. > > -Chris > > -Original Message- > From: Chad Day [mailto:[EMAIL PROTECTED]] > Sent: Wed 2/19/2003 1:16 PM > To: php general > Cc: > Subject: [PHP] problem with mysql / auto increment fields.. ? > > > > On my website there are a couple places where people can sign up .. > > The querys after the sign up process look like > > $blahblah = query(insert firstname lastname) values (blah blah blah) > $userid = mysql_insert_id($blahblah); > > $insertintoothertable = query(userid, blah blah blah) etc. > > it then uses this userid var to insert them into a variety of other tables > for other things on the site, such as a phpBB account, etc. > > if multiple people are signing up for accounts at different places, is there > the possibility that a duplicate userid could be assigned, or anything like > that? > > Thanks, > Chad > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > 8b°?¨¥S´?w??º? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problem with mysql / auto increment fields.. ?
MySql should insert a value into that column when you update if you are using an auto_increment field. this value will always be unique. period. -Chris -Original Message- From: Chad Day [mailto:[EMAIL PROTECTED]] Sent: Wed 2/19/2003 1:16 PM To: php general Cc: Subject: [PHP] problem with mysql / auto increment fields.. ? On my website there are a couple places where people can sign up .. The querys after the sign up process look like $blahblah = query(insert firstname lastname) values (blah blah blah) $userid = mysql_insert_id($blahblah); $insertintoothertable = query(userid, blah blah blah) etc. it then uses this userid var to insert them into a variety of other tables for other things on the site, such as a phpBB account, etc. if multiple people are signing up for accounts at different places, is there the possibility that a duplicate userid could be assigned, or anything like that? Thanks, Chad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL
Ok. Go to this link... http://www.magidesign.com/movielist.php and select "12 Monkeys" You will see that only picked one actor... It should have pick four mysql> SELECT concat_ws(" ", fname, lname) as actor FROM actormovie WHERE title = "12 Monkeys" ORDER BY lname; +-+ | actor | +-+ | Brad Pitt | | Christopher Plummer | | Madeleine Stowe | | Bruce Willis| +-+ 4 rows in set (0.01 sec) I know that the problem is some where in this statement... $sql = "SELECT concat_ws(' ', fname, lname)as actor FROM actormovie WHERE title = '$title' ORDER by lname"; $result = mysql_query($sql); $actor = ""; while ($myrow = mysql_fetch_array($result)) { $actor = $myrow[actor]; $actor .= "" . $actor . "\n"; } Only thing is I am brain dead and can't see it... Thanks for the help... Chuck On 6/15/02 12:10 AM, "Tyler Longren" <[EMAIL PROTECTED]> wrote: > you need to put your $myrow in a while loop: > > while ($myrow = mysql_fetch_array($result)) { > > $title = $myrow[title]; > $videoid = $myrow[videoid]; > $catergory = $myrow[catergory]; > $appraisal = $myrow[appraisal]; > > // blah blah blah everything else > } > > Tyler Longren > Captain Jack Communications > www.captainjack.com > [EMAIL PROTECTED] > > - Original Message - > From: "Chuck Payne" <[EMAIL PROTECTED]> > To: "PHP General" <[EMAIL PROTECTED]> > Sent: Friday, June 14, 2002 11:03 PM > Subject: [PHP] Problem with MySQL > > > Hi, > > I am working on a movie database I have two database that I am calling from > but the problem I am having when I ask it to go and fetch all the movies > with the same title, it stops and only shows one. > > Here is a basic layout... > > if($videoid) { > > $result = mysql_query("SELECT * FROM library WHERE videoid=$videoid",$db); > > $myrow = mysql_fetch_array($result); > > // The Myrows > > $title = $myrow[title]; > $videoid = $myrow[videoid]; > $catergory = $myrow[catergory]; > $appraisal = $myrow[appraisal]; > > // Some where here it's not working. > > $sql = "SELECT concat_ws(' ', fname, lname)as actor FROM actormovie WHERE > title = '$title' ORDER by lname"; > $result = mysql_query($sql); > print $sql; > > $actor = ""; > while ($myrow = mysql_fetch_array($result)) { > $actor = $myrow[actor]; > $actor .= "" . $actor . "\n"; > > } > > What am I doing wrong? It only show one record and it show more. > > Chuck Payne > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL
you need to put your $myrow in a while loop: while ($myrow = mysql_fetch_array($result)) { $title = $myrow[title]; $videoid = $myrow[videoid]; $catergory = $myrow[catergory]; $appraisal = $myrow[appraisal]; // blah blah blah everything else } Tyler Longren Captain Jack Communications www.captainjack.com [EMAIL PROTECTED] - Original Message - From: "Chuck Payne" <[EMAIL PROTECTED]> To: "PHP General" <[EMAIL PROTECTED]> Sent: Friday, June 14, 2002 11:03 PM Subject: [PHP] Problem with MySQL Hi, I am working on a movie database I have two database that I am calling from but the problem I am having when I ask it to go and fetch all the movies with the same title, it stops and only shows one. Here is a basic layout... if($videoid) { $result = mysql_query("SELECT * FROM library WHERE videoid=$videoid",$db); $myrow = mysql_fetch_array($result); // The Myrows $title = $myrow[title]; $videoid = $myrow[videoid]; $catergory = $myrow[catergory]; $appraisal = $myrow[appraisal]; // Some where here it's not working. $sql = "SELECT concat_ws(' ', fname, lname)as actor FROM actormovie WHERE title = '$title' ORDER by lname"; $result = mysql_query($sql); print $sql; $actor = ""; while ($myrow = mysql_fetch_array($result)) { $actor = $myrow[actor]; $actor .= "" . $actor . "\n"; } What am I doing wrong? It only show one record and it show more. Chuck Payne -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with mysql
On Thursday 11 April 2002 20:40, Roman Duriancik wrote: > Please send me info : how to set path for *.pid file and ho to set path > where will be mysql.sock in mysql database on linux ? > i want : mysql.sock and localhost.pid in directory /var/lib/mysql > > i install mysql with this command... > > ./configure --localstatedir=/var/lib/mysql --bindir=/usr/bin > --libdir=/usr/l ib/ --libexecdir=/usr/libexec --includedir-/usr/include Please ask on the MySQL list as this has nothing to do with PHP. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* They collapsed ... like nuns in the street ... they had no teen appeal! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL String limits?
On Fri, 22 Jun 2001 19:52, Null wrote: > In a script I have an update query adding on to a LONGTEXT field in my > database. Strangely it will no longer work after seemingly random > string lengths. So far, one row stopped adding at 440 bytes and another > at 1049 bytes. > > mysql_query("UPDATE dod_news SET Comments='$comments', > NumComments=NumComments+1 WHERE Num = $Num"); > > Num is correct, but strangely it doesn't do ANY of the query when this > occurs. I have no idea why it started doing this but any help would be > appreciated. Content-Type: text/html; charset="iso-8859-1"; name="Attachment: 1" Content-Transfer-Encoding: quoted-printable Content-Description: Echh, Outhouse does odd things :-) Try adding echo mysql_error() after you call the query and see what sort of error is returned. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA "My stereo's half-fixed," said Tom monotonously.