-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
my problem with jquery and oop php ? is there anyone ?
requinix replied to redhat2's topic in PHP Coding Help
You should probably fix it then. If you need more specific advice than that, give us more to go on than "it doesn't work". -
Along with that goes the general question of "Have you tried running the exact same command from a terminal?"
-
Get multiple parameters from URL and echo them out.
requinix replied to CBaZ's topic in PHP Coding Help
And how would this script help with that? -
Get multiple parameters from URL and echo them out.
requinix replied to CBaZ's topic in PHP Coding Help
$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') === FALSE ? 'http' : 'https'; The SERVER_PROTOCOL will never contain "https". It is always in the form "HTTP/1.x". Check $_SERVER["HTTPS"] ("on" or "off") or, if that's not available, the less reliable $_SERVER["SERVER_PORT"] (80=http, 443=https). Speaking of, you don't take into account the port number. As for $currentUrl, $name and $value do not have what you want them to have. They're only useable inside the foreach loop. -
Just checked, it is valid. Call the function named whatever the value of $this->y is. call_user_func(array($this, $this->y));
-
By the way, return $this->{ $this->y }(); is quite wrong. Even if it's syntactically valid (might be) it won't do what you want it to do.
-
Database calls every page hit or save in $_SESSION
requinix replied to iarp's topic in PHP Coding Help
Unless you have something unusual you'll do a lot more reading than writing. Keep it in the session (or a cache) and update your database when it changes. -
...has been turned off in the new version you have, which is exactly how it should be. $newcontent = (isset($_POST["newcontent"]) ? (string)$_POST["newcontent"] : "");
-
But rest assured that the REMOTE_ADDR will be a valid IP address. There's just no guarantee that it's actually the IP address of the user - could be a proxy, could be spoofed.
-
You have to get the values of $iterator and such with $unit->iterator, not $unitlist->unit->iterator.
-
There's also the inverse: $types = array('Word','Excel','PDF'); $row = $db->get_row("SELECT doctype FROM documents WHERE id = 100"); if (in_array($row["doctype"], $types)) { // ... } else { // ... }
-
Yes, it's definitely the standard way to include files. There are alternatives for different circumstances. And yes, it will work on your local server. It'll work anywhere so long as the DOCUMENT_ROOT is defined (it practically always is) and the path to the file from there is "/template.php" (it's in that directory). If your local setup is different and you need a subfolder, like "/mydomain/template.php", then it will not work because the path is different.
-
And have you checked the error logs to see what happened?
-
And where do you define $dev?
-
Fail to input dataColumn count doesn't match value count at row 1
requinix replied to Taku's topic in PHP Coding Help
The number of fields you mention in your INSERT does not match up with the number of values you provided. Something's extra or something's missing. -
What's in conn.php? [edit] Assuming there's a mysql_connect() in there, be sure to not post the username you tried to connect with. And while I'm at it, the error message is telling you that you didn't put the password in. You probably need to.
-
foreach ($foo->new_occ as $room => $occupants) { $adults = (isset($occupants["adults"]) ? $occupants["adults"] : 0); $children = (isset($occupants["children"]) ? array_sum($occupants["children"]) : 0); echo "Room {$room} has ", $adults + $children, "occupants\n"; }
-
From unordered list to multidimensional array?
requinix replied to Roland_D's topic in PHP Coding Help
Recursively, function buildArrayFromLists($parent, &$item) { for each $ul directly under the $parent { $item[id from $ul] = array(); for each $li directly under $ul { $item[id from $ul][] = id from $li; buildArrayFromLists($li, $item); } // optionally if $item[id from $ul] is empty then unset($item[id from $ul]); } } -
It won't. PHP and Javascript are entirely separate, and the only way to send something from Javascript to PHP is with AJAX.
-
But what format is it? What type of column? DATE? DATETIME? VARCHAR? MySQL uses Y-M-D so try with your $today formatted that way.