Re: [PHP-DB] Re: clues to cache-like behavior

2011-08-10 Thread Donovan Brooke

Jim Giner wrote:

With IE, a refresh is F5 or even better, ctrl-F5.  Should always get the
latest updates.  Or you could add:

header("Cache-Control: no-cache");

at the beginning of your php code.



Well, that works! :-/ (I'm embarrassed to say)

For some reason I over-thought that one.

Thx,
Donovan




--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Re: clues to cache-like behavior

2011-08-09 Thread Donovan Brooke

Jim Giner wrote:

So you're saying a page refresh in your browser doesn't cure the problem?



Hi, sorry for the delay.. Yes, page refresh/s is basically what I am 
doing to get to the latest edits (by clicking in and out of the edit 
area).  Reloading the page one or more times works as well.


Donovan




--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] clues to cache-like behavior

2011-08-08 Thread Donovan Brooke

Hello,

I took some PHP/MySQL code that seemed to be working fine from a LAMP 
setup and brought it to a MAMP (mac OS) setup. Now I am seeing a 
cache-like behavior in my admin forms, where my last changes don't "stick".


To be clearer, I go to make a database change in the forms I built to 
administer the MySQL db, hit submit, then check the results on the 
public side. All is fine at this point. The changes are there. However, 
I decide to adjust something and go to make another edit, however, my 
admin form shows the prior data.. not the last edits.


Checking via command-line the edits are there, and if in and out of the 
edit page a few times, the last edits finally appear.


Anyway, I've only built a couple MySQL driven sites so far, and haven't 
gotten all the way through my O'reilly MySQL book yet, but I thought I'd 
see if this kind of thing rang a bell with anyone.


If I had to make a blind guess, I'd guess a config issue (either PHP or 
MySQL), as I don't remember this behavior in the LAMP setup.


TIA for your comments.

Donovan




--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Submitting data to MySQL database using HTML/PHP form

2011-02-20 Thread Donovan Brooke

Daniel Brown wrote:

On Sun, Feb 20, 2011 at 14:11, Nazish Zafar  wrote:


$insert = "INSERT INTO user_info
(login, password)
VALUES
("$login", "$password");


 You're using double-quotes to encapsulate your $insert variable
data, then never closing them.  What's more, you're also using
double-quotes to encapsulate each individual variable in the query.
Rewrite $insert to this:

 $insert = "INSERT INTO user_info(login,password)
VALUES('".mysql_real_escape_string($login)."',"'.mysql_real_escape_string($password)."')";



Look at that one more time Dan. ;-)

Donovan




--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Displaying Results

2011-02-15 Thread Donovan Brooke

Ethan Rosenberg wrote:

Dear List -

I have a form. In one field, the customer types the name of a product.
The first seven(7) results of the MySQL query that the entry generates
should be displayed as a clickable drop down list.

How do I do it?

Thanks.

Ethan

MySQL 5.1 PHP 5.3.3-6 Linux [Debian (sid)]



You said you have a form.. do have anything else. ;-).. ie, the mysql 
query etc.. (not sure what you are needing an answer to.. retrieving 
records from mysql, or how to display them)


Anyway, I think you mean you want to have "7 option's in a select form 
element"?


print "";

//Your loop of found records starts here
print "$otherdbfield";
//Your loop ends here

print "";

.. Me thinks we need more input.. maybe post the code that you have.

Donovan



--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] stripslashes ( encodings to from MySQL )

2011-01-28 Thread Donovan Brooke

Sorry, should have done some simple testing!.. It
appears that stripslashes is smarter than simply stripping
all "/".

So, my apologies for interrupting the class! ;-)

Donovan



--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] stripslashes ( encodings to from MySQL )

2011-01-28 Thread Donovan Brooke

Hello,

I use mysql_real_escape_string() to
escape data for db population.

ie.

..form..


..recieving form input before db update..
$var =mysql_real_escape_string($var);

My question is regarding when wanting to allow HTML
within a database...

Will stripslashes also take out the slashes from something
like this?:
some text


That would effectively negated the ability to use HTML/CSS
in your db. If so, how do you get around this with safe data
entry?

TIA,
Donovan




--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] 2nd Pair of eyes please

2011-01-27 Thread Donovan Brooke

Hello,
to respond to some of the comments/questions..

No, it wasn't parsing anything... and yes, I put

ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);

at the top of the page.

(as well as there is a custom built PHP management app that
allows to turn on the display_errors.. which is apparently
done.)

Having said all that, this server config (of which I have very limited
access) does appear to shut down parsing
entirely more quickly than my dev machines that are set
as mentioned.

..usually not a problem (old hat in troubleshooting) and am nearing the 
end of the this job... but yes, strange that small errors trigger 
shutting down parsing entirely.


Daevid,

Lot's of misc. comments for not being able to spot my syntax issue and 
not knowing the details of my project! ;-)


However, I will take a look some time at your wrapper for future reference.

Cheers,

Donovan (1 block of code at a time)


--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] 2nd Pair of eyes please

2011-01-26 Thread Donovan Brooke

[snip]

print = "";


^
Never mind, found it. :-/

Donovan


--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] 2nd Pair of eyes please

2011-01-26 Thread Donovan Brooke

O.K., I give up.. I can't seem to find why this breaks the page to
a point where nothing gets displayed in the browser (no error reporting).

Sorry for any email line breaks:


---start-
if ($t_dataon) {
  $query = "SELECT 
s_sitename,s_logopath,s_headinfo,s_head_moreinfo,s_rightpic_path FROM 
site WHERE (s_id=31) LIMIT 1";


  if ($a_r = @mysql_query($query)) {
while (list($tname, $tlogo, $thead, $tmorehead, $trpic) = 
mysql_fetch_row($a_r)) {

  $t_sitename = "$tname";
  $t_logopath = "$tlogo";
  $t_headinfo = "$thead";
  $t_moreheadinfo = "$tmorehead";
  $t_rpic = "$trpic";
}
  } else {
// Problem with query
print = "";
  }
}
end-


If I take it out, the page renders. Any ideas?

TIA,
Donovan



--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] bool type (between MySQL and PHP)

2011-01-25 Thread Donovan Brooke

Daniel Brown wrote:

On Tue, Jan 25, 2011 at 17:40, Donovan Brooke  wrote:


Thanks Dan,

I think the error would still persist using DEFAULT.. because as mentioned,
I don't think MySQL likes:

UPDATE tablename SET vbool=

..which is not great news for me since I'd like to avoid having to redo
all my bool's in PHP (input checking, updates, add's etc.. ;-) ENUM would
require that route as well I guess.


 Oh, sorry, I must've skimmed that part of the message.  If you're
not changing the value from the default, just omit it from the query.
You can't send an empty value.  If, for whatever reason, you MUST send
the `vbool` column data in your UPDATE query, then define it: 0 =
false, 1 = true (of course).  Two easy workarounds here:

 




Thanks Dan, I'm sure that would work, but it appears I figured out where
I went wrong...

Read below at your own risk of becoming confused. ;-)

As of now, "false" causes MySQL to input the correct value, which is "0".

I was originally trying to initialize/set the var inside the checker:

if (filter_input(INPUT_POST,'f_bool',FILTER_VALIDATE_BOOLEAN)) {
  $vbool = $_POST['f_bool'];
} else {
 
}

The very strange thing is that, though the "else" statement was never 
thrown, anything inside the if (true) statement was not enacting... thus 
MySQL was getting an empty value, because the variable was never

getting set.

Strange, anyway, I bypassed the filter and now MySQL accepts false 
boolean's.


I'll now have to figure out how to correctly validate a boolean!...
(tomorrow) ;-)

Thanks for the assist.

Donovan



--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] bool type (between MySQL and PHP)

2011-01-25 Thread Donovan Brooke

Daniel Brown wrote:

On Tue, Jan 25, 2011 at 17:05, Donovan Brooke  wrote:


What is the best PHP practice when using bools with
MySQL? Save 1's and 0's instead of true/false?


 You could either do an INT(1) DEFAULT 0 or an ENUM('Y','N') to
make it easier on yourself.



Thanks Dan,

I think the error would still persist using DEFAULT.. because as 
mentioned, I don't think MySQL likes:


UPDATE tablename SET vbool=

..which is not great news for me since I'd like to avoid having to redo
all my bool's in PHP (input checking, updates, add's etc.. ;-) ENUM 
would require that route as well I guess.


I suppose I could instead place a string value of "0" in the query 
statement, if bool false, perhaps?


I'll try that.

Donovan






--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] bool type (between MySQL and PHP)

2011-01-25 Thread Donovan Brooke

Hello,
I'm having some issues with bool's relating to MySQL.

I am using:

$tvar = true;
$tvar = false;

in PHP, but only the TRUE value gets
accepted by the MySQL insert or update's.

It appears MySQL sees the TRUE value as 1..
because that is what shows up.. and that MySQL
throws an error when false because the query:

UPDATE tablename SET vbool=$tbool

parses to:

UPDATE tablename SET vbool=

which throws a syntax error.

What is the best PHP practice when using bools with
MySQL? Save 1's and 0's instead of true/false?

TIA!,
Donovan



--
D Brooke

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php