Below is the code:
$result=mysql_query("select * from choices where a_id='$taskid'")or die(mysql_error());
while($row=mysql_fetch_assoc($result))
{ print_r($row); }
Why did I only got []? What's wrong?
More:
It can not be empty. The more complete code is as follows:
$result=mysql_query("select * from choices where a_id='$taskid'")or...
Hi i am trying to do concatenation in smarty. Here is an example of how i would like to use the code. The php assigns
$smarty->assign('myvar',array(1,5,6,4));
$smarty->assign('myvar2',array('a1'=>1,'a2'=>2,'a3'=>3,'a4'=>4));
And the template page
{foreach from=$myvar item=v}
{if $v == $myvar2.a+$v}
match
{else}
no mat...
im using html SELECT to make 3 dropdown menues. one for a list of countries, one for regions and one for cities.
they all have different tables in the database and they are linked to each other with foreign keys.
i want to force the user to first select a country while the other two menues are locked. when he has selected a country he ...
Hi,
I am using getimagesize() to get teh size of my image. I have image in my sub-directory when i am passing file name with sub-directory i ma facing an error:
There is no such file or directory
here is my Code:
<?PHP
function resize($img,$max_w){
$max_h=$max_w;
list($img_w,$img_h) = getimagesize($img);
$f = m...
1) I want to save case 1 value to an array. Return this array and pass it to a function. The code become case 2, but no result come out, where is the problem?
2) In function display_urls, i want to echo both $url and $category. What should i do in IF condition or add another line of code?
function display_urls($url_array)
{
echo "";
...
I've been searching for this topic on SO and it's quite a headache not finding one.
I had developed a website for some time already and found that the current problem is that after postback, if the submission has any error and the user is redirect back to the form, the form values are all gone.
Is there a good way/flow/design to implem...
I create the cookie in jQuery. I can verify it in Firefox. But when I try to print the cookie or assign into another value I cant get it. I also use sessions. And I started the session in PHP.
My code to print or assign the cookie value is shown below
echo $_COOKIE['a'];
for assigning the value
$b=$_COOKIE['a'];
The cookie created ...
Hello, I have some code that works, but is clunky and am wondering if there is a better way to do it, first the code, and then i will explain:
// repeat query 10 times
for ($i = 1; $i <= 10; $i++) {
$query = @mysql_query("SELECT fileName FROM images");
while($row = mysql_fetch_assoc($query)){
extract($row);
echo "<img ...
hello,
I am developing a website for which I need an online c/C++ compiler for testing codes online.
Is there any possible and feasible solution for this.
i need this compiler so that students can test there code online.
Thnx in avance
...
I want to populate a DropDown control on page load using AJAX. I have the code and it is working, but I am not following as to which event to use.
...
Below is the code:
function swap(&$a, &$b)
{
list($a, $b) = array($b, $a);
}
for ($i=0; count($resultset);$i++)
{
for($j=1;$j<5;$j++)
{
$k = rand(1, 4);
swap($resultset[$i]["option".$j],$resultset[$i]["option".$k]);
}
}
It is a two-dimensional array from a MySQL query, I want to shuffle the values ...
Quick MYSQL/PHP question. I'm using a "not-so-strict" search query as a fallback if no results are found with a normal search query, to the tune of:
foreach($find_array as $word) {
clauses[] = "(firstname SOUNDS LIKE '$word%' OR lastname SOUNDS LIKE '$word%')";
}
if (!empty($clauses)) $filter='('.implode(' AND ', $clauses).')';
$quer...
I currently have a search form in the search controller, so the only way I can get to it is through /search/. I have to refactor my code so that this search form appears not only in the Search Controller but also globally throughout the site.
( The code isnt exact as I had to retype some of it )
My class that extends Zend_Form is loca...
I have a site where users register for an account. I have an internal communication system, that sends them an email when they get a private message. I dont force people to confirm their email, so naturally, many enter a fake address.
When they get a PM, it tries to send them an email, but obviously fails, so it keeps retrying and retry...
I have a website where I display information from a mysql table such as date of last change.
In mysql, the field type is 'TIMESTAMP' ...
I have a code like this:
$postdate = date( "j F", strtotime( $row['insert_date'] ) ); // Getting the date from the database
$posthour = date( "H:i", strtotime( $row['insert_date'] ) ); // Getting the t...
Hi
I want to convert octal sign like \46 to normal sign like &.
The problem is that the input is created with preg_match_all(), put into an array and then retrieved.
If I'd manually input the \46 octal notation into variable with double quotes, like
$input="\046";
then PHP would convert it nicely.
But when I have it into an array fr...
Is there say way to universally tell php to redirect to a certain page on any fatal errors?
Say i have a site with many different files, and i want to hide problems (while still logging them) and send the user to the same error page, no matter what the error is or what page they are on.
Lets just pretend for sake of argument that i do...
There is some way to execute a php script every 40 miliseconds?
I don't know if cronjob is the right way, because 25 times per second require a lot of CPU.
Well, If php isn't the correct language, what language I should use?
I am making a online game, but I need something to process what is happening in the game, to move the characters...
Hello,
I am trying to setup my ubuntu server, but it seems to me that the php package downloaded has got corrupt as it is not installing the whole package.
When I am trying to reinstall after removing the package with sudo apt-get install php5 it uses the same package which it had downloaded earlier but i want to download a fresh copy ...
Should I write the meta-tags in utf-8 format?
For example, is it okay to have double-quotes in the meta-keywords like this:
19" wheels
or special characters like the & sign... ?
Thanks
NOTE: Im using utf-8 encoding on all my pages!
...