Re: [PHP-DB] Help with If else if
On Tue, 13 Mar 2012 21:23:57 +0530, Gu®u sent: No Michael, your code is also not working. What you have understood is correct. let me explain it to others too. If variable twitter and facebook are empty don't echo anything, if variable twitter has a value and facebook is empty echo out only twitter, if variable twitter has no value and facebook has a value echo out facebook only, and finally if both has values echo out both. Basically I want to echo out only if there is some value in the database. But in my case both the images are echoing out. For probably the bazillionth time, PUT REPLIES ON THE BOTTOM On Tue, Mar 13, 2012 at 8:54 PM, Michael Stowe wrote: From looking at your code, the issue is that your if statements are checking for the same criteria as your else statements, meaning that if the string is empty ("") the if statements will be triggered, and since the if statements are true, the elseif statement will not be. Or if the string isn't empty, neither the if or the elseif statements will be triggered, causing the else statement to be activated. Either way, the images would be printed out. * * * * *Did you mean to do this?* plugin->ListViewValue() == "" && $search->facebook->ListViewValue() == "") { // Neither one has a value } elseif ($search->plugin->ListViewValue() != "" && $search->facebook->ListViewValue() != "") { // Both have a Value echo '' . ''; } elseif ($search->plugin->ListViewValue() != "") { // Twitter has a value } else { // Facebook has a value (only possible option left) echo ''; } ?> Hope that helps, Mike On Tue, Mar 13, 2012 at 9:44 AM, Matijn Woudt wrote: On Tue, Mar 13, 2012 at 3:06 PM, Gu®u wrote: > The issue is both the images are echoing and no if else statement is > working. > First of all, please bottom post on this (and probably any) mailing list. You should perhaps provide what the contents of $search->plugin->ListViewValue()=="" and $search->facebook->ListViewValue()=="" is. Though, if I understood you correctly, it would be as simple as: $facebookEnabled = $search->facebook->ListViewValue()!=""; $twitterEnabled = $search->plugin->ListViewValue()!=""; if($facebookEnabled) { echo ''; } if($twitterEnabled) { echo ''; } - Matijn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- --- "My command is this: Love each other as I have loved you." John 15:12 --- -- *Best, * *Gu®u* Recapitulating your pseudocode above, you don't need anything so complex: if twitter is set: emit twitter image if facebook is set: emit facebook image The two seem completely independent of each other. Thus: plugin->ListViewValue(); if (!empty($twitter)) { echo 'width="22" height="23"/>'; } $fb = $search->facebook->ListViewValue(); if (!empty($fb)) { echo 'height="23"/>'; } ?> The above will give a twitter image+link if the twitter link is set, and a facebook image+link if facebook is set. You don't need to do anything special if both are set, or if neither is set, as they are completely independent of each other. -- Tamara Temple aka tamouse__ May you never see a stranger's face in the mirror -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with If else if
On Tue, 13 Mar 2012 17:33:43 +0530, Gu®u sent: Hi, Please help me with this code. I have 2 different fields in mysql table. What I want is if the field is empty don't show the image. Please look at the code below. plugin->ListViewValue()=="") { echo ''; } if($search->facebook->ListViewValue()=="") { echo ''; } else if($search->plugin->ListViewValue()=="" && $search->facebook->ListViewValue()=="") { echo ""; } else { echo ''.''; } ?> -- *Best, * *Gu®u* I think we really need to see a lot more than this before we can help. What is the output that is generated? What is $search and how is it set prior to entering this bit of code? As it stands, I can see no reference to MySQL tables in this, nor any idea what values you're expecting and not seeing. If you don't already, please set error_reporting to the most detailed, and turn on display_errors in your output. Before each of the if's echo a var_dump of the values you're testing so we can see their exact values. -- Tamara Temple aka tamouse__ May you never see a stranger's face in the mirror -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with If else if
I tried the below code too considering may be the localhost is really dumb and we need to tell each and every condition. But still its not working :( $tweet = $search->plugin->ListViewValue(); $fb = $search->facebook->ListViewValue(); if($tweet=="" && $fb=="") { echo ""; } elseif($fb=="" && $tweet!="") { echo ''; } elseif($tweet=="" && $fb!="") { echo ''; } elseif($fb!="" && $tweet!="") { echo ''.''; } On Tue, Mar 13, 2012 at 9:44 PM, Matijn Woudt wrote: > On Tue, Mar 13, 2012 at 4:53 PM, Gu®u wrote: > > No Michael, your code is also not working. What you have understood is > > correct. let me explain it to others too. > > > > If variable twitter and facebook are empty don't echo anything, > > > > if variable twitter has a value and facebook is empty echo out only > twitter, > > > > if variable twitter has no value and facebook has a value echo out > facebook > > only, > > > > and finally if both has values echo out both. > > > > Basically I want to echo out only if there is some value in the database. > > But in my case both the images are echoing out. > > > > That's exactly what my code does too, except it's a bit simpler. If > mine isn't working too, then your input is probably different, try a > var_dump on the ListViewValue() items. > > - Matijn > -- *Best, * *Gu®u*
Re: [PHP-DB] Help with If else if
On Tue, Mar 13, 2012 at 4:53 PM, Gu®u wrote: > No Michael, your code is also not working. What you have understood is > correct. let me explain it to others too. > > If variable twitter and facebook are empty don't echo anything, > > if variable twitter has a value and facebook is empty echo out only twitter, > > if variable twitter has no value and facebook has a value echo out facebook > only, > > and finally if both has values echo out both. > > Basically I want to echo out only if there is some value in the database. > But in my case both the images are echoing out. > That's exactly what my code does too, except it's a bit simpler. If mine isn't working too, then your input is probably different, try a var_dump on the ListViewValue() items. - Matijn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with If else if
Hmm, what happens with the code I sent you? Just tested it on my end and worked exactly as expected. Try doing a var_dump($search->plugin->ListViewValue(), $search->facebook->ListViewValue()); to make sure the data being returned is what's expected... you should be getting string(0) "" returned for both. Thanks, Mike On Tue, Mar 13, 2012 at 10:53 AM, Gu®u wrote: > No Michael, your code is also not working. What you have understood is > correct. let me explain it to others too. > > If variable twitter and facebook are empty don't echo anything, > > if variable twitter has a value and facebook is empty echo out only > twitter, > > if variable twitter has no value and facebook has a value echo out > facebook only, > > and finally if both has values echo out both. > > Basically I want to echo out only if there is some value in the database. > But in my case both the images are echoing out. > > > > > On Tue, Mar 13, 2012 at 8:54 PM, Michael Stowe wrote: > >> From looking at your code, the issue is that your if statements are >> checking for the same criteria as your else statements, meaning that if the >> string is empty ("") the if statements will be triggered, and since the if >> statements are true, the elseif statement will not be. Or if the string >> isn't empty, neither the if or the elseif statements will be triggered, >> causing the else statement to be activated. Either way, the images would >> be printed out. * >> * >> * >> * >> *Did you mean to do this?* >> >> > if($search->plugin->ListViewValue() == "" && >> $search->facebook->ListViewValue() == "") { >> // Neither one has a value >> } elseif ($search->plugin->ListViewValue() != "" && >> $search->facebook->ListViewValue() != "") { >> // Both have a Value >> echo '> src="images/twitter.gif" width="22" height="23"/>' . '> href="' . $search->facebook->ListViewValue() . '">> src="images/facebook.gif" width="22" height="23"/>'; >> } elseif ($search->plugin->ListViewValue() != "") { >> // Twitter has a value >> echo '> src="images/twitter.gif" width="22" height="23"/>'; >> } else { >> // Facebook has a value (only possible option left) >> echo '> src="images/facebook.gif" width="22" height="23"/>'; >> } >> ?> >> >> >> >> Hope that helps, >> Mike >> >> >> >> On Tue, Mar 13, 2012 at 9:44 AM, Matijn Woudt wrote: >> >>> On Tue, Mar 13, 2012 at 3:06 PM, Gu®u wrote: >>> > The issue is both the images are echoing and no if else statement is >>> > working. >>> > >>> >>> First of all, please bottom post on this (and probably any) mailing list. >>> >>> You should perhaps provide what the contents of >>> $search->plugin->ListViewValue()=="" and >>> $search->facebook->ListViewValue()=="" is. >>> Though, if I understood you correctly, it would be as simple as: >>> $facebookEnabled = $search->facebook->ListViewValue()!=""; >>> $twitterEnabled = $search->plugin->ListViewValue()!=""; >>> if($facebookEnabled) >>> { >>> >>> echo '>> src="images/facebook.gif" width="22" height="23"/>'; >>> } >>> if($twitterEnabled) >>> { >>> >>> echo '>> src="images/twitter.gif" width="22" height="23"/>'; >>> } >>> >>> - Matijn >>> >>> -- >>> PHP Database Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >> >> >> -- >> --- >> >> "My command is this: Love each other as I >> have loved you." John 15:12 >> >> --- >> > > > > -- > *Best, > * > *Gu®u* > > -- --- "My command is this: Love each other as I have loved you." John 15:12 ---
Re: [PHP-DB] Help with If else if
No Michael, your code is also not working. What you have understood is correct. let me explain it to others too. If variable twitter and facebook are empty don't echo anything, if variable twitter has a value and facebook is empty echo out only twitter, if variable twitter has no value and facebook has a value echo out facebook only, and finally if both has values echo out both. Basically I want to echo out only if there is some value in the database. But in my case both the images are echoing out. On Tue, Mar 13, 2012 at 8:54 PM, Michael Stowe wrote: > From looking at your code, the issue is that your if statements are > checking for the same criteria as your else statements, meaning that if the > string is empty ("") the if statements will be triggered, and since the if > statements are true, the elseif statement will not be. Or if the string > isn't empty, neither the if or the elseif statements will be triggered, > causing the else statement to be activated. Either way, the images would > be printed out. * > * > * > * > *Did you mean to do this?* > > if($search->plugin->ListViewValue() == "" && > $search->facebook->ListViewValue() == "") { > // Neither one has a value > } elseif ($search->plugin->ListViewValue() != "" && > $search->facebook->ListViewValue() != "") { > // Both have a Value > echo ' src="images/twitter.gif" width="22" height="23"/>' . ' href="' . $search->facebook->ListViewValue() . '"> src="images/facebook.gif" width="22" height="23"/>'; > } elseif ($search->plugin->ListViewValue() != "") { > // Twitter has a value > echo ' src="images/twitter.gif" width="22" height="23"/>'; > } else { > // Facebook has a value (only possible option left) > echo ' src="images/facebook.gif" width="22" height="23"/>'; > } > ?> > > > > Hope that helps, > Mike > > > > On Tue, Mar 13, 2012 at 9:44 AM, Matijn Woudt wrote: > >> On Tue, Mar 13, 2012 at 3:06 PM, Gu®u wrote: >> > The issue is both the images are echoing and no if else statement is >> > working. >> > >> >> First of all, please bottom post on this (and probably any) mailing list. >> >> You should perhaps provide what the contents of >> $search->plugin->ListViewValue()=="" and >> $search->facebook->ListViewValue()=="" is. >> Though, if I understood you correctly, it would be as simple as: >> $facebookEnabled = $search->facebook->ListViewValue()!=""; >> $twitterEnabled = $search->plugin->ListViewValue()!=""; >> if($facebookEnabled) >> { >> >> echo '> src="images/facebook.gif" width="22" height="23"/>'; >> } >> if($twitterEnabled) >> { >> >> echo '> src="images/twitter.gif" width="22" height="23"/>'; >> } >> >> - Matijn >> >> -- >> PHP Database Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > > -- > --- > > "My command is this: Love each other as I > have loved you." John 15:12 > > --- > -- *Best, * *Gu®u*
Re: [PHP-DB] Help with If else if
>From looking at your code, the issue is that your if statements are checking for the same criteria as your else statements, meaning that if the string is empty ("") the if statements will be triggered, and since the if statements are true, the elseif statement will not be. Or if the string isn't empty, neither the if or the elseif statements will be triggered, causing the else statement to be activated. Either way, the images would be printed out. * * * * *Did you mean to do this?* plugin->ListViewValue() == "" && $search->facebook->ListViewValue() == "") { // Neither one has a value } elseif ($search->plugin->ListViewValue() != "" && $search->facebook->ListViewValue() != "") { // Both have a Value echo '' . ''; } elseif ($search->plugin->ListViewValue() != "") { // Twitter has a value echo ''; } else { // Facebook has a value (only possible option left) echo ''; } ?> Hope that helps, Mike On Tue, Mar 13, 2012 at 9:44 AM, Matijn Woudt wrote: > On Tue, Mar 13, 2012 at 3:06 PM, Gu®u wrote: > > The issue is both the images are echoing and no if else statement is > > working. > > > > First of all, please bottom post on this (and probably any) mailing list. > > You should perhaps provide what the contents of > $search->plugin->ListViewValue()=="" and > $search->facebook->ListViewValue()=="" is. > Though, if I understood you correctly, it would be as simple as: > $facebookEnabled = $search->facebook->ListViewValue()!=""; > $twitterEnabled = $search->plugin->ListViewValue()!=""; > if($facebookEnabled) > { > > echo ' src="images/facebook.gif" width="22" height="23"/>'; > } > if($twitterEnabled) > { > > echo ' src="images/twitter.gif" width="22" height="23"/>'; > } > > - Matijn > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- --- "My command is this: Love each other as I have loved you." John 15:12 ---
Re: [PHP-DB] Help with If else if
On Tue, Mar 13, 2012 at 3:06 PM, Gu®u wrote: > The issue is both the images are echoing and no if else statement is > working. > First of all, please bottom post on this (and probably any) mailing list. You should perhaps provide what the contents of $search->plugin->ListViewValue()=="" and $search->facebook->ListViewValue()=="" is. Though, if I understood you correctly, it would be as simple as: $facebookEnabled = $search->facebook->ListViewValue()!=""; $twitterEnabled = $search->plugin->ListViewValue()!=""; if($facebookEnabled) { echo ''; } if($twitterEnabled) { echo ''; } - Matijn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with If else if
The issue is both the images are echoing and no if else statement is working. On Tue, Mar 13, 2012 at 7:22 PM, Matijn Woudt wrote: > On Tue, Mar 13, 2012 at 1:03 PM, Gu®u wrote: > > Hi, > > > > Please help me with this code. I have 2 different fields in mysql table. > > What I want is if the field is empty don't show the image. Please look at > > the code below. > > I have looked at it. > > Maybe you should tell what is wrong, what it outputs currently, and > what it should output. Or perhaps, which errors you get if any? > > - Matijn > -- *Best, * *Gu®u*
Re: [PHP-DB] Help with If else if
On Tue, Mar 13, 2012 at 1:03 PM, Gu®u wrote: > Hi, > > Please help me with this code. I have 2 different fields in mysql table. > What I want is if the field is empty don't show the image. Please look at > the code below. I have looked at it. Maybe you should tell what is wrong, what it outputs currently, and what it should output. Or perhaps, which errors you get if any? - Matijn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with mysql data sorting using php
take a look at this: http://datatables.net/examples/data_sources/server_side.html On Mon, May 17, 2010 at 5:30 PM, nagendra prasad wrote: > Hi Artur, > > I am a beginner to this stuff. So, If you or anyone can give me some > example > codes or may be some links for my reference that would be a great help. > > Best, > Guru. > > On Mon, May 17, 2010 at 12:57 PM, Artur Ejsmont >wrote: > > > Hehe. Then a method: ) just make a query builder method like 'findSongs' > > with all the params ( optional or mandatory ) like page, limit, sortby, > > filters etc. then inside build SQL based on args. Just be careful - SQL > > injection is your enemy here. From app pass all the args from get/ post > and > > that's it. Good luck. > > > > On 17 May 2010 08:18, "nagendra prasad" > wrote: > > > > DB is like more then 500MB > > > > and it will grow day by day :) > > > > > > > > > > > > On Mon, May 17, 2010 at 12:46 PM, Artur Ejsmont > > > wrote: > > > > > > If the DB i... > > > > >
Re: [PHP-DB] Help with mysql data sorting using php
Hi Artur, I am a beginner to this stuff. So, If you or anyone can give me some example codes or may be some links for my reference that would be a great help. Best, Guru. On Mon, May 17, 2010 at 12:57 PM, Artur Ejsmont wrote: > Hehe. Then a method: ) just make a query builder method like 'findSongs' > with all the params ( optional or mandatory ) like page, limit, sortby, > filters etc. then inside build SQL based on args. Just be careful - SQL > injection is your enemy here. From app pass all the args from get/ post and > that's it. Good luck. > > On 17 May 2010 08:18, "nagendra prasad" wrote: > > DB is like more then 500MB > > and it will grow day by day :) > > > > > > On Mon, May 17, 2010 at 12:46 PM, Artur Ejsmont > wrote: > > > > If the DB i... > >
Re: [PHP-DB] Help with mysql data sorting using php
Hehe. Then a method: ) just make a query builder method like 'findSongs' with all the params ( optional or mandatory ) like page, limit, sortby, filters etc. then inside build SQL based on args. Just be careful - SQL injection is your enemy here. From app pass all the args from get/ post and that's it. Good luck. On 17 May 2010 08:18, "nagendra prasad" wrote: DB is like more then 500MB and it will grow day by day :) On Mon, May 17, 2010 at 12:46 PM, Artur Ejsmont wrote: > > If the DB i...
Re: [PHP-DB] Help with mysql data sorting using php
DB is like more then 500MB and it will grow day by day :) On Mon, May 17, 2010 at 12:46 PM, Artur Ejsmont wrote: > If the DB is very small use tablesorter plugin of jquery. Otherwise > custumizable query method. > > On 17 May 2010 07:56, "nagendra prasad" wrote: > > Hi All, > > I have a database of MP3's in mysql. The database contains MP3 name, > artist, > date, size etc. I need to order the search results in both ascending and > descending order. For example if user wants to see the size of all mp3's in > ASC order he will click on size column and again if he wants to see the > MP3's in DEC order he can click on the size column. Suppose the MP3's are > arranged in ASC order and if he clicks on size column the data should > arrange in DEC order. > > Any idea how I should go about it ? > > Please help me :) > > Best, > Guru. > >
Re: [PHP-DB] help in implementing a progress bar
On Jan 7, 2010, at 2:36 PM, Vinay Kannan wrote: > Hello, > > Theres this project that I am working on, and a specific module does take > few secs to process, I am thinking it would be cool to be showing a progress > bar(some kind on a .gif image) while the script runs, does any one have an > idea how to implement this? > > Thanks, > Vinay K This isn't really database related, but ok... "; $text .= "window.location = '$url';"; $text .= ""; echo $text; flush (); } } ?> start(); // ... Do your processing here ... $progress->end('nextpage.php'); ?> In the progress.html file, it would just be an html page that has an animated gif (and whatever else you want on it). Hope this helps. ~Philip -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help for a beginner
Hi > Hi everyone, first thank you for ALL help and the understanding that I am new > to PHP and MySQL. This is a long email and for that I apologize but I am > trying to provide as much detail as possible. If this is the wrong list to > ask for help, kindly direct me to the proper authority. > > I am trying to learn and I have built the following environment. > > Windows Server 2008 Standard 32bit service Pack 2 with IIS7 > mysql-essential-5.1.41-win32 > php-5.3.1-nts-Win32-VC9-x86.msi > phpMyAdmin-3.2.4-english.zip > > > I followed the steps as detailed below (I already had IIS7 and CGI installed) > > > 1. Install CGI & PHP >http://www.trainsignaltraining.com/iis-7-install-fastcgi-php/2008-09-04/ > > 2. Install MySQL >http://www.trainsignaltraining.com/install-mysql-on-iis7/2008-09-10/ > > 3. Install PHPMyAdmin > > http://www.trainsignaltraining.com/install-phpmyadmin-on-iis7-and-server-2008/2008-09-16/ This is a bit vague on details. In particular, when installing PHP did you add the required extensions for MySQL, etc at step 6? Create a test page containing nothing but this: Open the page in your browser and verify that mysql, gd, and mbstring are included. This will verify that: 1) you added them to your php.ini and 2) This is the INI file actually being used by the server and not some random other. > After I completed the installations > 1. If I navigate to the PHP directory and type php -info it spews a ton of > data at me >AND >I created info.php which contains: >When I browse this, it correctly produces a page with all the info about > my PHP server. Although I do not understand much of it I believe this > confirms PHP is working correctly with IIS > > 2. I open the MySQL CLI and perform the commands outlined in Step 23 at this > page >http://www.bicubica.com/apache-php-mysql/index.php >This returns the expected results, confirming MySQL is working > > 3. PHP is configured to work with php_mysql.dll as per the steps in the > trainsignal links above so I begin! > I go to the phpmyadmin page, enter root and my password and after a long time > I get a FastCGI error. I am not ready to believe it because, in classic MS > form, it has several VERY different potential causes, and I have covered all > of those. Plus the error code is 0x which is like saying nothing... I > start thinking maybe it is not connecting to the mYSQL server right, the > instructions re: pma and the password made no sense to me so I fiddle with > that with no change. > > >I write the mysql_test.php page in step 5 of > http://www.bicubica.com/apache-php-mysql/index.php >This fails with: A connection attempt failed because the connected party > did not properly respond after a period of time, or established connection > failed because connected host has failed to respond. > >Because the PHP failed I try with ASP... ><% >set conn=Server.CreateObject("ADODB.Connection") >conn.ConnectionString="Driver={mySQL};Server=localhost;Database=test;User > Id=root;Password=youwish" >conn.open >Response.write("Connected") >conn.close >%> > >This returns: >Microsoft OLE DB Provider for ODBC Drivers error '80004005' >[Microsoft][ODBC Driver Manager] Data source name not found and no > default driver specified >/test.asp, line 4 > > I believe I have established MySQL is working, but for some reason it appears > that it cannot be "reached" This IS on the same server so firewall should not > be an issue, PLUS I confirmed the installer did create a hole. I turn off the > MS firewall to be safe, no change I try a "repair" of MySQL, I uninstall, > reboot and reinstall with no change. > > NOTE: at several points I have tried iisreset and/or rebooting the system > with no change. > > I start to research the matter and my mind is now unglued. I found something > referencing using mcrypt with PHPMyAdmin to speed it up and wondered if maybe > the long delay before the FastCGI error could be resolved so I tracked down > the dll, put it in my ext directory and changed my php.ini to reflect this -- > file found at http://files.edin.dk/php/win32/mcrypt/ > > I found quite a bit about using libmysql.dll but there was no such file in my > install, I pulled down the .zip package and that also did not contain it, I > eventually found it in a 5.2.x archive but that does not seem to have helped. > I have tried enabling: only mysql, mysql AND mysqli, and only mysqli. None of > this seems to have done anything to change my situation. > > Again, I apologize for the lengthy message, I hope I have accurately > described my issue in the right amount of detail. > > Thank You! > Adam Sonzogni > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Niel Archer niel.archer (at) blueyonder.co.uk -- PHP Database Mailing L
Re: [PHP-DB] HELP! PHP 4.4.4 and MySQL 4.1 - Can't find php_mysql.dll
John Burns wrote: I did that but the php_mysql.dll is not in any of the zips from any of the packages I tried downloading. I need to stay in PHP 4 because of some applications. No matter what zip package I downloaded, php_mysql.dll was not in the extensions directory. I tried a bunch of different 4.x releases. I tried downloading the source code and saw the mysql extensions uncompiled but I don't know how to compile. That's why I'm so confused as to why the php_mysql.dll file is not in any of the Windows binary zip packages. Take a look for yourself and see if you can find a zip that has that file in it. If you can, I'd be greatly appreciative. Please always cc the mailing list so others can see your response and offer their suggestions. Maybe ask on the php-windows mailing list, they might have better suggestions (and include what you've already tried). -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] HELP! PHP 4.4.4 and MySQL 4.1 - Can't find php_mysql.dll
John Burns wrote: I'm using Windows 2003, IIS and PHP 4.4.4 with MySQL 4.1. I had this same setup on a server that got corrupted by a virus. I can't use any of the files from the old setup so I'm trying to reinstall the same versions. However, I can't find a php_mysql.dll file that will work. All of the zip packages I download from php.net don't have the php_mysql.dll file in the extensions folder. They have everything else but that. Am I missing something? Please help if you have any idea. The one php_mysql.dll file I did find and dropped in gives me the following error: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=1 PHP compiled with module API=20020429, debug=0, thread-safety=1 These options need to match in Unknown on line 0 As you found out, you can't do that - they need to come from the same release. Try here: http://www.php.net/releases/ Grab the 4.4.4 windows zipfile and that should have all of the extensions you need. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with Web services (facebook, myspace)
Abah Joseph wrote: > I just saw something on pear.net > http://pear.php.net/package/Services_Facebookmaybe it will work. hi, possible better is to have a look into the plattform http://www.phpclasses.org. Maybe you find a class that doesn't based on pear. Regards, Ruprecht Ruprecht Helms IT-Service & Softwaredevelopment allow your worktools be individual Web: http://www.rheyn.de -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with Web services (facebook, myspace)
I just saw something on pear.net http://pear.php.net/package/Services_Facebookmaybe it will work. On Wed, Jan 21, 2009 at 10:27 PM, Chris wrote: > Abah Joseph wrote: > >> Hello PHP people, >> I`m looking for facebook and myspace API that will enable user to login on >> my site using their facebook and myspace id. if this is not possible, can >> i >> find something closer like, user will be able to perform >> some activities from my site like inviting facebook/myspace friends, send >> IVs etc. >> > > http://developers.facebook.com/?ref=pf > > I don't know if myspace has a developer area but ask in their forum: > > http://forums.myspace.com/?fuseaction=forums.home > > -- > Postgresql & php tutorials > http://www.designmagick.com/ > > -- I develop dynamic website with PHP & MySql, Let me know about your site
Re: [PHP-DB] Help with Web services (facebook, myspace)
Abah Joseph wrote: Hello PHP people, I`m looking for facebook and myspace API that will enable user to login on my site using their facebook and myspace id. if this is not possible, can i find something closer like, user will be able to perform some activities from my site like inviting facebook/myspace friends, send IVs etc. http://developers.facebook.com/?ref=pf I don't know if myspace has a developer area but ask in their forum: http://forums.myspace.com/?fuseaction=forums.home -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help me JOIN 3 tables. - fixed query
Oops, actually forgot my GROUP BY clause. The full query is: SELECT e1.field1, e1.field2, l1.field3, SUM(a1.adp_amount) as amount FROM a1 inner join e1 on (e1.loanID = a1.adp_loanID) inner join l1 on (l1.entreID = e1.entre_ID) WHERE e1.entre_active = 'Y' GROUP BY e1.field1, e1.field2, l1.field3 hth, Yves - Original Message - From: "Yves Sucaet" To: Sent: Tuesday, January 13, 2009 7:49 AM Subject: Re: [PHP-DB] help me JOIN 3 tables. Hi Joseph, With the sum() aggregate function you'll need to use a GROUP BY clause and specify which fields you want from e1 and l1. Something like this: SELECT e1.field1, e1.field2, l1.field3, SUM(a1.adp_amount) as amount FROM a1 inner join e1 on (e1.loanID = a1.adp_loanID) inner join l1 on (l1.entreID = e1.entre_ID) WHERE e1.entre_active = 'Y' hth, Yves - Original Message - From: "Abah Joseph" To: Sent: Tuesday, January 13, 2009 6:46 AM Subject: [PHP-DB] help me JOIN 3 tables. I have this SQL SELECT e1.*, l1.* FROM e1 INNER JOIN l1 WHERE e1.entre_active = 'Y' AND l1.entreID = e1.entre_id The above query works but i want to add the one below SELECT SUM(a1.adp_amount) as amount FROM a1 WHERE a1.adp_loanID = e1.loanID; the last part of the query is to SUM the part payment made on table 'l1' and return total raised with the first query. the whole idea is three tables, (business, loan, raised), loan referenced ID from business, raised referenced ID from loan. loan maybe $300 and it can be raised over time till completed, so all the amount raised + the loanId will be stored inside the raised table. Thank you -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help me JOIN 3 tables.
Hi Joseph, With the sum() aggregate function you'll need to use a GROUP BY clause and specify which fields you want from e1 and l1. Something like this: SELECT e1.field1, e1.field2, l1.field3, SUM(a1.adp_amount) as amount FROM a1 inner join e1 on (a1.loanID = a1.adp_loanID) inner join l1 on (l1.entreID = e1.entre_ID) WHERE e1.entre_active = 'Y' hth, Yves - Original Message - From: "Abah Joseph" To: Sent: Tuesday, January 13, 2009 6:46 AM Subject: [PHP-DB] help me JOIN 3 tables. I have this SQL SELECT e1.*, l1.* FROM e1 INNER JOIN l1 WHERE e1.entre_active = 'Y' AND l1.entreID = e1.entre_id The above query works but i want to add the one below SELECT SUM(a1.adp_amount) as amount FROM a1 WHERE a1.adp_loanID = e1.loanID; the last part of the query is to SUM the part payment made on table 'l1' and return total raised with the first query. the whole idea is three tables, (business, loan, raised), loan referenced ID from business, raised referenced ID from loan. loan maybe $300 and it can be raised over time till completed, so all the amount raised + the loanId will be stored inside the raised table. Thank you -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help needed - SELECT query optimization
It should be a rapidshare links database (which updates with a PHP crawler I wroted last Saturday). I would like to change the snippet to title and add another column for the snippet, My main queries are INSERT's - a big insert (usually 10-100 links per insert) in each hour. My crawler is checking if the link it is about to add is already in the database with a select query like this: SELECT `id` FROM `tbl_name` WHERE `unique` = '%_UNIQUE_VARIABLE_%' create index unique_idx on tbl_name(unique); mysql might work better with this index: create index unique_idx on tbl_name(unique, id); because in some cases it doesn't have to go back to the data file to get the actual data, it can just read everything from the index. I'm definiatly not an database scheme expert, I'm looking to optimaize the table for fast select queries (to check if file is already exists) And for fast filename-based search (select * from `tbl_name` where `filename` like '%_WHATEVER_%') like queries are harder to optimize. If you put a wildcard at the front: like '%...%'; the db can't use an index to find it, because you're saying the text can be anywhere and for that type of search you're best off setting up fulltext (http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html). If you don't put a % at the front: like '...%'; the db use an index to find it (up until the wildcard).. create index filename_idx on tbl_name(filename); To understand indexing, check out my article: http://www.designmagick.com/article/16/PostgreSQL/How-to-index-a-database (Yes it's on a postgres site but the ideas/understanding work for all db's - and the commands should even work for mysql). -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help to improve MySQL query
On Sat, Aug 9, 2008 at 1:32 AM, Niel Archer <[EMAIL PROTECTED]> wrote: > Hi > > You do not say how you identify the last call (there is no date/time > field for example), so a complete answer is not really possible With the "id (auto incremented int)", the last record of either table would be the largest id in a particular group. > Do not use "NOT LIKE 'Completed'", it's an inefficient way of doing "!= > 'Completed'" I'll modify that as you said. My real concern is that $theHugeListOfIncidentIds keeps growing and is used in the "Calls.id IN ($theHugeListOfIncidentIds)". Even if the $theHugeListOfIncidentIds was replaced with an actual MySQL query instead of first being processed by PHP, I think that is a bad approach (but maybe that is the solution if I only change this query and do not change/add columns or states). -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help to improve MySQL query
Use an appropriate status. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Dee Ayy wrote: > On Fri, Aug 8, 2008 at 5:25 PM, Micah Gersten <[EMAIL PROTECTED]> wrote: > >> How about "select Incidents.* from Incidents inner join Calls on >> Incidents.id=Calls.incidentid where Calls.status='Open'"? >> > ... > >> Dee Ayy wrote: >> > ... > >>> The status column never has the text "Open". >>> > ... > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help to improve MySQL query
On Fri, Aug 8, 2008 at 5:25 PM, Micah Gersten <[EMAIL PROTECTED]> wrote: > How about "select Incidents.* from Incidents inner join Calls on > Incidents.id=Calls.incidentid where Calls.status='Open'"? ... > > Dee Ayy wrote: ... >> The status column never has the text "Open". ... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help to improve MySQL query
Hi You do not say how you identify the last call (there is no date/time field for example), so a complete answer is not really possible Do not use "NOT LIKE 'Completed'", it's an inefficient way of doing "!= 'Completed'" -- Niel Archer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help to improve MySQL query
How about "select Incidents.* from Incidents inner join Calls on Incidents.id=Calls.incidentid where Calls.status='Open'"? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Dee Ayy wrote: > A database was designed with the following tables: > > Incidents > _ > id (auto incremented int) > ... > > Calls > _ > id (auto incremented int) > incidentId (foreign key) > status (varchar 32) > ... > > The status of the last Call is the status of the related Incident. > Statuses can be "Not started" through various states up to "Completed". > The status column never has the text "Open". > If the last Call for the related Incident is not "Completed", then it > is considered to be "Open". > > My task is to getIncidentsWithStatus("Open") using PHP. > > The existing inefficient method is in the PHP function > getIncidentsWithStatus($status = "Open"), made worse by mingling with > PHP and then another MySQL query. It first finds > $theHugeListOfIncidentIds of the last Calls OF ALL INCIDENTS, then > uses Calls.id IN ($theHugeListOfIncidentIds) AND Calls.status NOT LIKE > 'Completed'. The reason this was done was that if Calls.status NOT > LIKE 'Completed' was used first, then the result would include all > Incidents. > > A) What would be an efficient MySQL query with the database in the > present state to getIncidentsWithStatus("Open")? > > I can think of two alternatives, which require the database to be modified: > 1a) Add a trigger to update a new column named "statusFromCall" in the > Incidents table when the Calls.status is updated. > 1b) Add PHP code to update the new column named "statusFromCall" in > the Incidents table when the Calls.status is updated. > 2) Then just query for Incidents WHERE statusFromCall NOT LIKE 'Completed'. > > B) What would be the MySQL query to create such a trigger in 1a? > > Thanks. > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help in concatenation - modular development
If you want to go for a modular approach, you should consider switching to a solution such as Smarty: http://www.smarty.net for more info. HTH, Yves -- Original Message -- Received: Sat, 07 Jun 2008 11:55:38 AM CDT From: "Nitsan Bin-Nun" <[EMAIL PROTECTED]> To: "Nasreen Laghari" <[EMAIL PROTECTED]>Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Help in concatenation 1. 0?("?start=").$y:""));?>"> 2. 0?("?start=").$next:""));?>"><< turns into: > $string = '' . $pg . ''; > ?> > $string2 = ''; > ?> I can squeeze the if operation into the string but I can't see good cause for this (this is less spageti this way) On 06/06/2008, Nasreen Laghari <[EMAIL PROTECTED]> wrote: > > Hi, > > I need to change PHP embeded in HTML to HTML embeded in PHP as trying to > use modularity approach. > I'm stuck on below these lines where concatenation is the big issue. I have > researched, read but couldnt sort this out after try really hard. > Could any one please help me to change this code to HTML embeded in PHP > please. Mostly i'm getting confuse where text is written in red > I know it is very basic question but this concatenation is confusing me so > much. I have spended my whole day in sorting this out but :( > 1. 0?("?start=").$y:""));?>"> > 2. 0?("?start=").$next:""));?>"><< > Thank you > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help in concatenation
1. 0?("?start=").$y:""));?>"> 2. 0?("?start=").$next:""));?>"><< turns into: > $string = '' . $pg . ''; > ?> > $string2 = ''; > ?> I can squeeze the if operation into the string but I can't see good cause for this (this is less spageti this way) On 06/06/2008, Nasreen Laghari <[EMAIL PROTECTED]> wrote: > > Hi, > > I need to change PHP embeded in HTML to HTML embeded in PHP as trying to > use modularity approach. > I'm stuck on below these lines where concatenation is the big issue. I have > researched, read but couldnt sort this out after try really hard. > Could any one please help me to change this code to HTML embeded in PHP > please. Mostly i'm getting confuse where text is written in red > I know it is very basic question but this concatenation is confusing me so > much. I have spended my whole day in sorting this out but :( > 1. 0?("?start=").$y:""));?>"> > 2. 0?("?start=").$next:""));?>"><< > Thank you > > >
RE: [PHP-DB] Help with JOIN query
I know the feeling. I've been trying to hookup MYSQL as a linked server on MS SQL Server. There are a few articles out there that make mention of it but no where does anybody say exactly how to do it. Gary > -Original Message- > From: Graham Cossey [mailto:[EMAIL PROTECTED] > Sent: Thu, March 06, 2008 6:33 PM > To: Gary Wardell; php-db@lists.php.net > Subject: Re: [PHP-DB] Help with JOIN query > > > On Thu, Mar 6, 2008 at 10:59 PM, Gary Wardell > <[EMAIL PROTECTED]> wrote: > > Ahh, to bad, I started using it with 5.0. I'm also a long > time user of SQL Server. > > > > Sorry if I caused confusion. > > > > Gary > > > > You were getting my hopes up there Gary :-( > > > -- > Graham > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with JOIN query
On Thu, Mar 6, 2008 at 10:59 PM, Gary Wardell <[EMAIL PROTECTED]> wrote: > Ahh, to bad, I started using it with 5.0. I'm also a long time user of SQL > Server. > > Sorry if I caused confusion. > > Gary > You were getting my hopes up there Gary :-( -- Graham -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help with JOIN query
Ahh, to bad, I started using it with 5.0. I'm also a long time user of SQL Server. Sorry if I caused confusion. Gary > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with JOIN query
Mysql doesn't support subselects in 4.0.x. That was added in 4.1. -Roberto J. Hill wrote: > I may be a little confused: the desire is to return all the rows from > TableA that match the record_id of a row in TableB that has the MAX > timestamp? > > If so, why not something like: > > SELECT * FROM TableA a, TableB b WHERE a.record_id=b.record_id && > timestamp=(SELECT MAX(timestamp) FROM TableB) ORDER BY action; > > I'm guessing I'm confused, that it's something more complicated you're > looking for. > > Jeff > > > Krister Karlström wrote: >> This will give you: >> >> ERROR : Invalid use of group function >> >> It seems like the use of an aggregate (or how is it spelled?) function >> is not allowed in a join statement... >> >> /Krister >> >> Jon L. wrote: >> >>> You can try adding a quick test to the ON statement... >>> >>> SELECT * FROM TableA >>> INNER JOIN TableB >>> ON TableA.record_id = TableB.record_id >>> AND TableB.timestamp = MAX(TableB.timestamp) >>> >>> >>> Now, I haven't tested it. >>> I can only say the theory of it is accurate. >>> >>> - Jon L. >>> >>> On Thu, Mar 6, 2008 at 12:46 PM, Graham Cossey <[EMAIL PROTECTED]> >>> wrote: >>> I can't see how to accomplish what I need so if anyone has any suggestions they would be gratefully received... I'm using mysql 4.0.20 by the way. I have two tables : TableA record_id product_ref TableB timestamp record_id action I want to create a SELECT that joins these 2 tables where the JOIN to TableB only returns the most recent entry by timestamp. At present (using PHP) I do a SELECT on TableA then for each record returned I perform a 2nd SELECT something like : "SELECT timestamp, action FROM TableB WHERE record_id = '$record_id' ORDER BY timestamp DESC LIMIT 1" I now want to do it with one query to enable sorting the results by 'action' from TableB. Any suggestions? Hopefully I've made sense, if not I'll happily try and explain further on request. -- Graham -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php >>> >> > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help with JOIN query
Hi, The way I think I'd approach it is to use an outer join where table a is joined to a subquery where the subquery returns only the max timestamp from table b. Gary > -Original Message- > From: Graham Cossey [mailto:[EMAIL PROTECTED] > Sent: Thu, March 06, 2008 5:17 PM > To: J. Hill; php-db@lists.php.net > Subject: Re: [PHP-DB] Help with JOIN query > > > On Thu, Mar 6, 2008 at 9:54 PM, J. Hill <[EMAIL PROTECTED]> wrote: > > I may be a little confused: the desire is to return all the > rows from > > TableA that match the record_id of a row in TableB that has the MAX > > timestamp? > > > > If so, why not something like: > > > > SELECT * FROM TableA a, TableB b WHERE a.record_id=b.record_id && > > timestamp=(SELECT MAX(timestamp) FROM TableB) ORDER BY action; > > > > I'm guessing I'm confused, that it's something more > complicated you're > > looking for. > > > > Thanks Krister and all for your help thus far. > > Jeff, I'm after all rows from TableA then the latest action from > TableB for each selected record in TableA. > > I'm starting to think maybe I should build an array of results using 2 > queries then sort the array using PHP functionality, but I'd rather do > it in MySQL if it's possible. > > Graham > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with JOIN query
On Thu, Mar 6, 2008 at 9:54 PM, J. Hill <[EMAIL PROTECTED]> wrote: > I may be a little confused: the desire is to return all the rows from > TableA that match the record_id of a row in TableB that has the MAX > timestamp? > > If so, why not something like: > > SELECT * FROM TableA a, TableB b WHERE a.record_id=b.record_id && > timestamp=(SELECT MAX(timestamp) FROM TableB) ORDER BY action; > > I'm guessing I'm confused, that it's something more complicated you're > looking for. > Thanks Krister and all for your help thus far. Jeff, I'm after all rows from TableA then the latest action from TableB for each selected record in TableA. I'm starting to think maybe I should build an array of results using 2 queries then sort the array using PHP functionality, but I'd rather do it in MySQL if it's possible. Graham -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with JOIN query
I may be a little confused: the desire is to return all the rows from TableA that match the record_id of a row in TableB that has the MAX timestamp? If so, why not something like: SELECT * FROM TableA a, TableB b WHERE a.record_id=b.record_id && timestamp=(SELECT MAX(timestamp) FROM TableB) ORDER BY action; I'm guessing I'm confused, that it's something more complicated you're looking for. Jeff Krister Karlström wrote: This will give you: ERROR : Invalid use of group function It seems like the use of an aggregate (or how is it spelled?) function is not allowed in a join statement... /Krister Jon L. wrote: You can try adding a quick test to the ON statement... SELECT * FROM TableA INNER JOIN TableB ON TableA.record_id = TableB.record_id AND TableB.timestamp = MAX(TableB.timestamp) Now, I haven't tested it. I can only say the theory of it is accurate. - Jon L. On Thu, Mar 6, 2008 at 12:46 PM, Graham Cossey <[EMAIL PROTECTED]> wrote: I can't see how to accomplish what I need so if anyone has any suggestions they would be gratefully received... I'm using mysql 4.0.20 by the way. I have two tables : TableA record_id product_ref TableB timestamp record_id action I want to create a SELECT that joins these 2 tables where the JOIN to TableB only returns the most recent entry by timestamp. At present (using PHP) I do a SELECT on TableA then for each record returned I perform a 2nd SELECT something like : "SELECT timestamp, action FROM TableB WHERE record_id = '$record_id' ORDER BY timestamp DESC LIMIT 1" I now want to do it with one query to enable sorting the results by 'action' from TableB. Any suggestions? Hopefully I've made sense, if not I'll happily try and explain further on request. -- Graham -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with JOIN query
This will give you: ERROR : Invalid use of group function It seems like the use of an aggregate (or how is it spelled?) function is not allowed in a join statement... /Krister Jon L. wrote: You can try adding a quick test to the ON statement... SELECT * FROM TableA INNER JOIN TableB ON TableA.record_id = TableB.record_id AND TableB.timestamp = MAX(TableB.timestamp) Now, I haven't tested it. I can only say the theory of it is accurate. - Jon L. On Thu, Mar 6, 2008 at 12:46 PM, Graham Cossey <[EMAIL PROTECTED]> wrote: I can't see how to accomplish what I need so if anyone has any suggestions they would be gratefully received... I'm using mysql 4.0.20 by the way. I have two tables : TableA record_id product_ref TableB timestamp record_id action I want to create a SELECT that joins these 2 tables where the JOIN to TableB only returns the most recent entry by timestamp. At present (using PHP) I do a SELECT on TableA then for each record returned I perform a 2nd SELECT something like : "SELECT timestamp, action FROM TableB WHERE record_id = '$record_id' ORDER BY timestamp DESC LIMIT 1" I now want to do it with one query to enable sorting the results by 'action' from TableB. Any suggestions? Hopefully I've made sense, if not I'll happily try and explain further on request. -- Graham -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with JOIN query
You can try adding a quick test to the ON statement... SELECT * FROM TableA INNER JOIN TableB ON TableA.record_id = TableB.record_id AND TableB.timestamp = MAX(TableB.timestamp) Now, I haven't tested it. I can only say the theory of it is accurate. - Jon L. On Thu, Mar 6, 2008 at 12:46 PM, Graham Cossey <[EMAIL PROTECTED]> wrote: > I can't see how to accomplish what I need so if anyone has any > suggestions they would be gratefully received... > > I'm using mysql 4.0.20 by the way. > > I have two tables : > > TableA > record_id > product_ref > > TableB > timestamp > record_id > action > > I want to create a SELECT that joins these 2 tables where the JOIN to > TableB only returns the most recent entry by timestamp. > > At present (using PHP) I do a SELECT on TableA then for each record > returned I perform a 2nd SELECT something like : > > "SELECT timestamp, action FROM TableB WHERE record_id = '$record_id' > ORDER BY timestamp DESC LIMIT 1" > > I now want to do it with one query to enable sorting the results by > 'action' from TableB. > > Any suggestions? > > Hopefully I've made sense, if not I'll happily try and explain further > on request. > > -- > Graham > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP-DB] Help with JOIN query
Hi again! We're getting a bit of topic here, since this is pure SQL.. But anyway... I've played around with this one a bit since it seemed quite interesting... The best I can do is to get the oldest action... select TableA.record_id, product_ref, action, time_stamp from TableA join TableB on TableA.record_id = TableB.record_id group by record_id; Here's the test data: mysql> select TableA.record_id, product_ref, action, time_stamp from TableA join TableB on TableA.record_id = TableB.record_id; +---+-+++ | record_id | product_ref | action | time_stamp | +---+-+++ | 1 | 100 | A | 20080306220037 | | 1 | 100 | C | 20080306220041 | | 1 | 100 | E | 20080306220045 | | 2 | 102 | A | 20080306220052 | | 3 | 110 | A | 20080306220055 | | 3 | 110 | E | 20080306220058 | | 4 | 120 | B | 20080306220105 | | 4 | 120 | C | 20080306220109 | +---+-+++ And with the query above we get the opposite of the desired behavior, the oldest action (if that's the order in the database): mysql> select TableA.record_id, product_ref, action, time_stamp from TableA join TableB on TableA.record_id = TableB.record_id group by record_id; +---+-+++ | record_id | product_ref | action | time_stamp | +---+-+++ | 1 | 100 | A | 20080306220037 | | 2 | 102 | A | 20080306220052 | | 3 | 110 | A | 20080306220055 | | 4 | 120 | B | 20080306220105 | +---+-+++ 4 rows in set (0.00 sec) Now is the question: Does anyone know how to get the 'group by' clause to leave a specific row 'visible' at top? Like the last inserted or by the order of another column... Since MySQL 4.1 there are also a GROUP_CONCAT() function that can concatenate multiple 'rows' to a string in a desired order, but it does not support the limit statement... so that won't help us much I think. We can get all the actions in a string with the newest first, but then some post-stripping of the data is needed. It seems like you need to do this with two queries in PHP, if no one has an answer to the question stated above. You can always buffer your result in an array in PHP and do whatever sorting you want to before using your data... With the MAX() function we can found out when the last action was made, but we get the wrong action with the correct time: mysql> select TableA.record_id, product_ref, action, max(time_stamp) from TableA join TableB on TableA.record_id = TableB.record_id group by record_id; +---+-++-+ | record_id | product_ref | action | max(time_stamp) | +---+-++-+ | 1 | 100 | A | 20080306220045 | | 2 | 102 | A | 20080306220052 | | 3 | 110 | A | 20080306220058 | | 4 | 120 | B | 20080306220109 | +---+-++-+ 4 rows in set (0.00 sec) Hmm... Now I'm stuck! :) Greetings, Krister Karlström, Helsinki, Finland Graham Cossey wrote: I can't see how to accomplish what I need so if anyone has any suggestions they would be gratefully received... I'm using mysql 4.0.20 by the way. I have two tables : TableA record_id product_ref TableB timestamp record_id action I want to create a SELECT that joins these 2 tables where the JOIN to TableB only returns the most recent entry by timestamp. At present (using PHP) I do a SELECT on TableA then for each record returned I perform a 2nd SELECT something like : "SELECT timestamp, action FROM TableB WHERE record_id = '$record_id' ORDER BY timestamp DESC LIMIT 1" I now want to do it with one query to enable sorting the results by 'action' from TableB. Any suggestions? Hopefully I've made sense, if not I'll happily try and explain further on request. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with JOIN query
Hi! Graham Cossey wrote: I was hoping to avoid joining everything as there can be many entries in TableB for each record in TableA. Also wouldn't your query only return one record? I need to return all records from TableA with the latest action from TableB as well. Yes, sorry - I realised that after I sent away my first reply.. :) I have a colleague who always says that "people don't READ their mail - the just LOOK at their mail".. It's so true! I missed some of your points. But maybe you got some ideas from my other mail, which I seem to have posted only to you directly.. Oh well, this is a tricky one anyway... /Krister Karlström -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with JOIN query
On Thu, Mar 6, 2008 at 6:54 PM, Krister Karlström <[EMAIL PROTECTED]> wrote: > Hi! > > > Graham Cossey wrote: > > > TableA > > record_id > > product_ref > > > > TableB > > timestamp > > record_id > > action > > > > I want to create a SELECT that joins these 2 tables where the JOIN to > > TableB only returns the most recent entry by timestamp. > > For instance, to select all columns: > > select * from TableA > join TableB on TableA.record_id = TableB.record_id > order by timestamp desc > limit 1 > > So you just join everything, then order by time in descening order and > then just returning the first record = the newest record in the > database. If you don't want all columns, then simply replace the star > with the names of the columns you want. > > I hope that this is what you wanted the query to do.. :) > I was hoping to avoid joining everything as there can be many entries in TableB for each record in TableA. Also wouldn't your query only return one record? I need to return all records from TableA with the latest action from TableB as well. Graham -- Graham -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with JOIN query
Hi! Graham Cossey wrote: TableA record_id product_ref TableB timestamp record_id action I want to create a SELECT that joins these 2 tables where the JOIN to TableB only returns the most recent entry by timestamp. For instance, to select all columns: select * from TableA join TableB on TableA.record_id = TableB.record_id order by timestamp desc limit 1 So you just join everything, then order by time in descening order and then just returning the first record = the newest record in the database. If you don't want all columns, then simply replace the star with the names of the columns you want. I hope that this is what you wanted the query to do.. :) Cheers, Krister Karlström, Helsinki, Finland -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with MySql float
Daniel Brown wrote: On Feb 17, 2008 10:59 AM, Velen <[EMAIL PROTECTED]> wrote: Hi Guys, When inserting a value like 123567.8956 in my table it is rounding it to 2 decimal place. The field type is set as float. Can anyone tell me why it's not taking all the decimals? and How to insert the number with all the decimals? That's a MySQL question, not a PHP question, but my guess is that the column is set as FLOAT(x,2) (where x is any real number). Try changing that to FLOAT(10,4). The first number is everything to the left of the decimal, while the second is the number of places to count after the decimal. Also note that a float type is not guaranteed to come back the same as it goes in (and this will also affect maths operations) - so if you need 4 decimal places, then use decimal or numeric as the data type. http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html MySQL performs rounding when storing values, so if you insert 999.9 into a FLOAT(7,4) column, the approximate result is 999.0001. The DECIMAL and NUMERIC data types are used to store exact numeric data values. . These types are used to store values for which it is important to preserve exact precision, for example with monetary data. This is the same in any db, it's not a mysql specific behaviour. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with MySql float
On Feb 17, 2008 10:59 AM, Velen <[EMAIL PROTECTED]> wrote: > Hi Guys, > > When inserting a value like 123567.8956 in my table it is rounding it to 2 > decimal place. The field type is set as float. > > Can anyone tell me why it's not taking all the decimals? and How to insert > the number with all the decimals? That's a MySQL question, not a PHP question, but my guess is that the column is set as FLOAT(x,2) (where x is any real number). Try changing that to FLOAT(10,4). The first number is everything to the left of the decimal, while the second is the number of places to count after the decimal. -- Daniel P. Brown Senior Unix Geek -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with MySql float
Velen wrote: Hi Guys, When inserting a value like 123567.8956 in my table it is rounding it to 2 decimal place. The field type is set as float. Can anyone tell me why it's not taking all the decimals? and How to insert the number with all the decimals? Thanks Velen Hello Velen, Your question seem purely related to MySQL. Not very PHP related. Anyway... It depends on your version of MySQL. Check the documentation for Numeric Types. It says you can specify the number of decimals you want to store, something like FLOAT(max_digits,precision). If you need more precision, there's also the DOUBLE PRECISION. If your MySQL column is specified for higher precision already, then it could be a PHP issue. Is this the case? For MySQL => 5.0 http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html For MySQL < 5.0 http://dev.mysql.com/doc/refman/4.1/en/numeric-types.html /Tobias -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help
On 8/20/07, Asim <[EMAIL PROTECTED]> wrote: > can anyone provide me code of basic website structure having member > area and can use mysql database to show results of search by PAGINATION? For pagination refer this :- http://www.phpfreaks.com/tutorials/43/5.php Hope this will help you. --- R * Subramani My Log File : http://rsubramani.wordpress.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help creating tables and fields
- Original Message - From: Karl James To: 'bedul' Sent: Thursday, March 29, 2007 10:40 AM Subject: RE: [PHP-DB] Help creating tables and fields bedul, wow great information and so quick. very greatfull for that. Would you mine baby stepping for me? [bedul] i don't understand what u said.. but i read as something nice my real name was gunawan (pronounce as Gun - A - One ) = I am using dreamweaver 8 to build my pages. [bedul] i'm using not 1!! but 3!! text editor, html editor (dreamweaver) and text based html editor.. fyi.. i build scratch in excel. that editor was crimson editor (this free) , Ace Html (trial).. since u already use DW.. don't try.. you might try to download it.. plz remember.. u not superman.. we only able to create page using php. in this era.. u probably able to use html, db, javascript and template building.. owww man.. fyi.. i'm not that strong created by myself. even i already create using both of i said earlier. see attach u might hard to read the languages i use. but i mean in the attach was.. this is my scratch design === But I can do in code as well. I just created a connection to my database. So, now I am just trying to create the username and password field on my dwt template page? Would that be correct or what should be my first step? [bedul] that's better.. but u supposed to create map link for the aplication there were 3 who use this page. let view the guest first.. 1. guest enter the web (www.fotball.com) 2. in there what he/she able to see (for guest only) => what the scratch of guest?? 3. are there anything else that guest able to see?? then let view the user 1. user enter the web 2. user view opening page 3. login 4. if login failed 5. what he/she view after login 6. other page that he/she able to see admin i think.. for this.. self explain. === Should we just create the tables first through phpmyadmin page. That is where it is easier to see everything, the tables that is. [bedul] the reason why you must to build the scratch (before goes online and able to program).. is to figure what table we can use?? after u able to build the scratch page (html).. then u goes to build the table.. === Please continue with your thoughts. Karl James ("TheSaint") [EMAIL PROTECTED] [EMAIL PROTECTED] www.theufl.com [bedul] last suggestion.. u can improve the skill if you 1. created as many page 2. complain by your user 3. lazy?? i too lazy type textbox and then i create a function that return textbox function inpText($name, $dValue, $size, $max){ $temp =' resepOnLine.xls Description: MS-Excel spreadsheet -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help in database design
NOT QUITE..ups.. my bad - Original Message - From: "Chris" <[EMAIL PROTECTED]> To: "Suprie" <[EMAIL PROTECTED]> Cc: Sent: Thursday, March 29, 2007 6:53 AM Subject: Re: [PHP-DB] help in database design > Suprie wrote: > > hi all, > > > > i need help in design a database, our office is hospital equipment > > supplier, > > we had a list of items, each items had it's own configuration, and > > each item could consist of several item. we also had contract that > > have a lot of site, sometimes equipmend that have been ordered > > different from what the site received, in that case we made a change > > request... > > > > for now we have this > > > > |contract|--|has|-|site| > > | > > | > > |item||material| > > | > > | > > |configuration| > > > > but i really confused about the Change Request thing, we have to keep > > both what have been ordered and what have been received... where > > should i put it, sorri for my bad english > > Why does that have to fit into this scheme? > > Why can't it be separate? well as u mention above.. he already seperated while ago.. item and material was 2 different table. and yet it should seperated.. i alreadt received the newest.. i hope he posted but i posted again == site is, the items destination , owh i forgot beside the goods we also provide services, that could change also just like other items depends the situation. = as i write above.. he mistaken on what the flow goes > > create table change_requests ( >request_id primary key .. blah blah, >item_ordered text, >item_order_date timestamp, // so you know when you ordered it >item_received text, >item_receive_date timestamp // so you know when you received it. > ); > > problem solved ? > > -- > Postgresql & php tutorials > http://www.designmagick.com/ > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help in database design
Suprie wrote: hi all, i need help in design a database, our office is hospital equipment supplier, we had a list of items, each items had it's own configuration, and each item could consist of several item. we also had contract that have a lot of site, sometimes equipmend that have been ordered different from what the site received, in that case we made a change request... for now we have this |contract|--|has|-|site| | | |item||material| | | |configuration| but i really confused about the Change Request thing, we have to keep both what have been ordered and what have been received... where should i put it, sorri for my bad english Why does that have to fit into this scheme? Why can't it be separate? create table change_requests ( request_id primary key .. blah blah, item_ordered text, item_order_date timestamp, // so you know when you ordered it item_received text, item_receive_date timestamp // so you know when you received it. ); problem solved ? -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help in database design
what is site mean in here?? - Original Message - From: "Suprie" <[EMAIL PROTECTED]> To: Sent: Wednesday, March 28, 2007 5:03 PM Subject: [PHP-DB] help in database design > hi all, > > i need help in design a database, our office is hospital equipment supplier, > we had a list of items, each items had it's own configuration, and > each item could consist of several item. we also had contract that > have a lot of site, sometimes equipmend that have been ordered > different from what the site received, in that case we made a change > request... > > for now we have this > > |contract|--|has|-|site| >| >| >|item||material| >| >| > |configuration| i rather confused on configuration.. but plz send me a light?? > > but i really confused about the Change Request thing, we have to keep > both what have been ordered and what have been received... where > should i put it, sorri for my bad english > > tq -- -- Table structure for table `rsib_contract` -- CREATE TABLE `rsib_contract` ( `conId` int(11) NOT NULL, `conItemID` int(11) NOT NULL, `conSiteID` int(11) NOT NULL, `conDesc` varchar(100) collate latin1_general_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; -- -- Dumping data for table `rsib_contract` -- -- -- -- Table structure for table `rsib_item` -- CREATE TABLE `rsib_item` ( `itemId` int(11) NOT NULL, `itemName` varchar(45) collate latin1_general_ci NOT NULL, `itemStat` varchar(4) collate latin1_general_ci NOT NULL, `itemDesc` text collate latin1_general_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; -- -- Dumping data for table `rsib_item` -- -- -- -- Table structure for table `rsib_material` -- CREATE TABLE `rsib_material` ( `matId` int(11) NOT NULL, `matName` varchar(34) collate latin1_general_ci NOT NULL, `matDesc` text collate latin1_general_ci NOT NULL, `matItemId` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; -- -- Dumping data for table `rsib_material` -- -- -- -- Table structure for table `rsib_site` -- CREATE TABLE `rsib_site` ( `siteId` int(11) NOT NULL, `siteName` varchar(60) collate latin1_general_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; > > -- > Jangan tanyakan apa yang Indonesia telah berikan pada mu > tapi bertanyalah apa yang telah engkau berikan kepada Indonesia > > -BEGIN GEEK CODE BLOCK- > Version: 3.1 > GU/IT d- s: a-- C++ UL P L++ E W++ N* o-- K- > w PS Y-- PGP- t++ 5 X R++ tv b+ DI D+ G e+ h* r- z? > --END GEEK CODE BLOCK-- > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mysql connect error
Tim McGeary wrote: Chris wrote: Tim McGeary wrote: Stut wrote: Ok, so I did the recommended process of: mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd') -> WHERE Host = 'some_host' AND User = 'some_user'; mysql> FLUSH PRIVILEGES; This allows the CLI script to run successfully, but the web php file still gives me the original error. Any ideas? The error again is: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/software/index.php on line 18 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) '13' means permission denied. $ perror 13 System error: 13 = Permission denied What are the permissions on the /var/lib/mysql/ directory? Maybe php can't get into that, thus it can't get to the socket file. Try chmod 755 /var/lib/mysql to allow any user to be able to read files in that folder (but not change anything)... You are correct, it was the directory permissions! Thank you so much. That is also great information about what the error numbers mean. Where or how can I find out what those numbers mean for future reference? With a *nix / *bsd shell, pass it to 'perror': perror XXX and if perror knows what it is, it will let you know... mysql (or other apps) might use numbers that perror doesn't know, then it becomes a bit tougher but a search usually helps. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mysql connect error
Chris wrote: Tim McGeary wrote: Stut wrote: Ok, so I did the recommended process of: mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd') -> WHERE Host = 'some_host' AND User = 'some_user'; mysql> FLUSH PRIVILEGES; This allows the CLI script to run successfully, but the web php file still gives me the original error. Any ideas? The error again is: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/software/index.php on line 18 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) '13' means permission denied. $ perror 13 System error: 13 = Permission denied What are the permissions on the /var/lib/mysql/ directory? Maybe php can't get into that, thus it can't get to the socket file. Try chmod 755 /var/lib/mysql to allow any user to be able to read files in that folder (but not change anything)... You are correct, it was the directory permissions! Thank you so much. That is also great information about what the error numbers mean. Where or how can I find out what those numbers mean for future reference? Thanks, Tim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mysql connect error
Tim McGeary wrote: Stut wrote: Tim McGeary wrote: But I do have a MySQL 5 client: [EMAIL PROTECTED] html]# rpm -qa MySQL* MySQL-shared-compat-5.0.27-0.rhel3 MySQL-client-standard-5.0.27-0.rhel3 MySQL-python-0.9.1-6 MySQL-server-standard-5.0.27-0.rhel3 MySQL-devel-standard-5.0.27-0.rhel3 or are you saying that the PHP libs have a MySQL 4 client in there? If that is the case, how should I rebuild PHP? Yes, and it depends on what OS, where it originally came from, etc. The alternative is to change the password of the MySQL user you're using - the link in my last post explains how to do this. Ok, so I did the recommended process of: mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd') -> WHERE Host = 'some_host' AND User = 'some_user'; mysql> FLUSH PRIVILEGES; This allows the CLI script to run successfully, but the web php file still gives me the original error. Any ideas? The error again is: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/software/index.php on line 18 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) '13' means permission denied. $ perror 13 System error: 13 = Permission denied What are the permissions on the /var/lib/mysql/ directory? Maybe php can't get into that, thus it can't get to the socket file. Try chmod 755 /var/lib/mysql to allow any user to be able to read files in that folder (but not change anything)... -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mysql connect error
Stut wrote: Tim McGeary wrote: But I do have a MySQL 5 client: [EMAIL PROTECTED] html]# rpm -qa MySQL* MySQL-shared-compat-5.0.27-0.rhel3 MySQL-client-standard-5.0.27-0.rhel3 MySQL-python-0.9.1-6 MySQL-server-standard-5.0.27-0.rhel3 MySQL-devel-standard-5.0.27-0.rhel3 or are you saying that the PHP libs have a MySQL 4 client in there? If that is the case, how should I rebuild PHP? Yes, and it depends on what OS, where it originally came from, etc. The alternative is to change the password of the MySQL user you're using - the link in my last post explains how to do this. Ok, so I did the recommended process of: mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd') -> WHERE Host = 'some_host' AND User = 'some_user'; mysql> FLUSH PRIVILEGES; This allows the CLI script to run successfully, but the web php file still gives me the original error. Any ideas? The error again is: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/software/index.php on line 18 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) It definitely looks like a connection problem, as it isn't getting a chance to login. Tim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mysql connect error
Tim McGeary wrote: Thank you for the link. I think that's probably the best way to go in this case, since it's only on a dev/test server. When I build the production server, I should probably upgrade to PHP5 anyhow. I assume that should not have this problem, right? It might. PHP5 can be built against libs for MySQL 4 or 5, so just make sure that you match the version used for PHP to the server version and you'll be fine. Thanks for your help, Stut!!! No probs. -Stut -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mysql connect error
Stut wrote: Tim McGeary wrote: But I do have a MySQL 5 client: [EMAIL PROTECTED] html]# rpm -qa MySQL* MySQL-shared-compat-5.0.27-0.rhel3 MySQL-client-standard-5.0.27-0.rhel3 MySQL-python-0.9.1-6 MySQL-server-standard-5.0.27-0.rhel3 MySQL-devel-standard-5.0.27-0.rhel3 or are you saying that the PHP libs have a MySQL 4 client in there? If that is the case, how should I rebuild PHP? Yes, and it depends on what OS, where it originally came from, etc. The alternative is to change the password of the MySQL user you're using - the link in my last post explains how to do this. Thank you for the link. I think that's probably the best way to go in this case, since it's only on a dev/test server. When I build the production server, I should probably upgrade to PHP5 anyhow. I assume that should not have this problem, right? Thanks for your help, Stut!!! Tim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mysql connect error
Tim McGeary wrote: But I do have a MySQL 5 client: [EMAIL PROTECTED] html]# rpm -qa MySQL* MySQL-shared-compat-5.0.27-0.rhel3 MySQL-client-standard-5.0.27-0.rhel3 MySQL-python-0.9.1-6 MySQL-server-standard-5.0.27-0.rhel3 MySQL-devel-standard-5.0.27-0.rhel3 or are you saying that the PHP libs have a MySQL 4 client in there? If that is the case, how should I rebuild PHP? Yes, and it depends on what OS, where it originally came from, etc. The alternative is to change the password of the MySQL user you're using - the link in my last post explains how to do this. -Stut -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mysql connect error
Stut wrote: Tim McGeary wrote: Oh, duh! Ok. I wrote this: mysql_connect($hostname, $username, $password) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $result = mysql_query("SELECT * FROM Requestor_type") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { echo 'value="'.$row['description'].'">'.$row['description']." "; } ?> And got this as output: Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in /var/www/html/mysql_test.php on line 7 Client does not support authentication protocol requested by server; consider upgrading MySQL client I'm not sure I understand it. Maybe my CLI PHP script is not correct? I'm returning to PHP after 5 years of not writing in it. This basically means that you're trying to access a MySQL 5 server with MySQL 4 client. You have two choices... 1) Rebuild PHP with the MySQL 5 client libs 2) Use the old password mechanism in MySQL See here for more info... http://dev.mysql.com/doc/refman/5.0/en/old-client.html But I do have a MySQL 5 client: [EMAIL PROTECTED] html]# rpm -qa MySQL* MySQL-shared-compat-5.0.27-0.rhel3 MySQL-client-standard-5.0.27-0.rhel3 MySQL-python-0.9.1-6 MySQL-server-standard-5.0.27-0.rhel3 MySQL-devel-standard-5.0.27-0.rhel3 or are you saying that the PHP libs have a MySQL 4 client in there? If that is the case, how should I rebuild PHP? Tim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mysql connect error
Tim McGeary wrote: Oh, duh! Ok. I wrote this: mysql_connect($hostname, $username, $password) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $result = mysql_query("SELECT * FROM Requestor_type") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { echo 'value="'.$row['description'].'">'.$row['description']." "; } ?> And got this as output: Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in /var/www/html/mysql_test.php on line 7 Client does not support authentication protocol requested by server; consider upgrading MySQL client I'm not sure I understand it. Maybe my CLI PHP script is not correct? I'm returning to PHP after 5 years of not writing in it. This basically means that you're trying to access a MySQL 5 server with MySQL 4 client. You have two choices... 1) Rebuild PHP with the MySQL 5 client libs 2) Use the old password mechanism in MySQL See here for more info... http://dev.mysql.com/doc/refman/5.0/en/old-client.html -Stut -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mysql connect error
Stut wrote: Tim McGeary wrote: Tim McGeary wrote: Stut wrote: Tim McGeary wrote: I am new to this list today, so if I should be sending this to another specific PHP list, please let me know. I am getting the following error via the PHP web page I am building: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/software/index.php on line 18 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) Given that you can connect through the socket on the CLI, I'm gonna guess that it's a permissions issue. Does the user that Apache (or whatever web server you're using) runs as have access to mysql.sock? Currently mysql.sock is owned by mysql.mysql with S777 permissions. Should the ownership be different? Despite the ownership, wouldn't S777 allow any user to access it? Indeed it should. Have you tried writing a CLI script and seeing if that works? I confess I don't know what at CLI script is. What would I write? To be run on the command line. Same as a web-based PHP script, but no need to output any HTML. Just write a script that tries to connect to the database and spits out success or failure. Then run php script.php on the command line (CLI === Command Line Interface) and see what happens. -Stut Oh, duh! Ok. I wrote this: '.$row['description']." "; } ?> And got this as output: Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in /var/www/html/mysql_test.php on line 7 Client does not support authentication protocol requested by server; consider upgrading MySQL client I'm not sure I understand it. Maybe my CLI PHP script is not correct? I'm returning to PHP after 5 years of not writing in it. Tim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mysql connect error
Tim McGeary wrote: Please include the list in replies. Sorry, I meant to, but hit the wrong button. Tim McGeary wrote: Stut wrote: Tim McGeary wrote: I am new to this list today, so if I should be sending this to another specific PHP list, please let me know. I am getting the following error via the PHP web page I am building: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/software/index.php on line 18 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) Given that you can connect through the socket on the CLI, I'm gonna guess that it's a permissions issue. Does the user that Apache (or whatever web server you're using) runs as have access to mysql.sock? Currently mysql.sock is owned by mysql.mysql with S777 permissions. Should the ownership be different? Despite the ownership, wouldn't S777 allow any user to access it? Indeed it should. Have you tried writing a CLI script and seeing if that works? I confess I don't know what at CLI script is. What would I write? To be run on the command line. Same as a web-based PHP script, but no need to output any HTML. Just write a script that tries to connect to the database and spits out success or failure. Then run php script.php on the command line (CLI === Command Line Interface) and see what happens. -Stut -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mysql connect error
Please include the list in replies. Sorry, I meant to, but hit the wrong button. Tim McGeary wrote: Stut wrote: Tim McGeary wrote: I am new to this list today, so if I should be sending this to another specific PHP list, please let me know. I am getting the following error via the PHP web page I am building: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/software/index.php on line 18 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) Given that you can connect through the socket on the CLI, I'm gonna guess that it's a permissions issue. Does the user that Apache (or whatever web server you're using) runs as have access to mysql.sock? Currently mysql.sock is owned by mysql.mysql with S777 permissions. Should the ownership be different? Despite the ownership, wouldn't S777 allow any user to access it? Indeed it should. Have you tried writing a CLI script and seeing if that works? I confess I don't know what at CLI script is. What would I write? Tim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mysql connect error
Stut wrote: Tim McGeary wrote: I am new to this list today, so if I should be sending this to another specific PHP list, please let me know. I am getting the following error via the PHP web page I am building: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/software/index.php on line 18 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) Given that you can connect through the socket on the CLI, I'm gonna guess that it's a permissions issue. Does the user that Apache (or whatever web server you're using) runs as have access to mysql.sock? Currently mysql.sock is owned by mysql.mysql with S777 permissions. Should the ownership be different? Despite the ownership, wouldn't S777 allow any user to access it? Tim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help with mysql connect error
Tim McGeary wrote: I am new to this list today, so if I should be sending this to another specific PHP list, please let me know. I am getting the following error via the PHP web page I am building: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/software/index.php on line 18 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) Given that you can connect through the socket on the CLI, I'm gonna guess that it's a permissions issue. Does the user that Apache (or whatever web server you're using) runs as have access to mysql.sock? -Stut -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help on query report...
goolge cross tab query ... that is what you are looking for bastien From: Suprie <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] Help on query report... Date: Wed, 15 Nov 2006 13:28:15 +0700 dear all, i have this table id | contract No | site id | handover date |status| finishing date | contract value|actual value 1 | T0001 | LOS01 | 12-Apr-06| Done | 11-Apr-06 | 12,000 | 12,000 2 | T0002 | LOS02 | 12-Apr-06| Done | 11 Apr-06 | 11,000 | 11,000 3 | T0001 | LOS02 | | Done | 13-Apr-06 | 13,000 | 13,000 4 | T0003 | LOS01 | | Cancel | | 11,000 | now my manager asked me to produce summary report like : Contract No | TOTAL site | Total Cancelled | Total Active | Handovered | Contract Value | T0001 | 2 | 0| 2 |1 | 25,000| T0002 | 1 | 0| 1 | 1 | 11,000| T0003 | 1 | 1| 0 | 0 | 11,000 | is there some way to do it in mySQL? i'm using php 5 and mysql 5.1 right now i'm doing it manually, but i thinks it was really complex...Could somebody help me with the query ? many thanks, br -- Jangan tanyakan apa yang Indonesia telah berikan pada mu tapi bertanyalah apa yang telah engkau berikan kepada Indonesia -BEGIN GEEK CODE BLOCK- Version: 3.1 GU/IT d- s: a-- C++ UL P L++ E W++ N* o-- K- w PS Y-- PGP- t++ 5 X R++ tv b+ DI D+ G e+ h* r- z? --END GEEK CODE BLOCK-- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Ready for the world's first international mobile film festival celebrating the creative potential of today's youth? Check out Mobile Jam Fest for your a chance to WIN $10,000! www.mobilejamfest.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help on query report...
Suprie wrote: dear all, i have this table id | contract No | site id | handover date |status| finishing date | contract value|actual value 1 | T0001 | LOS01 | 12-Apr-06| Done | 11-Apr-06 | 12,000 | 12,000 2 | T0002 | LOS02 | 12-Apr-06| Done | 11 Apr-06 | 11,000 | 11,000 3 | T0001 | LOS02 | | Done | 13-Apr-06 | 13,000 | 13,000 4 | T0003 | LOS01 | | Cancel | | 11,000 | now my manager asked me to produce summary report like : Contract No | TOTAL site | Total Cancelled | Total Active | Handovered | Contract Value | T0001 | 2 | 0| 2 |1 | 25,000| T0002 | 1 | 0| 1 | 1 | 11,000| T0003 | 1 | 1| 0 | 0 | 11,000 | is there some way to do it in mySQL? i'm using php 5 and mysql 5.1 right now i'm doing it manually, but i thinks it was really complex...Could somebody help me with the query ? many thanks, Show us the query you already have rather than us just guessing the tables etc. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help Needed!!
1. yes, user a rich text editor plugin in you web page (http://www.kevinroth.com/rte/ is one such beast) 2. sure, in a text / blob field 3. yes, but likely you'll need to do it as CDATA hth Bastien From: "David Skyers" <[EMAIL PROTECTED]> To: Subject: [PHP-DB] Help Needed!! Date: Wed, 8 Nov 2006 11:59:28 - Hello, I have an input field that inserts data into an oracle table. The users of the system will be composing the data that goes into this input field in Microsoft Word. They will also be using Microsoft Word formatting features. 1. Is it possible for my input box to retain the formatting and if so how? 2. Can the Oracle database store this type of formatting? 3. Can the data and formatting then be extracted in XML Thanks, David David Skyers Support Analyst Management Systems, EISD, UCL Extension: 41849 Tel: 020 7679 1849 Email: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Say hello to the next generation of Search. Live Search try it now. http://www.live.com/?mkt=en-ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help Needed!!
Forgive me for saying this, but you should be posting this to the Oracle mailing list, not here. David Skyers wrote: > Hello, > > I have an input field that inserts data into an oracle table. The users > of the system will be composing the data that goes into this input field > in Microsoft Word. > > They will also be using Microsoft Word formatting features. > > 1. Is it possible for my input box to retain the formatting and if so > how? > 2. Can the Oracle database store this type of formatting? > 3. Can the data and formatting then be extracted in XML > > Thanks, > > David > > > > David Skyers > Support Analyst > Management Systems, EISD, UCL > Extension: 41849 > Tel: 020 7679 1849 > Email: [EMAIL PROTECTED] > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help displaying Column Names
On 9/14/06, Miguel Guirao <[EMAIL PROTECTED]> wrote: You haven't searched at all, go to www.php.net and look up for mysql_field_name() and related functions!! -Original Message- From: Grant Griffith [mailto:[EMAIL PROTECTED] Sent: Jueves, 14 de Septiembre de 2006 10:22 a.m. To: php-db@lists.php.net Subject: [PHP-DB] Help displaying Column Names Hello All, I am fairly new to PHP but have coded in asp and asp.net for years. I am trying to find the code that will allow me to display the name of the column's from the table I am using. Below is the code where I am writing all the data out in a comma delimited fashion, but I want to make the very first row show the name of the database table names. For example I want to show the ID,Name,Address, etc... Can someone tell me what that command is in PHP? I have searched and can not find anything, I guess I am searching for the wrong info as I know it can be done!!! This functionality is related to the database you are using. Thus you have to look into the functions that PHP provides for this database. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help displaying Column Names
You haven't searched at all, go to www.php.net and look up for mysql_field_name() and related functions!! -Original Message- From: Grant Griffith [mailto:[EMAIL PROTECTED] Sent: Jueves, 14 de Septiembre de 2006 10:22 a.m. To: php-db@lists.php.net Subject: [PHP-DB] Help displaying Column Names Hello All, I am fairly new to PHP but have coded in asp and asp.net for years. I am trying to find the code that will allow me to display the name of the column's from the table I am using. Below is the code where I am writing all the data out in a comma delimited fashion, but I want to make the very first row show the name of the database table names. For example I want to show the ID,Name,Address, etc... Can someone tell me what that command is in PHP? I have searched and can not find anything, I guess I am searching for the wrong info as I know it can be done!!! $sel_result = mysql_query("select * from customerdata where account_type = '$tmpType'",$db); //Now loop thru account types and show the one selected while($sel_row=mysql_fetch_array($sel_result)) { print "\"$sel_row[0]\",\"$sel_row[1]\",\"$sel_row[2]\",\"$sel_row[3]\",\"$sel_ row[4]\",\"$sel_row[5]\",\"$sel_row[6]\",\"$sel_row[7]\",\"$sel_row[8]\" ,\"$sel_row[9]\","; print "\"$sel_row[10]\",\"$sel_row[11]\",\"$sel_row[12]\",\"$sel_row[13]\",\"$ sel_row[14]\",\"$sel_row[15]\",\"$sel_row[16]\",\"$sel_row[17]\",\"$sel_ row[18]\",\"$sel_row[19]\","; print "\"$sel_row[20]\",\"$sel_row[21]\",\"$sel_row[22]\",\"$sel_row[23]\",\"$ sel_row[24]\",\"$sel_row[25]\",\"$sel_row[26]\",\"$sel_row[27]\"\n"; } Thanks, Grant Griffith Web Application Developer Enhanced Telecommunications http://www.etczone.com 812-932-1000 Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos. This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the responsible agent for this information, this person is herein notified that any unauthorized dissemination, distribution or copying of the materials included in this facsimile is strictly prohibited. If you received this document by mistake please notify immediately to the subscriber and destroy the message. Any opinions contained in this e-mail are those of the author of the message and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries companies. No part of this message or attachments may be used or reproduced in any manner whatsoever. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help in sql - postgresql
Hi, Thanks a lot, That exactly wat I need :) Suad Chris wrote: suad wrote: Hi, I need some help in sql - postgresql: Yay a postgres question! :D hee hee *The question is* : how can I force that the result of the col payed to be zerro "0" insted of nothing (NULL) and the order will be in way that the zerro's values comes first. and the result will be: sum | payed | to_pay -+---+ 25 | 0 | 0 150 | 150 | 0 175 | 150 | 25 COALESCE will do it for you: SELECT SUM(c_price) as sum,(SELECT COALESCE(SUM(d_price), 0) FROM d WHERE a_id=t1.a_id ) AS payed, SUM(c_price)-(SELECT COALESCE(SUM(d_price), 0) FROM d WHERE a_id=t1.a_id ) AS to_pay FROM c AS t1 group by a_id order by payed; sum | payed | to_pay -+---+ 25 | 0 | 25 150 | 150 | 0 175 | 150 | 25 (3 rows) http://www.postgresql.org/docs/8.1/interactive/functions-conditional.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help in sql - postgresql
suad wrote: Hi, I need some help in sql - postgresql: Yay a postgres question! :D hee hee *The question is* : how can I force that the result of the col payed to be zerro "0" insted of nothing (NULL) and the order will be in way that the zerro's values comes first. and the result will be: sum | payed | to_pay -+---+ 25 | 0 | 0 150 | 150 | 0 175 | 150 | 25 COALESCE will do it for you: SELECT SUM(c_price) as sum,(SELECT COALESCE(SUM(d_price), 0) FROM d WHERE a_id=t1.a_id ) AS payed, SUM(c_price)-(SELECT COALESCE(SUM(d_price), 0) FROM d WHERE a_id=t1.a_id ) AS to_pay FROM c AS t1 group by a_id order by payed; sum | payed | to_pay -+---+ 25 | 0 | 25 150 | 150 | 0 175 | 150 | 25 (3 rows) http://www.postgresql.org/docs/8.1/interactive/functions-conditional.html -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help: Two dimensional array from table
The reason I had orginally singled out one column ['usr_d'] is so I could nest it inside another loop to see if two values match. if usr_id matched returned value from first loop. The way I called it was if(!in_array(@$row_rsResults['id_subscribe'],$usrreg)) { else{ now Im not sure how to call the individual fields. I've tried $usrreg['date']; but that doesn't seem to work. Do I need to use keys and values ? TIA Mark -Original Message- From: [EMAIL PROTECTED] Sent: Friday, April 7, 2006 4:14 PM -07:00 To: Mark Fellowes [EMAIL PROTECTED] Subject: [PHP-DB] Help: Two dimensional array from table Yes, all wrong. The array that mysql_fetch_assoc returns is one dimensional. Not two. So you can refer to it like you are. Your problem is in your query more than anything. You're doing things the hard way. Keep in mind that mysql_fetch_assoc will take care of column names for you so: $rs_usr_usr = mysql_query("select user_id, usr_date from table"); //Code for registered $usrreg = array(); do { $usrreg[] = $row_usr_usr; } while($row_rs_usr_usr = mysql_fetch_assoc($rs_usr_usr)); //end of registered That's all you need. -Micah Mark Fellowes wrote: > I created an array to pull data out of one column in database. > >//Code for registered > $usrregid = array(); > do { > $usrregid[] = $row_rs_usr_usr["usr_id"]; > } while($row_rs_usr_usr = mysql_fetch_assoc($rs_usr_usr)); > //end of registered > ?> > > However I now need a second column from the table and think a two dimensional > array is the right way to go. Having a problem though in defining. Most of > the examples I found don't seem to apply to pulling the values from a db. > > I tried this and while it returns no errors, it also returns no value. > > //Code for registered > $usrreg = array("id", "date"); > do { > $usrreg[] = $row_rs_usr_usr["usr_id"]["usr_date]; > } while($row_rs_usr_usr = mysql_fetch_assoc($rs_usr_usr)); > //end of registered > ?> > > Am I defining wrong or pulling the values wrong ? > > TIA > Mark > __ > Organize. Communicate. Share. @ http://www.goowy.com > __ Organize. Communicate. Share. @ http://www.goowy.com
RE: [PHP-DB] help with file downloads from MySQL
I found the problem. I had 2 separate PHP sections of code with a blank line between them. For some reason, the blank line was causing the newline to be outputted before the file. I found it by accidentally putting a blank space between the sections that output the file and the free the results from the queries and it put a newline at the end of the output data. Thanks everyone for the help with this. -Original Message- From: Oskar [mailto:[EMAIL PROTECTED] Sent: Friday, March 24, 2006 1:59 AM To: Mickey Martin; PHP db Subject: Re: [PHP-DB] help with file downloads from MySQL Mickey Martin wrote: > From what I can tell, the 0a is not in the file, but is being inserted >either with the echo or by the browser when it receives the file. Does >anyone know if a proxy server would cause this? There shouldn't be one >involved, but I am going to contact my IT department to find out how it >is configured today. > >Thanks, >Mickey > > > > > 0a is new line character code. Check your script you must be somewhere displaying it. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] help with file downloads from MySQL
Mickey Martin wrote: > I guessed that 0a is the code for a new line, but cannot find where it is > in my code. This is the entire code that I'm using for the download: > > if ($id_files) { > > mysql_select_db($database_ctnwww, $ctnwww); > $query_Attachment = sprintf("SELECT bin_data, filetype, filename, filesize > FROM IssueAttach WHERE id_files=%s", $_GET['id_files']); > $Attachment = mysql_query($query_Attachment, $ctnwww) or > die(mysql_error()); $row_Attachment = mysql_fetch_array($Attachment); > > $data = $row_Attachment['bin_data']; > $name = $row_Attachment['filename']; > $size = $row_Attachment['filesize']; > $type = $row_Attachment['filetype']; > > header("Content-type: $type"); > header("Content-length: $size"); > header("Content-Disposition: attachment; filename=\"$name\""); > header("Content-Description: PHP Generated Data"); > echo $data; > } > ?> > > I have also tried putting a string in front of the file on the echo line: > echo "TEST TEXT", $data; > > When the file is saved, it begins with 0a followed by TEST TEXT and then > the start of the file without another instance of 0a. > > Mickey > > > -Original Message- > From: Oskar [mailto:[EMAIL PROTECTED] > Sent: Friday, March 24, 2006 1:59 AM > To: Mickey Martin; PHP db > Subject: Re: [PHP-DB] help with file downloads from MySQL > > Mickey Martin wrote: > >> From what I can tell, the 0a is not in the file, but is being inserted >>either with the echo or by the browser when it receives the file. Does >>anyone know if a proxy server would cause this? There shouldn't be one >>involved, but I am going to contact my IT department to find out how it >>is configured today. >> >>Thanks, >>Mickey >> >> >> >> >> > 0a is new line character code. Check your script you must be somewhere > displaying it. For a wild guess - is http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] help with file downloads from MySQL
I guessed that 0a is the code for a new line, but cannot find where it is in my code. This is the entire code that I'm using for the download: I have also tried putting a string in front of the file on the echo line: echo "TEST TEXT", $data; When the file is saved, it begins with 0a followed by TEST TEXT and then the start of the file without another instance of 0a. Mickey -Original Message- From: Oskar [mailto:[EMAIL PROTECTED] Sent: Friday, March 24, 2006 1:59 AM To: Mickey Martin; PHP db Subject: Re: [PHP-DB] help with file downloads from MySQL Mickey Martin wrote: > From what I can tell, the 0a is not in the file, but is being inserted >either with the echo or by the browser when it receives the file. Does >anyone know if a proxy server would cause this? There shouldn't be one >involved, but I am going to contact my IT department to find out how it >is configured today. > >Thanks, >Mickey > > > > > 0a is new line character code. Check your script you must be somewhere displaying it. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] help with file downloads from MySQL
From what I can tell, the 0a is not in the file, but is being inserted either with the echo or by the browser when it receives the file. Does anyone know if a proxy server would cause this? There shouldn't be one involved, but I am going to contact my IT department to find out how it is configured today. Thanks, Mickey -Original Message- From: Giff Hammar [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 3:50 PM To: 'Mickey Martin'; 'Bastien Koert'; php-db@lists.php.net Subject: RE: [PHP-DB] help with file downloads from MySQL Can you use something like this (I haven't tried it)? $search = '/^0a/'; // Looks at the beginning of the stream for 0a $replace = ""; // Replace with this $limit = 1; // How many you want to do $new_file = preg_replace($search, $replace, $old_file, $limit); Giff -Original Message- From: Mickey Martin [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 4:05 PM To: 'Bastien Koert'; php-db@lists.php.net Subject: RE: [PHP-DB] help with file downloads from MySQL I tried purposely corrupting the file by adding blank spaces at the beginning of the echo: echo " ",$data; The 0a was put in at the beginning again, followed by the spaces and then the file. Mickey -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 2:07 PM To: [EMAIL PROTECTED]; php-db@lists.php.net Subject: RE: [PHP-DB] help with file downloads from MySQL If you load the data into the field with addslashes, have you tried stripslashes on the way out? Bastien >From: "Mickey Martin" <[EMAIL PROTECTED]> >To: php-db@lists.php.net >Subject: [PHP-DB] help with file downloads from MySQL >Date: Tue, 21 Mar 2006 12:55:56 -0600 > >Every time I try to download a file from MySQL it cannot be opened. >Using HexEdit, I noticed that all of the files are getting 0a added to >the beginning of them (happens with all browsers). > >I can look at the files with MySQL Query Browser and they don't have >the 0a. >Using php 4.3.11, Solaris 8, Apache 2.0.54, MySQL 4.1.11. > >Here's what I'm using: >mysql_select_db($database_ctnwww, $ctnwww); $query_Attachment = >sprintf("SELECT bin_data, filetype, filename, filesize FROM IssueAttach >WHERE id_files=%s", $_GET['id_files']); $Attachment = >mysql_query($query_Attachment, $ctnwww) or die(mysql_error()); >$row_Attachment = mysql_fetch_array($Attachment); > > $data = $row_Attachment['bin_data']; > $name = $row_Attachment['filename']; > $size = $row_Attachment['filesize']; > $type = $row_Attachment['filetype']; > > header("Content-type: $type"); > header("Content-length: $size"); > header("Content-Disposition: attachment; filename=$name"); > header("Content-Description: PHP Generated Data"); > echo $data; > >Thanks in advance, >Mickey > >-- >PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: >http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] help with file downloads from MySQL
Can you use something like this (I haven't tried it)? $search = '/^0a/'; // Looks at the beginning of the stream for 0a $replace = ""; // Replace with this $limit = 1; // How many you want to do $new_file = preg_replace($search, $replace, $old_file, $limit); Giff -Original Message- From: Mickey Martin [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 4:05 PM To: 'Bastien Koert'; php-db@lists.php.net Subject: RE: [PHP-DB] help with file downloads from MySQL I tried purposely corrupting the file by adding blank spaces at the beginning of the echo: echo " ",$data; The 0a was put in at the beginning again, followed by the spaces and then the file. Mickey -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 2:07 PM To: [EMAIL PROTECTED]; php-db@lists.php.net Subject: RE: [PHP-DB] help with file downloads from MySQL If you load the data into the field with addslashes, have you tried stripslashes on the way out? Bastien >From: "Mickey Martin" <[EMAIL PROTECTED]> >To: php-db@lists.php.net >Subject: [PHP-DB] help with file downloads from MySQL >Date: Tue, 21 Mar 2006 12:55:56 -0600 > >Every time I try to download a file from MySQL it cannot be opened. >Using HexEdit, I noticed that all of the files are getting 0a added to >the beginning of them (happens with all browsers). > >I can look at the files with MySQL Query Browser and they don't have >the 0a. >Using php 4.3.11, Solaris 8, Apache 2.0.54, MySQL 4.1.11. > >Here's what I'm using: >mysql_select_db($database_ctnwww, $ctnwww); $query_Attachment = >sprintf("SELECT bin_data, filetype, filename, filesize FROM IssueAttach >WHERE id_files=%s", $_GET['id_files']); $Attachment = >mysql_query($query_Attachment, $ctnwww) or die(mysql_error()); >$row_Attachment = mysql_fetch_array($Attachment); > > $data = $row_Attachment['bin_data']; > $name = $row_Attachment['filename']; > $size = $row_Attachment['filesize']; > $type = $row_Attachment['filetype']; > > header("Content-type: $type"); > header("Content-length: $size"); > header("Content-Disposition: attachment; filename=$name"); > header("Content-Description: PHP Generated Data"); > echo $data; > >Thanks in advance, >Mickey > >-- >PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: >http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] help with file downloads from MySQL
I tried purposely corrupting the file by adding blank spaces at the beginning of the echo: echo " ",$data; The 0a was put in at the beginning again, followed by the spaces and then the file. Mickey -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 2:07 PM To: [EMAIL PROTECTED]; php-db@lists.php.net Subject: RE: [PHP-DB] help with file downloads from MySQL If you load the data into the field with addslashes, have you tried stripslashes on the way out? Bastien >From: "Mickey Martin" <[EMAIL PROTECTED]> >To: php-db@lists.php.net >Subject: [PHP-DB] help with file downloads from MySQL >Date: Tue, 21 Mar 2006 12:55:56 -0600 > >Every time I try to download a file from MySQL it cannot be opened. >Using HexEdit, I noticed that all of the files are getting 0a added to >the beginning of them (happens with all browsers). > >I can look at the files with MySQL Query Browser and they don't have >the 0a. >Using php 4.3.11, Solaris 8, Apache 2.0.54, MySQL 4.1.11. > >Here's what I'm using: >mysql_select_db($database_ctnwww, $ctnwww); $query_Attachment = >sprintf("SELECT bin_data, filetype, filename, filesize FROM IssueAttach >WHERE id_files=%s", $_GET['id_files']); $Attachment = >mysql_query($query_Attachment, $ctnwww) or die(mysql_error()); >$row_Attachment = mysql_fetch_array($Attachment); > > $data = $row_Attachment['bin_data']; > $name = $row_Attachment['filename']; > $size = $row_Attachment['filesize']; > $type = $row_Attachment['filetype']; > > header("Content-type: $type"); > header("Content-length: $size"); > header("Content-Disposition: attachment; filename=$name"); > header("Content-Description: PHP Generated Data"); > echo $data; > >Thanks in advance, >Mickey > >-- >PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: >http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] help with file downloads from MySQL
Here's the code I'm using to upload if it helps: "; echo "Continue"; } mysql_close(); } else { ?> -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 2:07 PM To: [EMAIL PROTECTED]; php-db@lists.php.net Subject: RE: [PHP-DB] help with file downloads from MySQL If you load the data into the field with addslashes, have you tried stripslashes on the way out? Bastien >From: "Mickey Martin" <[EMAIL PROTECTED]> >To: php-db@lists.php.net >Subject: [PHP-DB] help with file downloads from MySQL >Date: Tue, 21 Mar 2006 12:55:56 -0600 > >Every time I try to download a file from MySQL it cannot be opened. >Using HexEdit, I noticed that all of the files are getting 0a added to >the beginning of them (happens with all browsers). > >I can look at the files with MySQL Query Browser and they don't have >the 0a. >Using php 4.3.11, Solaris 8, Apache 2.0.54, MySQL 4.1.11. > >Here's what I'm using: >mysql_select_db($database_ctnwww, $ctnwww); $query_Attachment = >sprintf("SELECT bin_data, filetype, filename, filesize FROM IssueAttach >WHERE id_files=%s", $_GET['id_files']); $Attachment = >mysql_query($query_Attachment, $ctnwww) or die(mysql_error()); >$row_Attachment = mysql_fetch_array($Attachment); > > $data = $row_Attachment['bin_data']; > $name = $row_Attachment['filename']; > $size = $row_Attachment['filesize']; > $type = $row_Attachment['filetype']; > > header("Content-type: $type"); > header("Content-length: $size"); > header("Content-Disposition: attachment; filename=$name"); > header("Content-Description: PHP Generated Data"); > echo $data; > >Thanks in advance, >Mickey > >-- >PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: >http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] help with file downloads from MySQL
Stripslashes causes the download to hang. I've also tried with base64_encode on the upload and base64_decode on the download with the same results. -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 2:07 PM To: [EMAIL PROTECTED]; php-db@lists.php.net Subject: RE: [PHP-DB] help with file downloads from MySQL If you load the data into the field with addslashes, have you tried stripslashes on the way out? Bastien >From: "Mickey Martin" <[EMAIL PROTECTED]> >To: php-db@lists.php.net >Subject: [PHP-DB] help with file downloads from MySQL >Date: Tue, 21 Mar 2006 12:55:56 -0600 > >Every time I try to download a file from MySQL it cannot be opened. >Using HexEdit, I noticed that all of the files are getting 0a added to >the beginning of them (happens with all browsers). > >I can look at the files with MySQL Query Browser and they don't have >the 0a. >Using php 4.3.11, Solaris 8, Apache 2.0.54, MySQL 4.1.11. > >Here's what I'm using: >mysql_select_db($database_ctnwww, $ctnwww); $query_Attachment = >sprintf("SELECT bin_data, filetype, filename, filesize FROM IssueAttach >WHERE id_files=%s", $_GET['id_files']); $Attachment = >mysql_query($query_Attachment, $ctnwww) or die(mysql_error()); >$row_Attachment = mysql_fetch_array($Attachment); > > $data = $row_Attachment['bin_data']; > $name = $row_Attachment['filename']; > $size = $row_Attachment['filesize']; > $type = $row_Attachment['filetype']; > > header("Content-type: $type"); > header("Content-length: $size"); > header("Content-Disposition: attachment; filename=$name"); > header("Content-Description: PHP Generated Data"); > echo $data; > >Thanks in advance, >Mickey > >-- >PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: >http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] help with file downloads from MySQL
If you load the data into the field with addslashes, have you tried stripslashes on the way out? Bastien From: "Mickey Martin" <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] help with file downloads from MySQL Date: Tue, 21 Mar 2006 12:55:56 -0600 Every time I try to download a file from MySQL it cannot be opened. Using HexEdit, I noticed that all of the files are getting 0a added to the beginning of them (happens with all browsers). I can look at the files with MySQL Query Browser and they don't have the 0a. Using php 4.3.11, Solaris 8, Apache 2.0.54, MySQL 4.1.11. Here's what I'm using: mysql_select_db($database_ctnwww, $ctnwww); $query_Attachment = sprintf("SELECT bin_data, filetype, filename, filesize FROM IssueAttach WHERE id_files=%s", $_GET['id_files']); $Attachment = mysql_query($query_Attachment, $ctnwww) or die(mysql_error()); $row_Attachment = mysql_fetch_array($Attachment); $data = $row_Attachment['bin_data']; $name = $row_Attachment['filename']; $size = $row_Attachment['filesize']; $type = $row_Attachment['filetype']; header("Content-type: $type"); header("Content-length: $size"); header("Content-Disposition: attachment; filename=$name"); header("Content-Description: PHP Generated Data"); echo $data; Thanks in advance, Mickey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help needed creating a social network
My first thought was recursion - repeat the call for each element of the result set, numbering each so you can find each level, until nothing is returned. That would probably work, but oh, what a mess. That triggered something ... off to consult Joe Celko's SQL for Smarties. He has a whole chapter on Trees, and guess what: they're not easily done in relational databases. To try and condense it here would be, shall we say, impractical. Check with a library, or try googling for trees -- hey, look what turned up: http://www.dbmsmag.com/9603d06.html by JC himself. Have fun - Miles Thompson At 03:19 PM 3/7/2006, Daevid Vincent wrote: Thanks for the reply. However, that only gives me a single degree. I'm looking for the way to traverse a 'tree' to see who is in your extended networks, so I can do things like: You are 4 degrees away from Sam: You know bob who knows john who knows carrol who knows Sam. Sam <- carrol <- john <- bob <- you Etc. > -Original Message- > From: Micah Stevens [mailto:[EMAIL PROTECTED] > Sent: Monday, March 06, 2006 10:28 PM > To: php-db@lists.php.net > Subject: Re: [PHP-DB] Help needed creating a social network > > > CREATE TABLE `users` (userID int(11) not null auto_increment, primary > key(userID), name tinytext not null, email tinytext not null); > > CREATE TABLE `links` (userID int(11), key (userID), friendID int(11), > key(friendID)); > > $friends = mysql_query("select users.name, users.userID from > users left join > links on links.friendID = users.userID where links.userID = > {$_GET['userID']}"); > > echo "You have friends!!"; > while ($f = mysql_fetch_assoc($friends)) { > echo " href='socialnetwork.php?userID={$f['userID']}'>{$f['name']} >\n"; > } > > publish(); > profit($greatly); > do (!$use) { > coldfusion('Cause it sucks'); > } > ?> > > (har har) > > > > > > > > On Monday 06 March 2006 9:47 pm, Daevid Vincent wrote: > > Anyone have some pointers at a HowTo on creating a social network? > > > > Basically I need to show people in your immediate network, > and also friends > > of your friends, etc... Like the whole 'six degrees of > separation' thing. > > Ala: myspace, friendster, etc. ad nauseum. > > > > I prefer mySQL and PHP, but I could port from most any > code. I guess I'm > > mostly interested in the theory of this an how do I set up > the tables > > properly and what is the magic incantation (JOIN) to get > this "chain" of > > people. > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 268.2.0/275 - Release Date: 3/6/2006 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help needed creating a social network
Thanks for the reply. However, that only gives me a single degree. I'm looking for the way to traverse a 'tree' to see who is in your extended networks, so I can do things like: You are 4 degrees away from Sam: You know bob who knows john who knows carrol who knows Sam. Sam <- carrol <- john <- bob <- you Etc. > -Original Message- > From: Micah Stevens [mailto:[EMAIL PROTECTED] > Sent: Monday, March 06, 2006 10:28 PM > To: php-db@lists.php.net > Subject: Re: [PHP-DB] Help needed creating a social network > > > CREATE TABLE `users` (userID int(11) not null auto_increment, primary > key(userID), name tinytext not null, email tinytext not null); > > CREATE TABLE `links` (userID int(11), key (userID), friendID int(11), > key(friendID)); > > $friends = mysql_query("select users.name, users.userID from > users left join > links on links.friendID = users.userID where links.userID = > {$_GET['userID']}"); > > echo "You have friends!!"; > while ($f = mysql_fetch_assoc($friends)) { > echo " href='socialnetwork.php?userID={$f['userID']}'>{$f['name']} >\n"; > } > > publish(); > profit($greatly); > do (!$use) { > coldfusion('Cause it sucks'); > } > ?> > > (har har) > > > > > > > > On Monday 06 March 2006 9:47 pm, Daevid Vincent wrote: > > Anyone have some pointers at a HowTo on creating a social network? > > > > Basically I need to show people in your immediate network, > and also friends > > of your friends, etc... Like the whole 'six degrees of > separation' thing. > > Ala: myspace, friendster, etc. ad nauseum. > > > > I prefer mySQL and PHP, but I could port from most any > code. I guess I'm > > mostly interested in the theory of this an how do I set up > the tables > > properly and what is the magic incantation (JOIN) to get > this "chain" of > > people. > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help needed creating a social network
CREATE TABLE `users` (userID int(11) not null auto_increment, primary key(userID), name tinytext not null, email tinytext not null); CREATE TABLE `links` (userID int(11), key (userID), friendID int(11), key(friendID)); You have friends!!"; while ($f = mysql_fetch_assoc($friends)) { echo "{$f['name']}\n"; } publish(); profit($greatly); do (!$use) { coldfusion('Cause it sucks'); } ?> (har har) On Monday 06 March 2006 9:47 pm, Daevid Vincent wrote: > Anyone have some pointers at a HowTo on creating a social network? > > Basically I need to show people in your immediate network, and also friends > of your friends, etc... Like the whole 'six degrees of separation' thing. > Ala: myspace, friendster, etc. ad nauseum. > > I prefer mySQL and PHP, but I could port from most any code. I guess I'm > mostly interested in the theory of this an how do I set up the tables > properly and what is the magic incantation (JOIN) to get this "chain" of > people. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help Needed with malfunctioning query
On 26/02/2006 3:03 PM, Chris Payne wrote: Hi there everyone, This line of code USED TO WORK but now it gives me a Coudln't Execute Query error: $query2 = "SELECT word,def,photo MATCH(word,def) AGAINST ('$txtsearchword' IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST ('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage"; I tried it with a basic $query2 = "SELECT * FROM dictionary"; to make sure it wasn't something else that was broke and this is the problem above, it used to work great and now it's on a live site after working great for 6 months and it suddenly doesn't work and I haven't touched anything !!! the server hasn't been updated so it's not that as it also does the same on my local dev machine here, the only thing that happened was my co-worker did a global find and replace with dreamweaver but that's all and I can't personally see anything wrong with the above though I could be looking too hard. Should there be a comma between 'photo' and 'MATCH(word, def) etc'? As in: $query2 = "SELECT word,def,photo, MATCH(word,def) AGAINST ('$txtsearchword' IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST ('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage"; Much warmth, planetthoughtful --- "Lost in thought" http://www.planetthoughtful.org "Urban legends, superstitions, ghost stories and folklore" http://www.ulblog.org -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help Needed with malfunctioning query
Hi there, I'm using asd just to test the search, here's the output from the statement echoed to the screen: SELECT word,def,photo, if(locate('asd',word),1,2) as meFirst ,MATCH(word,def) AGAINST ('asd' IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST ('asd' IN BOOLEAN MODE) ORDER BY meFirst, word LIMIT 0, 25 Chris >This line of code USED TO WORK but now it gives me a Coudln't Execute >Query >error: > >$query2 = "SELECT word,def,photo MATCH(word,def) AGAINST >('$txtsearchword' >IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST >('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage"; What is the exact error phrase? Did you echo the $sql statement so you can see if the variables are correct? -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.1.0/269 - Release Date: 2/24/2006 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with Variable Variables in Array
Thanks so much, Naintara, simplifying the field name in the way you suggested seems to fix it. Andrew On 2/20/06, Naintara <[EMAIL PROTECTED]> wrote: > Hi, > > Firstly, if you are assigning the value of variable $myrow['article_title'] > to $right_row, > you should print $right_row and not $$right_row > > Because, if say, $myrow['article_title'] contained value "article1", > $$right_row would look for variable > $article1, which probably doesn't exist, hence no value. > > You could also try creating your field name simpler, something like: > $tmp_fldname = $type . "_title'; > $right_row = $myrow[$tmp_fldname]; > > This should work, I haven't tested it. > > Naintara > > -Original Message- > From: Andrew Darby [mailto:[EMAIL PROTECTED] > Sent: Monday, February 20, 2006 10:19 PM > To: php-db@lists.php.net > Subject: [PHP-DB] Help with Variable Variables in Array > > Hi, all. I can't quite figure out how to call the contents of a > variable variable in a mysql_fetch_array result and was hoping someone > could help . . . > > inside the "fetch all rows" while loop, i have the following: > > $right_row = "$" . myrow . "['" . $type . "_title']"; > > ($type is assigned elsewhere, but in this case = 'article') > > which outputs: > > $myrow['article_title'] > > So far so good, but i can't seem to output the value of this variable > by printing > > $$right_row > > Any suggestions? > > TIA, > > Andrew > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17-Feb-06 > > > -- > No virus found in this outgoing message. > Checked by AVG Free Edition. > Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17-Feb-06 > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help with Variable Variables in Array
Hi, Firstly, if you are assigning the value of variable $myrow['article_title'] to $right_row, you should print $right_row and not $$right_row Because, if say, $myrow['article_title'] contained value "article1", $$right_row would look for variable $article1, which probably doesn't exist, hence no value. You could also try creating your field name simpler, something like: $tmp_fldname = $type . "_title'; $right_row = $myrow[$tmp_fldname]; This should work, I haven't tested it. Naintara -Original Message- From: Andrew Darby [mailto:[EMAIL PROTECTED] Sent: Monday, February 20, 2006 10:19 PM To: php-db@lists.php.net Subject: [PHP-DB] Help with Variable Variables in Array Hi, all. I can't quite figure out how to call the contents of a variable variable in a mysql_fetch_array result and was hoping someone could help . . . inside the "fetch all rows" while loop, i have the following: $right_row = "$" . myrow . "['" . $type . "_title']"; ($type is assigned elsewhere, but in this case = 'article') which outputs: $myrow['article_title'] So far so good, but i can't seem to output the value of this variable by printing $$right_row Any suggestions? TIA, Andrew -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17-Feb-06 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17-Feb-06 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP-DB] Help getting php up and running
Is the file you are trying to save parsed php? If it is parsed, I have no Idea what your problem is, but its probably not apache-php. otherwise, Its possible, you need to add handlers in your apache conf to instruct apache to run .php files as php something like AddType application/x-httpd-php .php >Anyone have any input? I am googling till my fingers hurt and everything I >find says it should be running. Whenever I try to open a test.php file all I >get is the web browswer trying to save the file instead of serving up the php >content. > >On Friday 10 February 2006 21:28, CasperLinux wrote: >> I run a Debian unstable system with apache 1.3 installed. I had PHP >> installed and running then tried to install Acid/Base for Snort. That >> installation did not work properly so I attempted to remove the components >> but then I lost php support. I removed all the PHP files and reattemtped >> to install. No joy. Anyone have any ideas of what may be an issue. >> >> I have the following installed >> >> ii libapache-mod-php44.4.2-1 >> server-side, HTML-embedded scripting languag >> rc libapache2-mod-php5 5.0.5-3 >> server-side, HTML-embedded scripting languag >> ii php4 4.4.2-1 >> server-side, HTML-embedded scripting languag >> ii php4-common 4.4.2-1 Common >> files for packages built from the php >> ii php4-mysql4.4.2-1 MySQL >> module for php4 >> >> And this is my modules.conf >> >> ClearModuleList >> AddModule mod_so.c >> AddModule mod_macro.c >> LoadModule config_log_module /usr/lib/apache/1.3/mod_log_config.so >> LoadModule mime_magic_module /usr/lib/apache/1.3/mod_mime_magic.so >> LoadModule mime_module /usr/lib/apache/1.3/mod_mime.so >> LoadModule negotiation_module /usr/lib/apache/1.3/mod_negotiation.so >> LoadModule status_module /usr/lib/apache/1.3/mod_status.so >> LoadModule autoindex_module /usr/lib/apache/1.3/mod_autoindex.so >> LoadModule dir_module /usr/lib/apache/1.3/mod_dir.so >> LoadModule cgi_module /usr/lib/apache/1.3/mod_cgi.so >> LoadModule userdir_module /usr/lib/apache/1.3/mod_userdir.so >> LoadModule alias_module /usr/lib/apache/1.3/mod_alias.so >> LoadModule rewrite_module /usr/lib/apache/1.3/mod_rewrite.so >> LoadModule access_module /usr/lib/apache/1.3/mod_access.so >> LoadModule auth_module /usr/lib/apache/1.3/mod_auth.so >> LoadModule expires_module /usr/lib/apache/1.3/mod_expires.so >> LoadModule setenvif_module /usr/lib/apache/1.3/mod_setenvif.so >> LoadModule perl_module /usr/lib/apache/1.3/mod_perl.so >> LoadModule includes_module /usr/lib/apache/1.3/mod_include.so >> LoadModule includes_module /usr/lib/apache2/modules/libphp4.so >> >> For the life of me I can't figure out why following the instructions won't >> get this up and running this time. I think I'm missing a file somewhere. >> >> Don >> >> -- >> - Powered by Debian Linux - >> >> --- >> >> -- >> - Powered by Debian Linux - > >-- >- Powered by Debian Linux - > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > >. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help getting php up and running
Anyone have any input? I am googling till my fingers hurt and everything I find says it should be running. Whenever I try to open a test.php file all I get is the web browswer trying to save the file instead of serving up the php content. On Friday 10 February 2006 21:28, CasperLinux wrote: > I run a Debian unstable system with apache 1.3 installed. I had PHP > installed and running then tried to install Acid/Base for Snort. That > installation did not work properly so I attempted to remove the components > but then I lost php support. I removed all the PHP files and reattemtped > to install. No joy. Anyone have any ideas of what may be an issue. > > I have the following installed > > ii libapache-mod-php44.4.2-1 > server-side, HTML-embedded scripting languag > rc libapache2-mod-php5 5.0.5-3 > server-side, HTML-embedded scripting languag > ii php4 4.4.2-1 > server-side, HTML-embedded scripting languag > ii php4-common 4.4.2-1 Common > files for packages built from the php > ii php4-mysql4.4.2-1 MySQL > module for php4 > > And this is my modules.conf > > ClearModuleList > AddModule mod_so.c > AddModule mod_macro.c > LoadModule config_log_module /usr/lib/apache/1.3/mod_log_config.so > LoadModule mime_magic_module /usr/lib/apache/1.3/mod_mime_magic.so > LoadModule mime_module /usr/lib/apache/1.3/mod_mime.so > LoadModule negotiation_module /usr/lib/apache/1.3/mod_negotiation.so > LoadModule status_module /usr/lib/apache/1.3/mod_status.so > LoadModule autoindex_module /usr/lib/apache/1.3/mod_autoindex.so > LoadModule dir_module /usr/lib/apache/1.3/mod_dir.so > LoadModule cgi_module /usr/lib/apache/1.3/mod_cgi.so > LoadModule userdir_module /usr/lib/apache/1.3/mod_userdir.so > LoadModule alias_module /usr/lib/apache/1.3/mod_alias.so > LoadModule rewrite_module /usr/lib/apache/1.3/mod_rewrite.so > LoadModule access_module /usr/lib/apache/1.3/mod_access.so > LoadModule auth_module /usr/lib/apache/1.3/mod_auth.so > LoadModule expires_module /usr/lib/apache/1.3/mod_expires.so > LoadModule setenvif_module /usr/lib/apache/1.3/mod_setenvif.so > LoadModule perl_module /usr/lib/apache/1.3/mod_perl.so > LoadModule includes_module /usr/lib/apache/1.3/mod_include.so > LoadModule includes_module /usr/lib/apache2/modules/libphp4.so > > For the life of me I can't figure out why following the instructions won't > get this up and running this time. I think I'm missing a file somewhere. > > Don > > -- > - Powered by Debian Linux - > > --- > > -- > - Powered by Debian Linux - -- - Powered by Debian Linux - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help need please?
Hi, Thanks for this, got a few reposnses regarding this. This seems a more professional approach, I will try this and let you know about it when I do it. Thanks for your time. Jerry Ross Honniball <[EMAIL PROTECTED]> wrote: Get rid of both your onload= statements and replace with... window.onload=doboth Then include the function below... function doboth() { changetext(); changead(); } Not sure what you were getting at regarding the " thing, but I think the browser must just over-ride the previous onload statement when more than one is provided. I'm guessing the " thing you were talking about accidently commented one out and activated the other. Hope this helps. Ross JeRRy wrote: > Hi, > > I know this is not PHP/MySQl related but every other board I have posted on I > have not got a response, so I'll try here also. I'm missing something basic, > surely here so that is another reason I am posting here.. > > Here goes... > > I have two lots of code here, one is for a refreshing text code in Javascript > and another is a banner refreshing ad system. > > Using similiar technequies. > > But I can only get the refreshing text to appear but can't get the ads to > work on the one page. :( > > But if I add a " in any text area of the text refreshing than the ads system > works but the text refreshing don't. But if I remove the " from any text area > the text refreshing works but the ads don't. I can't seem to find the problem. > > Here is the code(s) > > ads code > > > > hexinput=255 // Initial color value. > var inc=-1 //increment variable > function fadingad(){ > if(hexinput>0) { > hexinput-=11; // increase color value > document.getElementById("fader1").style.color="rgb("+hexinput+","+hexinput+","+hexinput+")"; > // Set color value. > setTimeout("fadingad()",20); > } > else > hexinput=255 //reset hex value > } > function changead(){ > if (!document.getElementById) return > inc++ > if (inc==0) > document.getElementById("fader1").innerHTML="" > else if (inc==1) > document.getElementById("fader1").innerHTML="" > else if (inc==2) > document.getElementById("fader1").innerHTML="" > else if (inc==3) > document.getElementById("fader1").innerHTML="" > else if (inc==4) > document.getElementById("fader1").innerHTML="" > else if (inc==5) > document.getElementById("fader1").innerHTML="" > else if (inc==6) > document.getElementById("fader1").innerHTML="" > else{ > document.getElementById("fader1").innerHTML="" > inc=-1 > } > fadingad() > setTimeout("changead()",4000) > } > window.onload=changead > > > > > end ads code > > text refreshing > > > hexinput=255 // Initial color value. > var inc=-1 //increment variable > function fadingtext(){ > if(hexinput>0) { > hexinput-=11; // increase color value > document.getElementById("fader").style.color="rgb("+hexinput+","+hexinput+","+hexinput+")"; > // Set color value. > setTimeout("fadingtext()",20); > } > else > hexinput=255 //reset hex value > } > function changetext(){ > if (!document.getElementById) return > inc++ > if (inc==0) > document.getElementById("fader").innerHTML="Soon to be Released" > else if (inc==1) > document.getElementById("fader").innerHTML="What you really need to know > about Testing and Tagging" > else if (inc==2) > document.getElementById("fader").innerHTML="250 Pages of jam-packed reality > testing regimes that will maintain a safer working environment for all" > else if (inc==3) > document.getElementById("fader").innerHTML="Learn what's it all about before > they come and do it for you - A must read for all Clients, Employers, > Electricians and Competent Persons" > else if (inc==4) > document.getElementById("fader").innerHTML="Just when you thought you knew > what testing and tagging was all about - along comes a book!" > else if (inc==5) > document.getElementById("fader").innerHTML="Memberships available" > else if (inc==6) > document.getElementById("fader").innerHTML="Are you really doing it right?" > else{ > document.getElementById("fader").innerHTML="Pre-order and Save" > inc=-1 > } > fadingtext() > setTimeout("changetext()",8000) > } > window.onload=changetext > > > > end of text refreshing > > Any help would be awsome, or solutions? > > Jerry > > > > - > Do you Yahoo!? > Messenger 7.0: Free worldwide PC to PC calls - Do you Yahoo!? Yahoo! News: Get the latest news via video today!
Re: [PHP-DB] Help need please?
Get rid of both your onload= statements and replace with... window.onload=doboth Then include the function below... function doboth() { changetext(); changead(); } Not sure what you were getting at regarding the " thing, but I think the browser must just over-ride the previous onload statement when more than one is provided. I'm guessing the " thing you were talking about accidently commented one out and activated the other. Hope this helps. Ross JeRRy wrote: Hi, I know this is not PHP/MySQl related but every other board I have posted on I have not got a response, so I'll try here also. I'm missing something basic, surely here so that is another reason I am posting here.. Here goes... I have two lots of code here, one is for a refreshing text code in Javascript and another is a banner refreshing ad system. Using similiar technequies. But I can only get the refreshing text to appear but can't get the ads to work on the one page. :( But if I add a " in any text area of the text refreshing than the ads system works but the text refreshing don't. But if I remove the " from any text area the text refreshing works but the ads don't. I can't seem to find the problem. Here is the code(s) ads code hexinput=255 // Initial color value. var inc=-1 //increment variablefunction fadingad(){ if(hexinput>0) { hexinput-=11; // increase color valuedocument.getElementById("fader1").style.color="rgb("+hexinput+","+hexinput+","+hexinput+")"; // Set color value.setTimeout("fadingad()",20); }else hexinput=255 //reset hex value } function changead(){ if (!document.getElementById) return inc++ if (inc==0) document.getElementById("fader1").innerHTML="" else if (inc==1) document.getElementById("fader1").innerHTML="" else if (inc==2) document.getElementById("fader1").innerHTML="" else if (inc==3) document.getElementById("fader1").innerHTML="" else if (inc==4) document.getElementById("fader1").innerHTML="" else if (inc==5) document.getElementById("fader1").innerHTML="" else if (inc==6) document.getElementById("fader1").innerHTML="" else{ document.getElementById("fader1").innerHTML="" inc=-1 } fadingad() setTimeout("changead()",4000) } window.onload=changead end ads code text refreshinghexinput=255 // Initial color value. var inc=-1 //increment variablefunction fadingtext(){ if(hexinput>0) { hexinput-=11; // increase color valuedocument.getElementById("fader").style.color="rgb("+hexinput+","+hexinput+","+hexinput+")"; // Set color value.setTimeout("fadingtext()",20); }else hexinput=255 //reset hex value } function changetext(){ if (!document.getElementById) return inc++ if (inc==0) document.getElementById("fader").innerHTML="Soon to be Released" else if (inc==1) document.getElementById("fader").innerHTML="What you really need to know about Testing and Tagging" else if (inc==2) document.getElementById("fader").innerHTML="250 Pages of jam-packed reality testing regimes that will maintain a safer working environment for all" else if (inc==3) document.getElementById("fader").innerHTML="Learn what's it all about before they come and do it for you - A must read for all Clients, Employers, Electricians and Competent Persons" else if (inc==4) document.getElementById("fader").innerHTML="Just when you thought you knew what testing and tagging was all about - along comes a book!" else if (inc==5) document.getElementById("fader").innerHTML="Memberships available" else if (inc==6) document.getElementById("fader").innerHTML="Are you really doing it right?" else{ document.getElementById("fader").innerHTML="Pre-order and Save" inc=-1 } fadingtext() setTimeout("changetext()",8000) } window.onload=changetext end of text refreshing Any help would be awsome, or solutions? Jerry - Do you Yahoo!? Messenger 7.0: Free worldwide PC to PC calls -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with
Martin is right... carefully~ @ $db = new mysqli('localhost', 'root', 'password', 'database_table'); On 8/30/05, Richard Hart <[EMAIL PROTECTED]> wrote: > > Hi > > I'm new to PHP/MySQL and wondered if anyone on this list would be kind > enough to help me solve > this problem. I'm trying to automatically set up a users privileges on a > MySQL table using the > username and password selected by them in an html form. I get the error > message: > > "Warning: mysql_query(): supplied argument is not a valid MySQL-Link > resource" > > for the code below: > > > $username=$_POST['username']; > $password=$_POST['password']; > > @ $db = new mysqli('localhost', 'root', 'password', 'database_table'); > > if (mysqli_connect_errno()) > { > echo 'Error: Could not connect to database. Please try again later.'; > exit; > } > > $grant_privilege = "grant select, insert, delete, update on name_of_table > to > $username identified by '$password'"; > mysql_query($grant_privilege, $db); > > $db->close(); > > ?> > > Can anyone help? > > Thanks > > Richard > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- >From : Fen lu
RE: [PHP-DB] Help with
Don't mix mysql_ functions with mysqli_ functions, and you'll have much greater successes. $dbcon = mysql_connect( 'localhost', 'root', 'password', 'database_name' ); should be $dbcon = mysqli_connect( 'localhost', 'root', 'password', 'database_name' ); Cheers, - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -Original Message- From: Richard Hart [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 30, 2005 12:06 PM To: Bastien Koert; php-db@lists.php.net Subject: RE: [PHP-DB] Help with. . Thanks for your help Bastien. I have changed the authentication procedure but have come up against another problem. This time I am allowing the users to choose their unique usernames and passwords which will be stored in a mysql database. However when I check to see if their details exist in the databse I get: Warning: mysqli_query() expects parameter 1 to be mysqli, resource given in login.php any help would be appreciated. Here is the code: $username=$_POST['l_username']; $password=$_POST['l_password']; // connect to mysql $dbcon = mysql_connect( 'localhost', 'root', 'password', 'database_name' ); if (!$dbcon) { echo 'Cannot connect to the database.'; exit; } // query the database to see if there is a matching username and password $query = "select count(*) from users where username = '$username' and password = '$password'"; $result = mysqli_query($dbcon, $query); if (!$result) { echo 'Sorry can't run query'; exit; } $row = mysqli_fetch_row($result); $count = $row[0]; if ($count > 0) { echo 'You have successfully logged on.'; } else { echo "Your username and/or password have not been accepted. Please go back and try again."; } Thanks Richard -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: 30 August 2005 00:59 To: [EMAIL PROTECTED]; php-db@lists.php.net Subject: RE: [PHP-DB] Help with you don't have a connection to the db...either because the name.password, db name are wrong or you lack the needed permissions to allow the query... note that this query is a really back idea...opens the whole db up...better to provide one connection and allow the users basic read write access only bastien >From: "Richard Hart" <[EMAIL PROTECTED]> >To: >Subject: [PHP-DB] Help with Date: Mon, 29 Aug 2005 23:27:46 +0100 > >Hi > >I'm new to PHP/MySQL and wondered if anyone on this list would be kind >enough to help me solve >this problem. I'm trying to automatically set up a users privileges on a >MySQL table using the >username and password selected by them in an html form. I get the error >message: > >"Warning: mysql_query(): supplied argument is not a valid MySQL-Link >resource" > >for the code below: > > >$username=$_POST['username']; >$password=$_POST['password']; > >@ $db = new mysqli('localhost', 'root', 'password', 'database_table'); > >if (mysqli_connect_errno()) >{ > echo 'Error: Could not connect to database. Please try again later.'; > exit; >} > >$grant_privilege = "grant select, insert, delete, update on name_of_table >to >$username identified by '$password'"; >mysql_query($grant_privilege, $db); > >$db->close(); > >?> > >Can anyone help? > >Thanks > >Richard > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help with
Thanks for your help Bastien. I have changed the authentication procedure but have come up against another problem. This time I am allowing the users to choose their unique usernames and passwords which will be stored in a mysql database. However when I check to see if their details exist in the databse I get: Warning: mysqli_query() expects parameter 1 to be mysqli, resource given in login.php any help would be appreciated. Here is the code: $username=$_POST['l_username']; $password=$_POST['l_password']; // connect to mysql $dbcon = mysql_connect( 'localhost', 'root', 'password', 'database_name' ); if (!$dbcon) { echo 'Cannot connect to the database.'; exit; } // query the database to see if there is a matching username and password $query = "select count(*) from users where username = '$username' and password = '$password'"; $result = mysqli_query($dbcon, $query); if (!$result) { echo 'Sorry can't run query'; exit; } $row = mysqli_fetch_row($result); $count = $row[0]; if ($count > 0) { echo 'You have successfully logged on.'; } else { echo "Your username and/or password have not been accepted. Please go back and try again."; } Thanks Richard -Original Message----- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: 30 August 2005 00:59 To: [EMAIL PROTECTED]; php-db@lists.php.net Subject: RE: [PHP-DB] Help with you don't have a connection to the db...either because the name.password, db name are wrong or you lack the needed permissions to allow the query... note that this query is a really back idea...opens the whole db up...better to provide one connection and allow the users basic read write access only bastien >From: "Richard Hart" <[EMAIL PROTECTED]> >To: >Subject: [PHP-DB] Help with Date: Mon, 29 Aug 2005 23:27:46 +0100 > >Hi > >I'm new to PHP/MySQL and wondered if anyone on this list would be kind >enough to help me solve >this problem. I'm trying to automatically set up a users privileges on a >MySQL table using the >username and password selected by them in an html form. I get the error >message: > >"Warning: mysql_query(): supplied argument is not a valid MySQL-Link >resource" > >for the code below: > > >$username=$_POST['username']; >$password=$_POST['password']; > >@ $db = new mysqli('localhost', 'root', 'password', 'database_table'); > >if (mysqli_connect_errno()) >{ > echo 'Error: Could not connect to database. Please try again later.'; > exit; >} > >$grant_privilege = "grant select, insert, delete, update on name_of_table >to >$username identified by '$password'"; >mysql_query($grant_privilege, $db); > >$db->close(); > >?> > >Can anyone help? > >Thanks > >Richard > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help with
you don't have a connection to the db...either because the name.password, db name are wrong or you lack the needed permissions to allow the query... note that this query is a really back idea...opens the whole db up...better to provide one connection and allow the users basic read write access only bastien From: "Richard Hart" <[EMAIL PROTECTED]> To: Subject: [PHP-DB] Help with Date: Mon, 29 Aug 2005 23:27:46 +0100 Hi I'm new to PHP/MySQL and wondered if anyone on this list would be kind enough to help me solve this problem. I'm trying to automatically set up a users privileges on a MySQL table using the username and password selected by them in an html form. I get the error message: "Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource" for the code below: $grant_privilege = "grant select, insert, delete, update on name_of_table to $username identified by '$password'"; mysql_query($grant_privilege, $db); $db->close(); ?> Can anyone help? Thanks Richard -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help Needed
You ROCK!!! Thanks so much, this worked perfectly!!! Thanks -Rich -Original Message- From: Alain Rivest [mailto:[EMAIL PROTECTED] Sent: Friday, July 29, 2005 10:10 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] Help Needed ReClMaples a écrit : >Sorry, the data under 'Looking something like this' should be in a table >format with 3 columns and 4 rows. > >-Original Message- >From: ReClMaples [mailto:[EMAIL PROTECTED] >Sent: Friday, July 29, 2005 8:46 PM >To: PHP >Subject: [PHP-DB] Help Needed > >All, > > I know this is the wrong distro to be sending this request for help to >but I don't know which one to send this to. If you could either point me in >the direction that I should go or help me, I would greatly appreciate it. > >Here is my issue. > >I have a set of date that I want returned in 3 columns and an unspecified >number of rows (dependent on the number of records returned). I cannot for >the life of me figure out how to do this. > > > You can do something like this : $i = 0 ; echo ""; while (fetch...) { echo "$your_data" ; // every 3 row if ($i % 3 == 0) echo "" ; $i ++ ; } echo "" ; I know it's not perfect, I'll let you rewrite it more elegantly... -- Alain -- http://www.vivahate.org -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php