Forum: PHP Sep 18th, 2009 |
| Replies: 2 Views: 286 KG,
Your advice is sound, except when referencing array elements. That is,$string = "Hello ".$name['firstname'].", how you are?";
would become$string = "Hello ${name['firstname']}, how you... |
Forum: PHP Sep 18th, 2009 |
| Replies: 10 Views: 457 If I may ever so gnetly ask a dumb question, why is the function call inside quotes? This results in $connection containing the string you see, rather than a handle referencing the desired database... |
Forum: PHP Jul 24th, 2009 |
| Replies: 3 Views: 298 You can look into DRM, but that has its limits. You can use the scheme you mentioned, but that still depends on the visitor being honest.
The best way to prevent people from downloading and/or... |
Forum: PHP Jul 18th, 2009 |
| Replies: 10 Views: 510 You may be overlooking a few things that are important when doing this sort of thing. PHP runs on the server.
ECMAScript (JS) runs on the browser.
HTML is interpreted by the browser to render the... |
Forum: PHP Jul 15th, 2009 |
| Replies: 3 Views: 467 Re-read the quoted part above, then read the table of reserved words in the MySQL manual. (Hint: 'by' is a reserved word.)
While you can use reserved words if you quote them correctly, it is best... |
Forum: PHP Jul 10th, 2009 |
| Replies: 4 Views: 537 <?php
// Set array parts
$a = array("1" => "one", "2" => "two");
$b = array("a" => "aye", "b" => "bee");
$c = array("a scalar", $a, $b);
// Extract a sub-element from an array in the... |
Forum: PHP Jul 9th, 2009 |
| Replies: 6 Views: 422 To provide a useful answer: use and tags around your code so it is displayed on the forum in a readable fashion use the "Preview Post" button to review your post before submitting it be sure your... |
Forum: PHP Jul 5th, 2009 |
| Replies: 8 Views: 453 Or, in plain English, you are overwriting the result of your SELECT query with the result of your DELETE query, which is not suitable for fetching rows from. Thus your script ABENDs at the top of the... |
Forum: PHP Jul 2nd, 2009 |
| Replies: 1 Views: 361 Two strong clues: Browser: Firefox (http://www.getfirefox.com/) ECMAScript debugger: Firebug (http://www.getfirebug.com/)
Firebug will let you see/examine the HTML generated by ECMAScript (also... |
Forum: PHP May 24th, 2009 |
| Replies: 10 Views: 536 Add ob_start() before your PHP has generated any output (before it has generated any of <body>, <head>, <!DOCTYPE, <html>, etc.) You will be free to generate any headers you wish; headers are not... |
Forum: PHP May 24th, 2009 |
| Replies: 7 Views: 1,193 Replace<?php
$myarr=json_encode($pr);
?>with<?php
$myarr=(str_replace("\\/", "/", json_encode($pr);
?>provided there are no other occurrences of "\/" in the converted array.
Recently, I... |
Forum: PHP May 24th, 2009 |
| Replies: 10 Views: 536 I tripped on this a few times myself, early on.
As you have discovered, there's a strict order in which data are to be sent to the browser. Headers first, then the HTML. It isn't that 'the header... |
Forum: PHP May 24th, 2009 |
| Replies: 3 Views: 393 This statement (as well as others like it) is not quite correct. Foremost, delete the close paren ')' at the end of the line. Next, you are concatenating strings, which usually requires the... |
Forum: PHP May 22nd, 2009 |
| Replies: 2 Views: 784 If your table has exactly one row in it and it has exactly one field, you can simply$query_string = "UPDATE my_table SET my_column='$item'";
mysql_query($query_string) or die ...
This will update... |
Forum: PHP May 11th, 2009 |
| Replies: 9 Views: 2,351 <?php
print<<<END
<script type="application/javascript">
function hello(clicked)
{
alert(clicked);
return false;
} |
Forum: PHP May 1st, 2009 |
| Replies: 3 Views: 343 May I suggest keeping all numbers as true numbers? Only convert them to formatted strings when you display them to the user. You might be mixing numbers and strings in your arithmetic... |
Forum: PHP Apr 24th, 2009 |
| Replies: 5 Views: 1,123 You should go to PayPal's dev site and see how to do it properly. They have a method by which your site receives the form data, processes it, then sends the user off to PayPal with a transaction... |
Forum: PHP Mar 24th, 2009 |
| Replies: 9 Views: 629 Will it help if I shout?
DELETE THE LINE WHERE YOU CALL MYSQL_FETCH_ASSOC()! IT IS EATING THE FIRST ROW RETURNED. IT IS THE LINE RIGHT ABOVE THE LINE WHERE YOU CALL MYSQL_NUM_ROWS()! DELETE THE... |
Forum: PHP Mar 24th, 2009 |
| Replies: 9 Views: 629 Let me try again. If there is only one matching row in the database, the mysql_fetch_assoc() function grabs it, leaving nothing for your while loop to do. If there is more than one matching row, your... |
Forum: PHP Mar 23rd, 2009 |
| Replies: 9 Views: 629 Are you missing the connect statement, like:$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
And why are you fetching data into an associative array via mysql_fetch_assoc() and... |
Forum: PHP Mar 23rd, 2009 |
| Replies: 9 Views: 629 In short, "WHERE field=value", you should have "value" inside single quotes ('). I stubbed my toes on this many times until I learned to put the value in quotes. Unless it was a function, of course. |
Forum: PHP Jan 30th, 2009 |
| Replies: 8 Views: 450 You would go home and reference the same resources I did: HTML and CSS specs (http://www.w3.org)
PHP Manual (http://www.php.net/manual/en/index.php)
MySQL manual(s)... |
Forum: PHP Jan 12th, 2009 |
| Replies: 3 Views: 387 Half of programming is learning to be an able toolsmith. :)
If no such tool exists, you'll have to make your own, perhaps using a pair of existing tools: sed and m4:[list] sed() transforms the... |
Forum: PHP Dec 25th, 2008 |
| Replies: 2 Views: 368 I'll remark on the first proggy. A few obligatory questions. How is the status getting from the browser to the server so the PHP code can work with it? Where are the username and password coming... |
Forum: PHP Dec 4th, 2008 |
| Replies: 11 Views: 3,279 To strictly answer the OP's question:
LOCK TABLES active WRITE, archive WRITE;
INSERT INTO archive
SELECT * FROM active
WHERE active_rec_id='$confirmed_id';
DELETE... |
Forum: PHP Mar 6th, 2008 |
| Replies: 6 Views: 2,026 But, grasshopper, you are forgetting that the computer does not operate in the decimal realm. It operates in the binary realm. What you think is 342/100, the computer sees as:
101010110/1100100... |
Forum: PHP Mar 5th, 2008 |
| Replies: 6 Views: 2,026 To find the best answer, you have to travel 30 years back in time. :) In a nut shell, you don't get exact answer all the time because binary floating point machine arithmetic cannot reproduce all... |
Forum: PHP Jan 2nd, 2008 |
| Replies: 9 Views: 1,866 Suppose your HTML form has the user select a name from a list, and the SUBMIT button sends that name to the server, in the form:
http://www.sample.com/mysql-query.php?user=SUE
Suppose the php... |
Forum: PHP Jan 2nd, 2008 |
| Replies: 15 Views: 1,379 Simply put, it is telling you that, on line 31:
$row=mysql_fetch_array($result);
$result is not valid.
This is not guaranteed to work: if you pass $result to the 'next' page as a hidden value... |
Forum: PHP Jan 2nd, 2008 |
| Replies: 9 Views: 1,866 Whatever you do, be sure you escape the result if you use it directly in a MySQL query. You don't want to be the victim of SQL injection. |
Forum: PHP Jan 2nd, 2008 |
| Replies: 5 Views: 1,028 If you want to restrict access to those users who clicked a link on a specific web page, you would have to use PHP and reference $_SERVER['HTTP_REFERER']. But this value can't really be trusted. From... |