why does this script show empty alert box. I am trying to use php value in javascript
<script type="text/javascript">
alert(<?php echo count($myorder) ?>); </script>
thanks
I have this SQL by a programmer:
$sql = "
INSERT INTO
`{$database}`.`table`
(
`my_id`,
`xType`,
`subType`,
`recordID`,
`textarea`
)
VALUES
(
{$my_id},
?xType,
?subType,
{$recordID},
?areaText
) ";
My question is why is he using ? before values? How do I see what values are coming in? I did echo and it shows ?xType as ?xType. No values. What does ? stand for in SQL?
Is there a way to add files to a zip file from another server with php's zip extension? ie. addFile(array('localfile.txt,'http://www.domain.com/remotefile.txt')) (that obviously does not work)
I suppose I can download the files to a temporal folder and then add them to the zip file, but I was looking for a more automated solution or a function already made
<?php
namespace default
gives me an unexpecected T_DEFAULT, is there any way of working around this? Can I escape the reserved word somehow?
My system uses the name of the current module in my site for the namespace so it would be nice to be able to use any string as a namespace.
When I run some php code I've written, I get the following message:
You have an error in your SQL syntax;
check the manual that corresponds to
your MySQL server version for the
right syntax to use near 'condition,
price, name, email) VALUES('Fake
Title', 'Fake Subhead', 'Fake Author'
at line 1
I do not see anything wrong with my syntax, however, which is like:
mysql_query("INSERT INTO table (x1, x2, x3) VALUES('$y1', '$y2', '$y3')");
Any ideas?
I have the following PHP function that I'm using to draw a trend line. However, it sometimes plots the line below all the points in the scatter graph. Is there an error in my function or is there a better way to do it. I think it might be something to do with that with the line it produces, it treats all the residuals (the distances from the scatter points to the line) as positive regardless of them being above or below the line.
function linear_regression($x, $y) {
$n = count($x);
$x_sum = array_sum($x); $y_sum = array_sum($y);
$xx_sum = 0; $xy_sum = 0;
for($i = 0; $i < $n; $i++) { $xy_sum+=($x[$i]*$y[$i]); $xx_sum+=($x[$i]*$x[$i]); }
$m = (($n * $xy_sum) - ($x_sum * $y_sum)) / (($n * $xx_sum) - ($x_sum * $x_sum)); $b = ($y_sum - ($m * $x_sum)) / $n; return array("m"=>$m, "b"=>$b);
}
Hi,
is there a "document" property named ssh? It's a simple question. I've seen this in some code at work, but no one in the office wrote the code, so I'm stucked.
The line was document.ssh.firstPing(...)
firstPing was a method in the code, that is writen in js+php. But I've searched with eclipse throughout all the code and there is no ssh anywhere.
Hello, how made in PHP from format 52.593800, 21.448850 format +52° 35' 37.68", +21° 26' 55.86" like do it google http://maps.google.pl/maps?hl=pl&t=m&q=52.593800,21.448850 ?
I want to change the php setting but from ".php" page not php.ini. The settings I want to change is
upload_max_filesize, post_max_size and memory_limit
This is my BIG string
BEGIN:VEVENT
UID:xxxxxx
DTSTAMP:xxxxxx
STATUS:CONFIRMED
CLASS:PUBLIC
URL:xxxxxx
SUMMARY:YYYYYYY
DESCRIPTION:xxxxxx; YYYYYYY;
DTSTART:xxxxxx
DTEND:xxxxxx
GEO:xxxxxx
LOCATION:xxxxxx
END:VEVENT
I need to change position of the two "YYYYYYY" in SUMMARY/DESCRIPTION
I have to replace them without being specific since it is implemented in a much larger function. (This string is already sliced out of a 3700 line - Calendar)
pls help! :)
I mean an interface definition without defining the return type makes it unusable?
This makes more Clear
Interface run
{
public function getInteger();
}
class MyString implements run
{
public function myNumber()
{
}
public function getInteger()
{
return "Not a number";
}
}
In Java every Interface has a return type like Integer,String,Void
I know that PHP is unfortunately a loosly typed Language but isnt there a Solution for that Problem?
Is it Possible to defining a Interface with a Return type like Integer?
Client is requesting a single track to be heard across the website. Generally I advise against it, but they insist. So, what is the most straightforward way of having a flash player embedded in a site, and when a user goes to another page there isn't a gap/interruption?
I am thinking an iframe is required.. I am using a flash player that has autoresume, but that only solves picking up where you last left off on the song before going to another page. I tried searching SO for an answer..
I can't understand how the following code works.
$start = 1;
while($start<10){
if ($start&1) {
echo "ODD ".$start." <br/> ";
}
else {
echo "EVEN ".$start." <br/> ";
}
$start++;
}
The $start&1 will return ODD and EVEN seperately.
Output
ODD 1
EVEN 2
ODD 3
EVEN 4
ODD 5
EVEN 6
ODD 7
EVEN 8
ODD 9
If we give $start&2 instead of $start&1, it returns with another order.
How &1 &2 etc... works here?
i have one complete website
which was written in php4, now my hosting server is PHP Version 5.3.2, windows 2008 server
and my site is not working, what i found is old site use following syntax
<?
but if i change it into
<?php
page start working. is there any way to solve this issue...
PHP Version 5.3.2 work with
<?
any script which change all
<? to <?php
in all pages.
Thanks
Hi All
I just installed php 5.3.1 in my linux server and now my old work which i used to write with tags is not working at all..
Please help me out..
How can i resolve this??
I have a site which has client side and admin side. There is a table called account History.
which contains fields like uid | accountBalance | PaymentStatus | Date.
Now this table has to be updated every month for all the paid users and the table is bulk. So what is the best way to update the table every month.Do i need to select all the uid's and update.
I'm sometimes confused to using which one of them,
say i have a function called getmember($id)
function getmember($id)
{
// now this is the confusing part
// how do i test if a $id was set or not set?
//solution 1
if(empty($id))
{
return false;
}
// solution 2
if(isset($id))
{
return false;
}
}
Thats sometimes not clear tome some times if a parameter in a function is set like function($var="")
Then i do
if($var ==="")
{
return false;
}
What should i use the next time isset ? emtyp ? or ===''
Why is it possible to create an interface without specifying a return type? Why doesn't this make this interface unusable?
This makes it more Clear:
Interface run
{
public function getInteger();
}
class MyString implements run
{
public function myNumber()
{
}
public function getInteger()
{
return "Not a number";
}
}
In Java every Interface has a return type like Integer, String or Void
I know that PHP is unfortunately a loosely typed Language but isn't there a Solution to that Problem?
Is it possible to define an Interface with a return type like Integer?
lets say i have a group of number like (3,2,5) the normal way i use to split them and searching mysql to get value is to split them using explode in PHP
EXAMPLE
$string = '3,4,5';
$array = explode(',',$string);
foreach($array as $value){
$query = 'SELECT ID FROM TABLE WHERE ID = "'.$value.'"';
}
it work like this but it make the script extremely slow
i need now if there is away to split this string into the query it self and return the result without looping with PHP ?
Can anyone please tell me how to move file(s) into a dir in PHP? I did the following and it doesn't work.
exec("temp/$file ../public/");
I would appreciate it.