vibhaJ 126 Master Poster

Try this:

<?php 
$a = trim($_REQUEST['a']);  
$student = trim($_GET['student']);
if($a == 'edit' and !empty($id))
{  
    /* zapytanie do tabeli */  
    $wynik = mysql_query("SELECT * FROM table_name WHERE student='$student'")  
    or die('Błąd zapytania');  
    while($r = mysql_fetch_assoc($wynik))
	{
	   echo '<form action="edycja.php" method="post">
	   <input type="hidden" name="a" value="save" />
	   <input type="hidden" name="student" value="'.$student.'"/>
	   test1:<br />
	   <input type="text" name="test1" value="'.$r['test1'].'"/><br />
	   test2:<br />
	   <input type="text" name="test2" value="'.$r['test2'].'" /><br /> 
	   <input type="text" name="test3" value="'.$r['test3'].'" /><br />
	   <input type="submit" value="popraw" />
	   </form>';  
    }  
} 

elseif($a == 'save')
{  
    /* odbieramy zmienne z formularza */  
    $student = $_POST['student'];  
    $test1 = trim($_POST['test1']);  
    $test2 = trim($_POST['test2']);  
    $test3 = trim($_POST['test3']); 
    /* uaktualniamy tabelę test */  
    mysql_query("UPDATE test SET test1='$test1',  
    test2='$test2, test3='$test3' WHERE student='$student'")  
    or die('Błąd zapytania');  
    echo 'Dane zostały zaktualizowane';  
} 
?>
vibhaJ 126 Master Poster

Here is code:

<?	
	$sql = "SELECT * FROM pictures WHERE email='$_GET['email'] and date >= DATE_SUB(NOW(), INTERVAL 30 DAY)";	
	$res = mysql_query($sql);
	$cnt = 0;
	$numCol = 5;
	
	echo "<table border='1' class='results'>";
	while ($row = mysql_fetch_assoc($res))
	{
		$cnt++;
		if($cnt==1 || ($cnt-1)%$numCol==0)
			echo '<tr>';
		
		echo "<td><img src=".$row['picture']."></td>";
				
		if($cnt%$numCol==0)
			echo '</tr>';
	}
	echo "</table>";
?>
vibhaJ 126 Master Poster

Hello,
I don't have any errors it just not showing a thing if i leave only the html code it works but in php it wont so if you can help me would be cool, Thanks =]

<?php 
$a = trim($_REQUEST['a']);  
$student = trim($_GET['student']);
if($a == 'edit' and !empty($id))
{  
    /* zapytanie do tabeli */  
    $wynik = mysql_query("SELECT * FROM table_name WHERE student='$student'")  
    or die('Błąd zapytania');  
    if(mysql_num_rows($wynik) > 0)
   {   
   $r = mysql_fetch_assoc($wynik);
   echo '<form action="edycja.php" method="post">
   <input type="hidden" name="a" value="save" />
   <input type="hidden" name="student" value="'.$student.'"/>
   test1:<br />
   <input type="text" name="test1" value="'.$r['test1'].'"/><br />
   test2:<br />
   <input type="text" name="test2" value="'.$r['test2'].'" /><br /> 
   <input type="text" name="test3" value="'.$r['test3'].'" /><br />
   <input type="submit" value="popraw" />
   </form>';  

  
    }  
} 

elseif($a == 'save')
{  
    /* odbieramy zmienne z formularza */  
    $student = $_POST['student'];  
    $test1 = trim($_POST['test1']);  
    $test2 = trim($_POST['test2']);  
    $test3 = trim($_POST['test3']); 
    /* uaktualniamy tabelę test */  
    mysql_query("UPDATE test SET test1='$test1',  
    test2='$test2, test3='$test3' WHERE student='$student'")  
    or die('Błąd zapytania');  
    echo 'Dane zostały zaktualizowane';  
} 
?>

Please clarify your question.. Its not clear to me.

vibhaJ 126 Master Poster

It supports :
Video Formats: H.264 (.mp4, .mov, .f4v), FLV (.flv), 3GPP (.3gp, .3g2), YouTube
Sound Formats: AAC (.aac, .m4a), MP3 (.mp3)
Image Formats: JPEG (.jpg), PNG (.png), GIF (.gif)

Playlist link : http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/24/creating-a-playlist

I have created itunes like web based playlist using this only.
You need to surf longtailvideo's forums and help for your exact requirement.

vibhaJ 126 Master Poster

I also want to see reply.
As in ASP.NET, in php there should be good debugging.I have tried many debugger but not successful at the end.
I am tired with echo and exit statement.

vibhaJ 126 Master Poster

Try with jw player.
I am already using it in one my website, there are vast modification you can do with it using javascript.

vibhaJ 126 Master Poster

Insted of http upload you can use ftp upload

bool ftp_put ( resource $ftp_stream , string $remote_file , string $local_file , int $mode [, int $startpos = 0 ] )

I only have option of javapowuploader as there is combination of xml and mp3 files.
I have to dynamically read xml file and move mp3 song to my project.

So i have restriction for web based upload only.

vibhaJ 126 Master Poster

Hi All,

I have javaPowUploader for multiple file upload.
I am able to upload file upto 4GB after php setting.

But how can i upload file greater than 4GB?

vibhaJ 126 Master Poster

Okay.. it is working? gr8.

vibhaJ 126 Master Poster

Lets debug code.

<?
	function ClubGDC($userid)
	{
		$gdcarray = array();
		$query = "SELECT * FROM members WHERE access < 300 AND status='Active'";
		$query .= "AND group!= 1 AND group!= 234 AND group!= 99999999999 AND group!= 199 AND group!= 228 ";
		$query .= "AND id = $userid";
		$q = mysql_query($query);	
		echo '<br />Query:'.	$query;
		while($row = mysql_fetch_array($q))
		{
			$gdcarray[] = $row["group"];	
			echo '<br />group:'.$row["group"];		
		}
		return $gdcarray;		
	}
	
	$gdcarray1 = ClubGDC(54);
	//print_r($gdcarray1);
?>

Check this code and test if $query is returning proper output.
post your printed output.

vibhaJ 126 Master Poster
while($row = mysql_fetch_array($q))
	{
		$gdcarray[] = $row["group"];
		$i2++;
	}

Try to replace while loop with above code.

vibhaJ 126 Master Poster
<?php


    $username = $_POST['username'];
    $password = $_POST['password'];
    $login = $_GET['login'];
    
    setcookie("username", "$username", time()+86400);

    if ($login=='yes') {
        $con = mysql_connect("localhost","root","");
        mysql_select_db("obsosuser");
        
        $sql = "SELECT count(id) FROM obsosuser WHERE username='$username' and password='$password'";
        $query = mysql_query($sql);   
		$result = mysql_num_rows($query);  

        if ( $result == 1 ) 
		{
			echo "Login Successful! Welcome back ".$_COOKIE['username']." Sir/Maddam." ;
            $_SESSION ['username'] = $username;
		}
		else
		{
			echo "Invalid Login!";
		}
    }
?>

Try this code.

vibhaJ 126 Master Poster

I am not sir.. i am mam :) I think i should rename my profile name.

fredrickprem commented: superb coading sir even i can calculate number of days from my birth +0
vibhaJ 126 Master Poster
<?php
session_start();

if(isset($_REQUEST['submit']))//---- form is submitted -----
{
	$tab = $_REQUEST['tab'];
	for($i=0;$i<count($tab);$i++)
	{
		//--- here you are having all values checked by user. you can explode it by :: for further use. you can call your required function here.
		echo '<br>'.$tab[$i]." is checked.";
	}
}
?>

<html>
<form method="POST" name="myform2" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<?php    $table = array(
                        //  array('id','state','lat_hi','long_hi','lat_low','long_low'),  //field names
                            array(1,'andaman',13.59,94,06.73,92.53),
                            array(2,'AP',     19.87,84.78,12.59,76.45),
                            array(3,'Gujarat',24.72,74.55,20.15,68.35),
                            array(4,'kerala' ,12.75,77.37,08.18,74.86),
                            array(5,'punjab' ,32.46,76.93,29.53,73.87),                
            );                        
?>

<? for($i=0;$i<count($table);$i++){?>
<br><input name="tab[]" type="checkbox" value="<?=$table[$i][0]?>::<?=$table[$i][1]?>::<?=$table[$i][2]?>::<?=$table[$i][3]?>::<?=$table[$i][4]?>::<?=$table[$i][5]?>">
Id : <?=$table[$i][0]?>, Name : <?=$table[$i][1]?>
<? } ?>
<br><br><input name="submit" value="submit" type="submit">
</form>                    
</html>

This is just demo kinda thing.
you should not use function in this manner, where you want to use directly post values in function.
also not sure this is wat u want.

vibhaJ 126 Master Poster

index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta http-equiv="content-language" content="zh-HK" />
	<title>Cantab Education: Timetable</title>
	<script type="text/javascript">
		function showCourse(string,key)
		{
			if (string == "") {
				document.getElementById("dynamic_display").innerHTML = "";
				return;
			}
						
			if (window.XMLHttpRequest) {
				xmlhttp = new XMLHttpRequest();
			} else {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			
			xmlhttp.onreadystatechange = function()
			{
				if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					document.getElementById("dynamic_display").innerHTML = xmlhttp.responseText;
				}
			}

			xmlhttp.open("GET", "search.php?key="+ key +"&search=" + string, true);
			xmlhttp.send();
		}
	</script>
    <style type="text/css">
		body {
			font-size: 0.75em;
			margin: 0px;
			padding: 0px;
		}
		
		table#search {
			border-collapse: collapse;
			margin: auto;
			width: 956px;
		}
		table#search tr th {
			border: solid #000000 1px;
		}
		
		table#results {
			border-collapse: collapse;
			margin: auto;
			width: 956px;
		}
		table#results tr th {
			background-color: #00561c;
			border: solid #000000 1px;
			color: #ffffff;
		}
		table#results tr td {
			border: solid #000000 1px;
			text-align: center;
		}
	</style>
</head>
<body>
	<form>
		<table id="search">
            <tr>
                <th>
                	<select name="subject" onchange="showCourse(this.value,'Subject');">
                    	<option selected="selected" value="">Subject:</option>
                        <option value="A%20Math">A Math</option>
                        <option value="BAFS(A)">BAFS(A)</option>
                        <option value="BAFS(Acc)">BAFS(Acc)</option>                       
                    </select>
                </th>
                <th>
                	<select name="tutor" onchange="showCourse(this.value,'Tutor');">
                		<option selected="selected" value="">Tutor:</option>
                		<option value="A.%20Yiu">A. Yiu</option>
                		<option value="Alan%20x%20Cars">Alan x Cars</option>
                		<option value="Ally">Ally</option>                		
                	</select>
                </th>
                <th>
                	<select name="level" onchange="showCourse(this.value,'Level');">
                		<option selected="selected" value="">Level:</option>
                		<option value="Form%201">Form 1</option>
                		<option value="Form%202">Form 2</option>
                		<option value="Form%203">Form 3</option>                		
                	</select>
                </th>
                <th>
                	<select name="center" onchange="showCourse(this.value,'Primary Center');">
                		<option selected="selected" value="">Center:</option>
                		<option value="Causeway%20Bay">Causeway Bay</option>
                		<option value="Fo%20Tan">Fo Tan</option>
                		<option value="Hung%20Hom">Hung Hom</option>                		
                	</select>
                </th>
            </tr>
    	</table>
    </form>
    <div id="dynamic_display"></div>
</body>
</html>

search.php

<?php
	require_once('MagicParser.php');	
	$counter = 0;
	$limit_results = 1000;
		
	$key = $_GET['key'];
	$search = $_GET['search']; …
vibhaJ 126 Master Poster

Okay. Do you want Subject, Tutor, Level drop down values after form submit?
Your ajax portion is replacing dynamic_display inner HTML.which is outside of form.

vibhaJ 126 Master Poster

Firstly create your php array.
then using below link convert array to xml.

http://www.phpro.org/classes/PHP-Recursive-Array-To-XML-With-DOM.html

vibhaJ 126 Master Poster

"when I onclick it posts the value to the function on the top..."
what does it exactly means?

You want to use $table array right?
Post your exact html output requirement.

vibhaJ 126 Master Poster

hey.. this is php category.. :)

vibhaJ 126 Master Poster

Here is complete code what you need.
Hope it will help you.

<?php

	if(isset($_REQUEST['calculate']))
	{
		$temp1 = explode('/',$_REQUEST['date1']);
		$date1 = mktime(0,0,0,$temp1[0],$temp1[1],$temp1[2]);
		
		$temp2 = explode('/',$_REQUEST['date2']);
		$date2 = mktime(0,0,0,$temp2[0],$temp2[1],$temp2[2]);
		
		$dateDiff = $date2 - $date1;
		$fullDays = floor($dateDiff/(60*60*24));
		$fullHours = floor(($dateDiff-($fullDays*60*60*24))/(60*60));
		$fullMinutes = floor(($dateDiff-($fullDays*60*60*24)-($fullHours*60*60))/60);
		$answer = "Differernce between date2 and date1 is :  $fullDays days, $fullHours hours and $fullMinutes minutes.";
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<form method="post">
date1 : <input name="date1" type="text" value="<?=$_REQUEST['date1'];?>">
date2 : <input name="date2" type="text" value="<?=$_REQUEST['date2'];?>">
<input type="submit" name="calculate" value="calculate">
<br />
<br />
<?php echo $answer;?>
</form>
</body>
</html>
vibhaJ 126 Master Poster

Some points to mention:
-> form tag must always start exact html portion. e.g. in your code form should be above table tag.

<form id="form" name="form" method="get" >
    <table id="search">        
            <tr>

-> Subject select tag is not completed with </select>
-> try method="get" in form. and check how many variables are passed in url.

vibhaJ 126 Master Poster

See this jquery autosuggest example, it will guide you.
http://jquery.bassistance.de/autocomplete/demo/

vibhaJ 126 Master Poster
vibhaJ 126 Master Poster

Some things need to clear:
What is "<p> before <form ...

What is need of while if select query return only one record i.e. one record for user who is in session logged in.

You form tag starts in while and closing out of while loop.
Make it proper.

vibhaJ 126 Master Poster

If user clicks text should be clear and when user blur that field, then text should again come.. this is ideal case.it is not there in above code.

Yes the code you have used and what i do is the same thing, i used jquery.
Jquery is easy way, because you can just give class name or id to textfield.
and in " $(document).ready(function() {" you can point to that.

if code doesn't work for you check that you include jquery.min.js on top of " $(document).ready(function() {".

you can also check error console of browser to find issue.

vibhaJ 126 Master Poster

Thanks urtrivedi and Daiva.
The logic of both is same and it is so simple.
I dont know why it was not sparked for me even its so simple, anyways it happens sometimes :)

vibhaJ 126 Master Poster

Here is a example code which uses jquery.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script language="javascript">
	$(document).ready(function() {	
		 $("#keyword").val('Enter Your Search Here');		  
		 $("#keyword").bind("focus", function(){
		   if($(this).val() == 'Enter Your Search Here')	   
		   		$(this).val('');		   		
		 });
		 $("#keyword").bind("blur", function(){
		   if($(this).val() == '')	   
		   		$(this).val('Enter Your Search Here');		  
		 });
	});
</script>
</head>

<body>
<input autocomplete="off" id="keyword" name="" style="width:250px;" type="text" />
</body>
</html>

Hope it will help you.

vibhaJ 126 Master Poster

I am not a professional person... But shouldn't it be working?

"... where (product_name LIKE '%".$keyword[1]."%') AND (product_name LIKE '%".$keyword[2]."%')..."

Hope somebody will help you. I am interested in this problem too :]

This is simple logic and it should work.. let me check.

vibhaJ 126 Master Poster
<?php 		

$_POST['keywords']="aaa    ccc";

for($i=0;$i<10;$i++)
	$_POST['keywords']=str_replace("  "," ",$_POST['keywords']);

$arrkey=explode(" ",trim($_POST['keywords']));	


$query="select * from product where somecol='somevalue' ";

$keycount=count($arrkey);
if($keycount>0 and trim($_POST['keywords'])!="")
{
	$query.=" and (";
	$operator="";
	for($i=0;$i<$keycount;$i++)
	{
		$query.=$operator."(product_name like '%{$arrkey[$i]}%')";
		$operator=" or ";		
	}
	$query.=")";
}
echo $query;

?>

This code will generate below query:

$query="select * from product where somecol='somevalue' and ( (product_name like '%aaa%') or (product_name like '%ccc%') ) ";

But again, this will popup all record which have 'aaa' but not 'ccc'.

vibhaJ 126 Master Poster

I think it wont work,

e.g product name "blackberry bold 2200",
and i would search with "blackberry 2200"
then if i explode then all "blackberry" would comes.. i just want blackberry 2200.

This is also what google do.
But i don't know how they checks?

vibhaJ 126 Master Poster

HI All,

my requirement is as below:
lets product name is "aaa bbb ccc".
Now in search coding i have use LIKE statement.

"... where product_name LIKE '%".$keyword."%'"

Now when user insert 'aaa' or 'bbb' or 'ccc' or 'aaa bbb' or 'bbb ccc' search works.
But if user insert 'aaa ccc' then it is not working.
I want such search result where 'aaa ccc' will also comes in result.

Help me to create query !!

vibhaJ 126 Master Poster

1) You can have one table for all admin module's php pages name.
2) second table is for which admin have which php page's rights.
3) when any admin login then on top of page insert one common file, which will check take current php page's name and check in database whether that admin have permission or not.If admin have not permission then throw permission error.
4)In menu module names will be listed from database.

vibhaJ 126 Master Poster

HI All,

my requirement is as below:
lets product name is "aaa bbb ccc".
Now in search coding i have use LIKE statement.

"... where product_name LIKE '%".$keyword."%'"

Now when user insert 'aaa' or 'bbb' or 'ccc' or 'aaa bbb' or 'bbb ccc' search works.
But if user insert 'aaa ccc' then it is not working.
I want such search result where 'aaa ccc' will also comes in result.

Help me !!

vibhaJ 126 Master Poster

Always try to practice with header.

<?
	if(isset($_REQUEST['submit']))
	{
		/* ----------
		   your code 
		 ------------ */
		 header("Location:page.php");
		 exit;
	}
?>

Because if there is no header and you press refresh then form will be resubmitted.

vibhaJ 126 Master Poster

Table design is not proper.You should normalize your table.
you can have following structure:

tbl_album :
id : auto id
user_id : id of user
name : name of album

tbl_album_files :
id : auto id
album_id : reference to tbl_album
file : name of file
title : title of album file


Now the entries will be as folows:

tbl_album
id   |  user_id | name
1    |   5      | Moview
2    |   6      | Friends

tbl_album_files
id   | album_id |  file           |  title 
1    |   1      | moview1_2010.jpg | 2010 Release 1
2    |   1      | moview2_2010.jpg | 2010 Release 2
3    |   1      | moview3_2010.jpg | 2010 Release 3
..
..
..
10    |   1      | moview10_2010.jpg | 2010 Release 10

Thus when you delete any album file it will be just deleted from tbl_album_files.
So your php code will remain as it is.

vibhaJ 126 Master Poster

Thanks chrishea for help.
But this is for java i guess.
How can i use it in php or in web page ?

vibhaJ 126 Master Poster

Hi All,

I am having one php website.
where user register and add android application id from android market.e.g. com.GalleryXYZ...
I just have to check that whether this id is valid or not on android market?
I found below link:
http://developer.android.com/guide/publishing/publishing.html#marketintent

But it doesn't help me.
Is android provide any API or XML so that i can check with it.??

Please help me..

vibhaJ 126 Master Poster

Hi All,

I am having one php website.
where user register and add android application id from android market.e.g. com.GalleryXYZ...
I just have to check that whether this id is valid or not on android market?
I found below link:
http://developer.android.com/guide/publishing/publishing.html#marketintent

But it doesn't help me.
Is android provide any API or XML so that i can check with it.??

Please help me..

vibhaJ 126 Master Poster

change line #6 to below code:

$path = "<a href=$link?id=".urlencode($id).">Inscripción curso</a>";
vibhaJ 126 Master Poster

If you just wish to display time it is not required to use iframe.
I means, You can also go with JS or AJAX.
What do you think?

vibhaJ 126 Master Poster

From the PHP.net documentation:
"file_get_contents() is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by your OS to enhance performance."

If the file is stored locally, file_get_contents() basically does the following:

$fp = fopen($file, "r");
$contents = fread($fp, filesize($file));
fclose($fp);

It will not execute any PHP contained within the file. For any PHP code within the file to execute you will have to use output buffering and include the file, as mschroeder suggested, or grab the file with cURL (which is similar to grabbing the source from a browser). By far, including the file is faster since it doesn't require any socket connections like cURL does.

Thanks for explanation :)

vibhaJ 126 Master Poster

-vib
That is not true. When you use something like file_get_content() it does not parse/execute what it reads in. If you included the file then yes it would execute any php in that file.

-Gigs
This appears to me like you're trying to use it for some kind of template system? Where your output has a series of echo statements and you've already set some variables that should be replaced.

ob_start();
include ('lol.php');
$content = ob_get_contents();
ob_end_clean();

echo $content;

That code will include lol.php which will execute any php statements within it and then capture the content to a variable which you can then use at a later time. Is this more what you're trying to accomplish?

The function will not internally parse it.
But lets say i have one php page : http://www.mysite.com/register.php
And i use file_get_contents('http://www.mysite.com/register.php') then html source will be returned by file_get_contents function.

Simply we can have 'View Source' type of functionality.

vibhaJ 126 Master Poster

Ok.. get it.
Try with complete http path.
e.g.
<?php echo file_get_contents("http://localhost/project_name/lol.php"); ?>

vibhaJ 126 Master Poster

If you are referring my attached test.php.
then you will find below code at line # 125

// Test this class
$zipTest = new zipfile();
$zipTest->add_dir("images/");
$zipTest->add_file("photo.png", "images/photo.png");
$zipTest->add_file("logooo.jpg", "images/logooo.jpg");

Thus in add_file function you can pass whatever is your file location.

vibhaJ 126 Master Poster

how could it display php tags? its a scripting language and when you echo it it automatically executed.
Post your exact output if issue is still not solved.

vibhaJ 126 Master Poster

Here i have attached complete code.
This code will get two image file and zip ait and download it.
run test.php file in browser and you will have one zip file.

vibhaJ 126 Master Poster

Here i have attached complete code.
This code will get two image file and zip ait and download it.
run test.php file in browser and you will have one zip file.

vibhaJ 126 Master Poster
echo file_get_contents("./data.php");

code will not display any php tag. It shows HTML output of file data.php.
You want to display php tag also?

vibhaJ 126 Master Poster

i was also having such requirement once.
Then what i have done is:
create zip file of multiple files using php and then download that zip file.
Thus user can have multiple files in one zip.

vibhaJ 126 Master Poster

Below is example to get Google's content.

<?php
$homepage = file_get_contents('http://www.google.com/');
echo $homepage;
?>

Is this what u want?