Re: [PHP] Nested mysql_query()'s
No need for another connect as long as selecting from same server as the same user. Perhaps there are no bids for some of the lot_id's? Perhaps you do not care that there are bids returned and want to shut mysql_num_rows up by prepending the @ sign in front of it. Like @mysql_num_rows($bid_result) James On Tuesday 01 July 2003 05:53 pm, Sparky Kopetzky wrote: > Hi! > > I've got two nested queries where one looks up data based on values > returned from the first. > > $lot_query = "SELECT * FROM LOT WHERE lot_category_id=" . $lot_category > . " AND lot_close_time>" . time(); > $lot_result = mysql_query($lot_query, $CONNECT_ID); > > if ($lot_result) > { > while ($row = mysql_fetch_array($lot_result)) > { > blah-blah-blah... > > $bid_query = "select * from bids where bid_lot_id=" . $lot_id . > " order by bid_amount"; > $bid_result = mysql_query($bid_query, $CONNECT_ID); > $bid_count = mysql_num_rows($bid_result); > > blah-blah-blah... > > I get this error message: "Warning: mysql_num_rows(): supplied argument is > not a valid MySQL result resource " from the second query. Do I need a > second $CONNECT_ID for a second link to mysql_query #2?? > > Robin E. Kopetzky > Black Mesa Computers/Internet Services > www.blackmesa-isp.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Very Weird Problem Continued
The following variable needs to be escaped before it can be submitted as an MySQL query. It seems that the \0 in this string is causing me the problem. I have tried several functions in an attempt to escape this variable. Anybody got any other suggestions. The resulting string should look like this: EBCO\\030774-006\\BUBBLER VALVE $variable = "EBCO\030774-006\BUBBLER VALVE"; Things I have tried so far that do not work. Every one of the following functions results in \030 being replaced with a weird character. echo addslashes($variable); echo str_replace("\","\\",$variable); echo mysql_escape_string($variable); Here is the result of all of the above functions ( notice weird character after EBCO and that all the functions successfully escape the second \ character in between the 6 and the B in BUBBLER): EBCO▒774-006\\BUBBLER VALVE James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Capturing the input of dynamic form fields (part II)
Whenever I am having problems with SQL queries I always display the query on the page with all the replaced variables so I can make sure that the query makes sense. If it passes the MySQL parser in my brain and still doesn't work, I will copy the displayed query into the command line mysql monitor (or phpmyadmin) and try the command manually to see what happens. I also found it easier to solve my SQL problems by not using "or die " and just displaying some information about the problem query. This way I know something is wrong if the third line of the echo is not at least 1. $query="INSERT INTO test (test1, test2) VALUES ('$_POST['test1']','$_POST['test2']')"; $result = mysql_query($query); echo(mysql_error()."$query".mysql_affected_rows($result)); James On Sunday 15 June 2003 09:39 am, Frank Keessen wrote: > Dear all, > > Refering to my first e-mail with the same subject; I've reworked the code > to this: > > But the only problem is; Nothing is written into the mysql database! And > there are no error displayed.. > > Can someone have a look at my code? > > $_REQUEST["submit"]=isset($_REQUEST["submit"])?$_REQUEST["submit"]:""; > if($_REQUEST['submit']!="") > { > for($i=0;$i $query="INSERT INTO test (test1, test2) VALUES > ('$_POST['test1']','$_POST['test2']')"; $result = mysql_query($query) or > die ("Error in query: $query. " . mysql_error()); } > } > ?> > action=""> for ($i=1; $i<=2; $i++) > { > echo "# $i"; > echo "# $i"; > > } > > ?> > > > > Thanks very much, > > Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: interact with .htaccess
I think what you really want to do is place your downloadable files in a directory that is not in your httpd's document root and use a password protected PHP script to access these files and send them to the user after authentication. I think you could accomplish this with the fpassthru() function and the correct header. htaccess is just going to get in your way. You've got to make sure that the user that your httpd runs as has permission to access /path/to/directory/not/in/httpd/doc/root/ James On Sunday 15 June 2003 10:32 am, Peter Berglund wrote: > ok, I change my question, how do I protect downloadable files from users > that are not valid? > without the use of htaccess? > > "Peter Berglund" <[EMAIL PROTECTED]> skrev i meddelandet > news:[EMAIL PROTECTED] > > > I want to send user and password from php to a protected directory. > > For example: If I go directly to the directory I get a popup to enter > > user and password, the normallt way. > > > > But if I go through a php-script that checks if I'm a valid user from a > > database I will get access to the folder. > > > > So i need a way to send user/password from php to the .htaccess file. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to get the date of this Saturday all the time?
How about date("Y-m-d",strtotime("next Saturday")); James Hicks On Tuesday 24 June 2003 08:01 pm, poetbox wrote: > hi,php-general£¬ > > We have a meeting at every Saturday,I'd like to post the news and > write the date of this Saturday every week,how can I get the date of > Saturday. For example,today is Monday, and today is 2003-23-06,I'd like > to get the Saturday date "2003-28-06" ;If today is Friday on > "2003-16-08",I'd like to get the date of "2003-17-08",the date is a var got > by a special function,How to WRITE THE FUNCTION? Any thoughts or > suggestions would be greatly appreciated!Thanks in advance. > > > poetbox > [EMAIL PROTECTED] > 2003-06-25 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to get the date of this Saturday all the time?
On Tuesday 24 June 2003 09:18 pm, poetbox wrote: > hi, James Hicks£¡ > > echo date("Y-m-d",strtotime("next Saturday")); > ?> > I got "1970-01-01"! > Perhaps you missing give me the function strtotime(). > You must be using an old version of PHP that does not support strtotime. (PHP 3>= 3.0.12, PHP 4 ) is what the manual says. That would account for the output of date. James Hicks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] script check/testing
On Tuesday 24 June 2003 11:27 pm, Jay Fitzgerald wrote: > I seem to be having problem in the last step of this app I am trying to > create...can you guys test it as thoroughly as you can and give me tips on > how to improve itit is session based but I cannot seem to get step 5 to > recognize the $theseat" variable. If you would like to offer help, please > email me off-list and I will provide the code to you, there is way to much > code and I am not even sure which part I should post here. > > http://www.lamerc.com/jay/test/new/step1.php > > TIA > > Jay From over here, it looks like you need to change: http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] script check/testing
Nevermind this suggestion. No idea what I was thinking. I guess it's time to go to sleep. James On Tuesday 24 June 2003 11:35 pm, James Hicks wrote: > On Tuesday 24 June 2003 11:27 pm, Jay Fitzgerald wrote: > > I seem to be having problem in the last step of this app I am trying to > > create...can you guys test it as thoroughly as you can and give me tips > > on how to improve itit is session based but I cannot seem to get step > > 5 to recognize the $theseat" variable. If you would like to offer help, > > please email me off-list and I will provide the code to you, there is way > > to much code and I am not even sure which part I should post here. > > > > http://www.lamerc.com/jay/test/new/step1.php > > > > TIA > > > > Jay > > From over here, it looks like you need to change: > > > to > > http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Refreshing
On Tuesday 01 July 2003 12:30 am, Tom Rogers wrote: > Hi, > > Tuesday, July 1, 2003, 3:41:56 AM, you wrote: > > JB> Also, this may not be PHP but...does anyone know how to stop the > JB> annoying click on Internet Explorer when something refreshes? > JB> [/snip] > > > control panel -> sounds -> set select to 'none' > I found the answer to this by doing a google search with "annoying clicking sound in Internet Explorer". I laughed when I actually found the answer on a page that described the sound as annoying. In an effort to keep this list on topic, I'd like to point out that you were correct when you said that this may not be PHP. :) James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect
On Saturday 25 October 2003 10:54 am, Joao Andrade wrote: > Hi there people, > > I'm looking for a function that will redirect a browser to another page > after a PHP scrip has run. I tried serching for it in the doc but found > nothing. It shall be similar to Tcl's "ns_returnredirect". > Thanx. You can either use the php function header() or the HTML meta refresh thing. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Maximum execution time
On Friday 05 December 2003 05:22 pm, John J Foerch wrote: > Hi, > Is there some way to turn off maximum execution time? Preferably > within the script itself? > Thanks, > John set_time_limit(0); zero is for not timeout, change to # of seconds if you want. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php