|
|
How To create dynamic subdomains using .htaccess.Anyknow plz help Thanks in advance
|
|
|
|
|
I've to need the PHP Code for a STO Project. PHP and MySQL is required for this.Sufficent payment will be give to Programmer. It's not a professional project but it's a College Project. If you are intrested then email me at "moononly4you@hotmail.com" I'll send you the document file through Email.
Urgently Required
Regards,
|
|
|
|
|
I have a php program that uses sessions : there are about 12 variables. I understand that to initialise these session variables I have to add &nbs p; $_SESSION['variable']; can this be an array- eg? &nbs p; $_SESSION ['variable1,'variable2'] Is this done before or after registering the session variable. Is this initialization of session variables done once when the session is created or for each page? Thanks
Optional Information:
OS: Unix; Browser: IE
Already Tried:
I'm converting the program to run with PHP 5.0 with globals on - this is what exists on the home page:
session_cache_limiter('none');
session_start();
session_register('pass_action');
session_register('user_name');
session_register('user_input');
session_register('user_encrypt');
session_register('user_artist_or_org');
session_register('user_id');
session_register('artist');
session_register('copyright');
session_register('org_id');
session_register('organization');
session_register('store_user_name');
session_register('store_user_input');
session_register('store_user_id');
session_register('store_user_encrypt');
session_register('store_user_artist_or_org');
session_register('artist_id');
Somehow I have to initialize these variables.
I have not tried anything yet because the manual info is confusing to me.
Thanks
|
|
|
|
|
To set a session variable you first need to start your session:
<?php
session_start(); /start the session
$SESSION['testvar'] = "value1";
?>
Now if you open another page on your site that has the session_start() function called you can print the value stored in the session with
<?php
session_start(); /start the session
echo $SESSION['testvar'];
?>
You will hvae to ensure your host has the session.save_handler and session.save_path php.ini values set. To test this you can try using my session test script:
http://www.joeceresini.com/testscripts/jc.sessions.phps
You can also see the values of those options in a php info file
<?php
phpinfo();
?>
Joe Ceresini
Network Engineer
jceresini@hostmysite.com
Hostmysite.com
|
|
|
|
|
hi im new in Php,can any one plz guide in linking database with Php
|
|
|
|
|
|
In PHP, this is done with the mysql_connect() function.
Syntax
mysql_connect(servername,username,password);
Parameter Description
servername Optional. Specifies the server to connect to. Default value is "localhost:3306"
username Optional. Specifies the username to log in with. Default value is the name of the user that owns the server process
password Optional. Specifies the password to log in with. Default is ""
"Programming is a fun"
|
|
|
|
|
Let me contribute to solving your struggling :
First, because all your php pages that access mysql must connect to the Db
it is a wise tradition to create an include file
[call it for instance "dbconn.php"] with the following content :
============================
<?php
$conn = mysql_connect("localhost","root","yourpasswd")
or die('Could not connect: ' . mysql_error());
mysql_select_db("yourDBname") or die("Select DB error");
?>
============================
[NOTE the "localhost" must change if the target DB is not on your system but on a Host]
then whenever you create a new php script start with :
<?php
include('dbconn.php');
. . . . . . .
AND THEN WHAT ??? (you will say)
Here is an extract for my scripts slightly modified - with a little more modification it fits all purposes :
$query="select ProductID, ProductName from Products where ProductID=1"; // an SQL query
$result=mysql_query($query) or die('Query failed: ' . mysql_error()); // execure query
if (mysql_num_rows($result)==1) // if a record was found
{ $row = mysql_fetch_array($result,MYSQL_ASSOC);
//get record in array $row
echo 'ProductID ='. $row["ProductID"]."<BR />";
echo 'Prod.Name='. $row["ProductName"]."<BR />";
}
=======================
Good luck s4 - php is great remember !
ioannis_o5
|
|
|
|
|
|
Well firstly that page doesn't return all 10,000 records, only the first 1000 rows (check the LIMIT[^] keyword), and secondly you would have to increase phps timeout setting (or something, I forget it's exact setting name) if you wanted literally all 10,000 results to show in one page.
Again, Limit is what you are looking for.
|
|
|
|
|
Thanks for your reply.
I used LIMIT its working for first 30 records fast but after that
its very slow around 100 sec.
that is : "select * from table1 limit 0,10"
that is : "select * from table1 limit 10,10"
that is : "select * from table1 limit 20,10"
.
.
.
.
.
but "select * from table limit 100,10" is not working
taking long time and php time outs.
I used AJAX too but browser hangs (because of long time execution).
I tried :
"select * INTO OUTFILE from table1 limit 200,100
INTO OUTFILE '/tmp/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
this says permission denied (password:yes)"
What i do.
Pavan.
|
|
|
|
|
Use multiple pages, where first page is limit 0,100, second page is 100,100
first number is startrecord, second number is amount, you shouldn't do 200,100, you should do 100,200 to get records 100 to 200 inclusively. Look how they do it, they display first 100 records then require you to go to next page for next 100 records. You are just trying to do all 10000 records in one page, which is just plain poor design at best.
modified on Monday, February 2, 2009 11:12 AM
|
|
|
|
|
May be But i want all the filtered record in my hard disk.
So i am getting all the records and then saving it in a file (csv).
I am using iframes for this.
What i want is a file saved in my hard disk (filtered records).
Is there any other way to do this.
|
|
|
|
|
Google for scripts to export mysql records as a csv, either way it will be just as slow, you have to increase the timeout or split it up into multiple csvs, then build an application to join it into one large csv.
Either way, no you cannot export 10,000 records in one shot while youre timeout is set to 30 seconds, you will need shell access to do this to bypass php.
Edit: next time post your requirements in the OP so we don't do this dance for an hour before I understand what it is you really want.
|
|
|
|
|
"select * from table1 limit 2,3" should display only 2 records but
i am seeing 3 records.Starting from record 2 to next 3 records.
You said i can go for Google script.Please explain me about it.
|
|
|
|
|
Sorry, will show next 3 records starting at record 2
LazyDragonfist wrote: You said i can go for Google script.Please explain me about it.
$host = 'localhost';
$user = 'mysqlUser';
$pass = 'myUserPass';
$db = 'myDatabase';
$table = 'products_info';
$file = 'export';
$link = mysql_connect($host, $user, $pass) or die("Can not connect." . mysql_error());
mysql_select_db($db) or die("Can not connect.");
$result = mysql_query("SHOW COLUMNS FROM ".$table."");
$i = 0;
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$csv_output .= $row['Field']."; ";
$i++;
}
}
$csv_output .= "\n";
$values = mysql_query("SELECT * FROM ".$table."");
while ($rowr = mysql_fetch_row($values)) {
for ($j=0;$j<$i;$j++) {
$csv_output .= $rowr[$j]."; ";
}
$csv_output .= "\n";
}
$filename = $file."_".date("Y-m-d_H-i",time());
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv" . date("Y-m-d") . ".csv");
header( "Content-disposition: filename=".$filename.".csv");
print $csv_output;
exit;
?>
modified on Monday, February 2, 2009 11:11 AM
|
|
|
|
|
no it showed 3 records.
Now i am trying the script you had given.
Thanks for that.
I hope works.
|
|
|
|
|
Sorry, like I said I had a brain freeze decided to test your knowledge , in limit the first number is your starting record and the second number is how many records to gather after that point, so limit 200,100 would get you records 200 to 300 inclusively.
|
|
|
|
|
That script will STILL timeout unless you connect to mysql manually through a command line and bypass php, that script will only work if you up the timeout php allows.
|
|
|
|
|
Thank you very much.
Its working.
Can i have you email so that.
|
|
|
|
|
|
Just i want to make a good friend.Even i have many more doubts which
is taking a long time posting here.So if you give you email we can go
through chat (yahoo,live,etc...).
That too I don't have a friend who have stuff(strong knowledge).
Of course i am also not bad.And i want to talk many more,here is the not
right place to talk.
|
|
|
|
|
Here is the PERFECT place to talk. You will get input from an array of people using different practices, with stronger knowledges is certain areas. You can get the best of all worlds by posting here instead of just getting input from one person.
So no, if you have something to ask, ask it here. It is the best place to ask.
Don't forget, you got your answer to your question by posting here, why stop doing that
|
|
|
|
|
May be you are right.This is the best place i accept but getting
response took 1 day that is why i said that.
Any way thanks for the help.
I have another doubt with php.
that is can we run php for life time?
i want to run a php that checks the site www.example.blog.com(say) and copy
newly add file to the site to my site.
I tried to call php from another php using curl and made it run 3 hours but
did helped to complete my task.
Have any idea.
|
|
|
|