[PHP] Re: [PHP-WIN] Re: [PHP] Problem outputting MySQL Date field
At the beginning of the code add following lines error_reporting(E_ALL); ini_set('display_error',1); On Sat, Aug 29, 2009 at 8:28 AM, Keith Davis keithda...@pridedallas.comwrote: But how are you getting the data from the db? Does $rowqry represent a call using the mysql_fetch_array() function? Sent from my magic iPhone, Keith Davis 214-906-5183 On Aug 28, 2009, at 7:39 PM, John Meyer johnme...@pueblocomputing.com wrote: Devendra Jadhav wrote: No need to do anything special. It should display date as string. Can you provide little more information or code snippet? $tweettable .= preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', 'a href=$1$1/a',$row[TWEET_TEXT]) . br . Sent at: . $rowqry[TWEET_CREATEDAT]; $tweettable .= brSent Using: . $row[TWEET_CREATEDBY] . /td/tr; And I checked the database. The date is there. -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This message (including any attachments) may contain confidential or otherwise privileged information and is intended only for the individual(s) to which it is addressed. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message or that arise as a result of e-mail transmission. If verification is required please request a hard-copy version from the sender. www.pridedallas.com -- Devendra Jadhav
[PHP] Problem outputting MySQL Date field
Is there anything special I have to do to output a mysql date field as text? When I try to output it nothing appears on the web page. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem outputting MySQL Date field
Devendra Jadhav wrote: No need to do anything special. It should display date as string. Can you provide little more information or code snippet? $tweettable .= preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', 'a href=$1$1/a',$row[TWEET_TEXT]) . br . Sent at: . $rowqry[TWEET_CREATEDAT]; $tweettable .= brSent Using: . $row[TWEET_CREATEDBY] . /td/tr; And I checked the database. The date is there. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem outputting MySQL Date field
John Meyer wrote: Devendra Jadhav wrote: No need to do anything special. It should display date as string. Can you provide little more information or code snippet? $tweettable .= preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', 'a href=$1$1/a',$row[TWEET_TEXT]) . br . Sent at: . $rowqry[TWEET_CREATEDAT]; $tweettable .= brSent Using: . $row[TWEET_CREATEDBY] . /td/tr; And I checked the database. The date is there. Two things jump out. 1. TWEET_CREATEDAT is that suppose to be TWEET_CREATEDATE ?? 2. two variables are accessed from the $row array, but the third is referenced from the $rowqry array. This begs the question: Which is it? $row or $rowqry ? Try this $tweettable .= preg_replace( '@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', 'a href=$1$1/a', $row[TWEET_TEXT]); $tweettable .= 'br /Sent at: ' . $row[TWEET_CREATEDATE]; $tweettable .= 'br /Sent Using: {$row['TWEET_CREATEDBY']}/td/tr; -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-WIN] Re: [PHP] Problem outputting MySQL Date field
But how are you getting the data from the db? Does $rowqry represent a call using the mysql_fetch_array() function? Sent from my magic iPhone, Keith Davis 214-906-5183 On Aug 28, 2009, at 7:39 PM, John Meyer johnme...@pueblocomputing.com wrote: Devendra Jadhav wrote: No need to do anything special. It should display date as string. Can you provide little more information or code snippet? $tweettable .= preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.] *(\?\S+)?)?)?)@', 'a href=$1$1/a',$row[TWEET_TEXT]) . br . Sent at: . $rowqry[TWEET_CREATEDAT]; $tweettable .= brSent Using: . $row[TWEET_CREATEDBY] . /td/tr; And I checked the database. The date is there. -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This message (including any attachments) may contain confidential or otherwise privileged information and is intended only for the individual(s) to which it is addressed. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message or that arise as a result of e-mail transmission. If verification is required please request a hard-copy version from the sender. www.pridedallas.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-WIN] Re: [PHP] Problem outputting MySQL Date field
Keith Davis wrote: But how are you getting the data from the db? Does $rowqry represent a call using the mysql_fetch_array() function? mysql_fetch_assoc() -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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: ?php echo no @ --, $HTTP_GET_VARS['bogus'], br /\n; echo with @ --, @$HTTP_GET_VARS['bogus'], br /\n; ? Result: no @ -- Warning: Undefined index: bogus in c:\www-lco\scripts_etc\lco\php\test.php on line 18 with @ -- Also: ?php $a = 123; echo no @ --, $a/0, br /\n; echo with @ --, @($a/0), br /\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? ?php @ ? 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 ! ?php ! ? 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
[PHP] Problem with MySQL
Hello ! I have problem with access in mysql it is my code: html headtitleSQL Query Sender/title/head body ?php $host=; $user=; $password=; /* Section that executes query */ if(@$_GET['form'] == yes) { mysql_connect($host,$user,$password); mysql_select_db($_POST['database']); $query = stripSlashes($_POST['query']); $result = mysql_query($query); echo Database Selected: b{$_POST['database']}/bbr Query: b$query/bh3Results/h3hr; if($result == 0) echo bError .mysql_errno().: .mysql_error(). /b; elseif (@mysql_num_rows($result) == 0) echo(bQuery completed. No results returned. /bbr); else { echo table border='1' thead tr; for($i = 0;$i mysql_num_fields($result);$i++) { echo th.mysql_field_name($result,$i). /th; } echo /tr /thead tbody; for ($i = 0; $i mysql_num_rows($result); $i++) { echo tr; $row = mysql_fetch_row($result); for($j = 0;$jmysql_num_fields($result);$j++) { echo(td . $row[$j] . /td); } echo /tr; } echo /tbody /table; } //end else echo hrbr form action=\{$_SERVER['PHP_SELF']}\ method=\POST\ input type='hidden' name='query' value='$query' input type='hidden' name='database' value={$_POST['database']} input type='submit' name=\queryButton\ value=\New Query\ input type='submit' name=\queryButton\ value=\Edit Query\ /form; unset($form); exit(); } // endif form=yes /* Section that requests user input of query */ @$query=stripSlashes($_POST['query']); if (@$_POST['queryButton'] != Edit Query) { $query = ; } ? form action=?php echo $_SERVER['PHP_SELF'] ??form=yes method=POST table tr td align=rightbType in database name/b/td tdinput type=text name=database value=?php echo @$_POST['database'] ? /td /tr tr td align=right valign=top bType in SQL query/b/td tdtextarea name=query cols=60 rows=10?php echo $query ?/textarea /td /tr tr td colspan=2 align=centerinput type=submit value=Submit Query/td /tr /table /form /body/html 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? -- 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
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: html headtitleSQL Query Sender/title/head body ?php $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: b{$_POST['database']}/bbr Query: b$query/bh3Results/h3hr; if($result == 0) if you want to check for errors, you should use if ($result === FALSE) echo bError .mysql_errno().: .mysql_error(). /b; elseif (@mysql_num_rows($result) == 0) echo(bQuery completed. No results returned. /bbr); else { echo table border='1' thead tr; for($i = 0;$i mysql_num_fields($result);$i++) { echo th.mysql_field_name($result,$i). /th; } echo /tr /thead tbody; for ($i = 0; $i mysql_num_rows($result); $i++) { echo tr; $row = mysql_fetch_row($result); for($j = 0;$jmysql_num_fields($result);$j++) { echo(td . $row[$j] . /td); } echo /tr; } echo /tbody /table; } //end else echo hrbr form action=\{$_SERVER['PHP_SELF']}\ method=\POST\ putting $_SERVER['PHP_SELF'] here might also be a security risk read this: http://blog.phpdoc.info/archives/13-XSS-Woes.html input type='hidden' name='query' value='$query' input type='hidden' name='database' value={$_POST['database']} input type='submit' name=\queryButton\ value=\New Query\ input type='submit' name=\queryButton\ value=\Edit Query\ /form; unset($form); exit(); } // endif form=yes /* Section that requests user input of query */ @$query=stripSlashes($_POST['query']); if (@$_POST['queryButton'] != Edit Query) { $query = ; } ? form action=?php echo $_SERVER['PHP_SELF'] ??form=yes method=POST table tr td align=rightbType in database name/b/td tdinput type=text name=database value=?php echo @$_POST['database'] ? /td /tr tr td align=right valign=top bType in SQL query/b/td tdtextarea name=query cols=60 rows=10?php echo $query ?/textarea /td /tr tr td colspan=2 align=centerinput type=submit value=Submit Query/td /tr /table /form /body/html 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
On 3/20/07, Pavel Kaznarskiy [EMAIL PROTECTED] wrote: Hello ! I have problem with access in mysql it is my code: html headtitleSQL Query Sender/title/head body ?php $host=; $user=; $password=; /* Section that executes query */ if(@$_GET['form'] == yes) { mysql_connect($host,$user,$password); mysql_select_db($_POST['database']); $query = stripSlashes($_POST['query']); $result = mysql_query($query); echo Database Selected: b{$_POST['database']}/bbr Query: b$query/bh3Results/h3hr; if($result == 0) echo bError .mysql_errno().: .mysql_error(). /b; elseif (@mysql_num_rows($result) == 0) echo(bQuery completed. No results returned. /bbr); else { echo table border='1' thead tr; for($i = 0;$i mysql_num_fields($result);$i++) { echo th.mysql_field_name($result,$i). /th; } echo /tr /thead tbody; for ($i = 0; $i mysql_num_rows($result); $i++) { echo tr; $row = mysql_fetch_row($result); for($j = 0;$jmysql_num_fields($result);$j++) { echo(td . $row[$j] . /td); } echo /tr; } echo /tbody /table; } //end else echo hrbr form action=\{$_SERVER['PHP_SELF']}\ method=\POST\ input type='hidden' name='query' value='$query' input type='hidden' name='database' value={$_POST['database']} input type='submit' name=\queryButton\ value=\New Query\ input type='submit' name=\queryButton\ value=\Edit Query\ /form; unset($form); exit(); } // endif form=yes /* Section that requests user input of query */ @$query=stripSlashes($_POST['query']); if (@$_POST['queryButton'] != Edit Query) { $query = ; } ? form action=?php echo $_SERVER['PHP_SELF'] ??form=yes method=POST table tr td align=rightbType in database name/b/td tdinput type=text name=database value=?php echo @$_POST['database'] ? /td /tr tr td align=right valign=top bType in SQL query/b/td tdtextarea name=query cols=60 rows=10?php echo $query ?/textarea /td /tr tr td colspan=2 align=centerinput type=submit value=Submit Query/td /tr /table /form /body/html 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
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
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
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: html headtitleSQL Query Sender/title/head body ?php $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: ?php echo no @ --, $HTTP_GET_VARS['bogus'], br /\n; echo with @ --, @$HTTP_GET_VARS['bogus'], br /\n; ? Result: no @ -- Warning: Undefined index: bogus in c:\www-lco\scripts_etc\lco\php\test.php on line 18 with @ -- Also: ?php $a = 123; echo no @ --, $a/0, br /\n; echo with @ --, @($a/0), br /\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
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: html headtitleSQL Query Sender/title/head body ?php $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: ?php echo no @ --, $HTTP_GET_VARS['bogus'], br /\n; echo with @ --, @$HTTP_GET_VARS['bogus'], br /\n; ? Result: no @ -- Warning: Undefined index: bogus in c:\www-lco\scripts_etc\lco\php\test.php on line 18 with @ -- Also: ?php $a = 123; echo no @ --, $a/0, br /\n; echo with @ --, @($a/0), br /\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 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: ?php echo no @ --, $HTTP_GET_VARS['bogus'], br /\n; echo with @ --, @$HTTP_GET_VARS['bogus'], br /\n; ? Result: no @ -- Warning: Undefined index: bogus in c:\www-lco\scripts_etc\lco\php\test.php on line 18 with @ -- Also: ?php $a = 123; echo no @ --, $a/0, br /\n; echo with @ --, @($a/0), br /\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? ?php @ ? 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
[PHP] Problem with MySQL
Hello, Im fairly new to PHP and I am running an Apache web server on my computer, set up as localhost, and i recently installed MySQL 4.1 . I am having trouble making a DB and a table in the DB. when i try to create it from a command prompt it tells me this: C:\mysql\binmysqld-opt C:\mysql\binmysqladmin create userDB mysqladmin: connect to server at 'localhost; failed error: 'Can't connect to MySQL server on 'localhost' (10061)' Check that mysqld is running on localhost and that the port is 3306. You can check this by doing 'telnet localhost 3306' and when I try to connect using Telnet it gives me this error Microsoft Telnet open localhost 3306 Connecting to localhost...Could not open connection to the host, on port 3306: Connection failed And when i run services.msc it shows that mysql is running, so i dont know what the problem is. Anyone have any ideas? ~Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[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
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 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
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
$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
$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
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
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
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
[PHP] Problem with mysql versions. help
Hello, I wrote the code for deleting the oldest string in the mysql if it reaches over 15 strings, but it works only under 4.x.x series of MySQL and i have 3.x.x. What should I change in the code that it would work under 3.x.x version of MySQL? Here`s the code: $quer = SELECT COUNT(id) FROM logai; $rez = mysql_query($quer); $sk = mysql_result($rez,0); if ( $sk 15 ) { $wad = $sk - 15; $queryz = DELETE FROM logai WHERE id 'a nu nakuj' ORDER BY id LIMIT $wad; mysql_query($queryz); }*/ Thank You. Sorry for my bad english :-( -- 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
[PHP] problem with mysql.
ok i've reinstalled phpseveral times now, reinstalled mysql, and even reinstalled apache once but i am still getting this same problem. 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. i keep getting this on pages that use MYSQL: PHP ERROR: PHP build incomplete: the prerequisite MySQL support required to read the alert database was not built into PHP. Please recompile PHP with the necessary library (--with-mysql) anyone else had this problem and found a fix? (also, i've rebooted the server and restarted httpd and that didnt start it working.) -- 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.
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.
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
[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 / 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 / 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
[PHP] PHP Problem or MySQL (Match ... against)?
I'm stuck. I have been to the MySQL lists for this. Now I'm reconsidering my PHP code. http://ccl.flsh.usherb.ca/print/display.table.inc.phps I just don't know where I'm going wrong anymore. If I run this SQL in PHPMyAdmin, it works. jdaxell.ccl should have one entry for ready maria. SELECT id,AU,ST,BT,AT FROM jdaxell.ccl WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('ready maria' IN BOOLEAN MODE) ORDER BY id asc When I run the same (copied and pasted) SQL in PHP, it is as though MySQL is doing a boolean search for `+ready +maria` without the double quotes and finding results in every database. if you search for ready maria it should only find one entry. http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bready+maria%26quot%3B So what have I done wrong now :( John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Problem or MySQL (Match ... against)?
On Mon, 2 Dec 2002, jtjohnston wrote: SELECT id,AU,ST,BT,AT FROM jdaxell.ccl WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('ready maria' IN BOOLEAN MODE) ORDER BY id asc When I run the same (copied and pasted) SQL in PHP, it is as though MySQL is doing a boolean search for `+ready +maria` without the double quotes and finding results in every database. if you search for ready maria it should only find one entry. Escape the double quotes.('\ready maria\' IN BOOLEAN g.luck, ~Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Problem or MySQL (Match ... against)?
Chris, or anyone, I have tried to escape the slashes. Debugging ... $sql = 'SELECT ... ... AGAINST (\'ready maria\' IN BOOLEAN MODE) ...'; This works. But if I addslashes or stripslashes, or do nothing, it does not work. See these 3 variations. Neither work. What should I do? A part from hang myself :) $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\''.addslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc'; $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\''.stripslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc'; $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\''.$search.'\' IN BOOLEAN MODE) ORDER BY id asc'; John SELECT id,AU,ST,BT,AT FROM jdaxell.ccl WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('ready maria' IN BOOLEAN MODE) ORDER BY id asc When I run the same (copied and pasted) SQL in PHP, it is as though MySQL is doing a boolean search for `+ready +maria` without the double quotes and finding results in every database. if you search for ready maria it should only find one entry. Escape the double quotes.('\ready maria\' IN BOOLEAN g.luck, ~Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[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 .= A HREF='' . $actor . /ABR\n; } What am I doing wrong? It only show one record and it show more. Chuck Payne
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 .= A HREF='' . $actor . /ABR\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
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 .= A HREF='' . $actor . /ABR\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 .= A HREF='' . $actor . /ABR\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
[PHP] problem with mysql persistent connections; already read the FAQ!
We are running Apache 1.3.20 with PHP 4.0.6/rfc1876-patch built as a module. We are using PHP on a load-sharing cluster with n web servers. Our cluster supports an application that makes extensive use of mysql connections via the PHP mysql_* functions. The application was tested on a single web server, and the programmers are trying to use persistent connections to increase efficiency. First, I want to confirm in my own mind whether this will have any real benefit in our situation because we are using a cluster environment, correct? Second, the programmers are using mysql_connect() and not mysql_pconnect(). Does that mean they are in fact not using persistent connections? (BTW, we do have persistent connections turned on in php.ini.) Finally, the programmers showed me how they see that persistent connections are in fact working. On the development server they are doing the following: mysql_open() mysql_query() ... mysql_close() mysql_query() On their server the second mysql_query() works! (They are using Apache 1.3.20 as well, but I was told they may have compiled PHP into Apache rather than as a module, and I'm not exactly sure of the version, but I'm pretty sure it is 4.0.6.) But on the cluster the second mysql_query() returns: Warning: 1 is not a valid MySQL-Link resource in /some/path/pers.php on line 11 could not execute 'select zipcod from zip' Should this be working on our cluster? If not, what do we need to do. Can this work? Will persistent connections even be effective in a cluster environment? I did read the alt.comp.lang.php FAQ, but it didn't actually address this issue. Any help or information is appreciated! Regards, Dustin --- Dustin Puryear [EMAIL PROTECTED] Information Systems Contractor http://members.telocity.com/~dpuryear PGP Key available at http://www.us.pgp.net In the beginning the Universe was created. This has been widely regarded as a bad move. - Douglas Adams -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem in mysql connection
first, u have to install the mysql. :-) and u have to know your mysql password... maybe you can try this... $connection=mysql_query(localhost,root,); if ($connection) { echo brConnection to mysql Good; } else { echo brConnection to mysql Failed; } hope this can help u.. Rio Uniwaly www.prio.mysite.de - Original Message - From: Uma Shankari T. [EMAIL PROTECTED] wrote: Hello, I have installed php4 rpm in my machine.while connecting php with mysql it is giving fatal error.I have given like this mysql_connect($servername,$username,$password); Why it is so .. Is there any other files i have to install to access the database?? Regards, Uma _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Problem in mysql connection
Hello, I have installed php4 rpm in my machine.while connecting php with mysql it is giving fatal error.I have given like this mysql_connect($servername,$username,$password); Why it is so .. Is there any other files i have to install to access the database?? Regards, Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Problem in mysql connection
What was the error message given? Are you sure that mysql is running and working properly? Jeff Hello, I have installed php4 rpm in my machine.while connecting php with mysql it is giving fatal error.I have given like this mysql_connect($servername,$username,$password); Why it is so .. Is there any other files i have to install to access the database?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Problem in mysql connection
Hello, I have installed php4 rpm in my machine.while connecting php with mysql it is giving fatal error.I have given like this mysql_connect($servername,$username,$password); Why it is so .. Is there any other files i have to install to access the database?? Regards, Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] 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.
[PHP] Problem with MySQL String limits?
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.