Sunday, August 2, 2009

How to use PHP and Javascript writing made easy?

I have some codes (php and javascript) already and I like to know HOW to input them into Frontpage 2003. Anyone knows any good sources to use?

How to use PHP and Javascript writing made easy?
get it on a page, then in internet explorer, go to file-%26gt; edit with frontpage.
Reply:You cant' frontpage is an html editor. Open your pages source and paste them there. You need to have a webhost with php enabled.

flower arranging

How to retrieve index number of an array in PHP?

I want to search an array to see if it has "()" in it, and then return the index number of the string in the array. How?

How to retrieve index number of an array in PHP?
If the text is exactly equal to "()", you can use the array_search function





$index = array_search("()",$arrname);





where $arrname is the name of the array


How do PHP, HTML, JavaScript, and CSS intertwine with professional business websites?

What is used primarily to build the site with? PHP or HTML?

How do PHP, HTML, JavaScript, and CSS intertwine with professional business websites?
HTML is the language mostly found in websites. inbedded into the HTML code you will find JavaScript.PHP.and CSS.





HTML is what you see. CSS is what tells html what colors, fonts and other Styles the HTML is suppost to be.





JavaScript tells HTML how to do certian things like make a pop up window or something.





PHP tells HTML what to do and how to do it.





To make a website all you need is HTML, you dont need css.JavaScript, or PHP. However it is nice to have them.
Reply:well HTML is what your browser IE or firefox see, and PHP is the script that does the server side work and runs at server like APACHE.





Javascript is mostly for client side use can be used to server side work with this current AJAX technology in progress.





CSS is to make your webpage design more dynamic it is for client side (browser)
Reply:A website is created through HTML. HTML provides tags that enables you to create your own website. A website can still be created without PHP.





PHP is just a tool to receive and send data to your web server.





CSS is a tool to add styles to your website. It has more advance styles features than html.





JAVASCRIPT is a tool you can use to add styles, and send and receive data to your web server.


What free php,sql databse webhost gives the most free space?

What free php,sql databse webhost gives the most free space?

What free php,sql databse webhost gives the most free space?
I like http://www.000webhost.com/
Reply:you can run a database off your own computer


i really recomment downloading XAMPP


setup is soo easy and it takes like 3 minutes.





and yes it is compatible with Vista





http://sourceforge.net/projects/xampp/


In my php database, all pictures are stored in 1 folder. How can i back them up fast and organize them withphp

I own a dating website with thousands of profiles now so all images are in same folder and i always need to do a long and heavy (20 gb) backup, how can i program it with php to make faster backups? What does other websites do? It's a programming question, thanks

In my php database, all pictures are stored in 1 folder. How can i back them up fast and organize them withphp
you should try to compress all the files.





or try using ftp to download all files.
Reply:You can't, really...


You could create a second folder and copy your initial one into it, but this will double your site size and still be on the same server!


Your server supplier (or yourself if you have set-up your own server) should do backups or have a "mirror" server. Ask them.


For the rest, I can only see an FTP download from your server to another machine.


There are FTP functions in PhP that will allow you to do so.


Check www.php.net for details.

flower arrangement

I need a library to convert pdf file to images from a php script?

Do you know if there is any php library that will allow me to extract pages from a pdf file to images? I need a library that will allow me to do this process from a php script.

I need a library to convert pdf file to images from a php script?
See the PDFlib and PDF import libraries.


How do I send data from a form in a website to a certain email add using PHP script?

This is for our school project, wa are suppose to make a reservation form that will be linked into a certain e-mail address.. wa are advised to use PHP scrip. what are the codes that i have to include into my form to send the data inputted by the customers.

How do I send data from a form in a website to a certain email add using PHP script?
Heres a sample email script for you to play with.


Place this on the form submission page %26amp; edit to your needs:








$emailfromaddr = "name@outgoing_server.com";


$emailfromname = "Your Name";





$emailheaders = "From: $emailfromname %26lt;$emailfromaddr%26gt;\n";


$emailheaders .= "Reply-To: $emailfromaddr\n";


$emailheaders .= "X-Mailer: PHP/" . phpversion() . "\n";


$emailheaders .= "X-Sender-IP: $REMOTE_ADDR\n";





$emailtoaddr = "name@incoming_server.com";





$msg = "First line of your email body\n";


$msg .= "Second line of your email body\n";


$emailsubject = "Subject of this email";





mail($emailtoaddr, $emailsubject, $msg, $emailheaders);








Also, check out the manual for more info on email headers if needed:


http://www.php.net/mail
Reply:check here for your answer


http://php.resourceindex.com/Complete_Sc...





http://www.sitescripts.com/PHP/
Reply:first off, I hope your school has a server where it has sending email through websites enabled. You can find fast email scripts on through google/yahoo search.





You have to take the input values, post back to the same page or another page, capture the values and then place them in a mail function. The mail function has a send property that will send off the email. This is true in all web programming languages.


Can a yahoo group database be accessed by php from an external website?

I have a yahoo group database and I'd like to be able to display results from it on another webpage. Could I create a member that only has view rights to the database, then use php to retreive results from it to be displayed on a page that is not part of yahoo?

Can a yahoo group database be accessed by php from an external website?
only if it offers the rs feed


How do I embed Youtube videos in PHP type forum messages?

I tried just copying and pasting the code from you tube but it doesn't work. Any help? I'm a noob.

How do I embed Youtube videos in PHP type forum messages?
See Video link.


If you have just c+p the code it wont save as it will need some title in the heading.
Reply:Ok how about trying another site that has the same song and see if it does copy and if it doesn't..then you might wanna try downloading the video from youtube the posting it on your whatever.
Reply:Try VideoGet. It downloads from YouTube, Crunchyroll, MetaCafe and other 440+ video websites.


Full List Of Supported Sites:


http://nuclear-coffee.com/php/supported_...





VideoGet also providing you with ability to convert each video in most popular formats for more comfortable video playback. VideoGet supports AVI, MPEG1, MPEG2, WMV, FLV, MP4, 3GP, MP3 file formats, so you will be able not only to view it, but also put it into your iPod, mobile phone or any other portable device





Watch here:


http://www.youtube.com/watch?v=6R9VCNtFr...

eurovision song contest

How can I print all the content of the files in a certain directory using PHP?

Say that I have a folder called "example" and that there are the following files in that folder:


"example1.txt"


"example2.txt"


"example3.txt"


...


...


...


...


"example100.txt"











What do I do to print all the CONTENTS of the text files using PHP?





Thanks.

How can I print all the content of the files in a certain directory using PHP?
$directory = "/your_dir/examples/";





if ($dh = opendir($directory)) {


// go through each file in the directory


while (($filename = readdir($dh)) !== false) {


// open individual file and print its contents


print file_get_contents($filename);


}


closedir($dh);


}





$dh is just the data handle. You don't have to worry about its value. It's automatically set when you run the open_dir($directory).


How Do I load php into an div tag on another page?

I have a .php page already set up. Now I'm looking at trying to load that php file into a div tag of a certain size on another page. What code do i have to put into the div tag to make it work?

How Do I load php into an div tag on another page?
You need to make the file that has the div tag a php file too





Then do something like this


%26lt;div%26gt;


%26lt;?php include("other-php-file.php"); ?%26gt;


%26lt;/div%26gt;
Reply:As others have said, it's easiest if the other page is also PHP, because then you can just use an include statement.





The emerging answer is to use AJAX for this problem. Have your container page use an AJAX library (like jQuery) to make a request of your PHP program, and place the results directly in your div. The advantage of the AJAX approach is you can have the contents of the div change in real time without having to re-create the entire page.





Good luck!
Reply:You can use a php include, but both pages have to be php. Example:





page2.php :





%26lt;div style="position:absolute;"%26gt;


%26lt;?php include('page1.php'); ?%26gt;


%26lt;/div%26gt;


How to post a sentence of an input of a textarea into a database using php?

Okay so we have a textarea


%26lt;form%26gt;


%26lt;textarea%26gt;%26lt;/textarea%26gt;


%26lt;/form%26gt;


In this form users will submit a bounch of sentences like:





Tim has 10 apples


Tim has 24 bananas


Tim has 19 grapes





I want to ignore the first sentence and add the second and third sentence into a databse...Help!

How to post a sentence of an input of a textarea into a database using php?
Give the form a submit button.


Give the textarea a name (like %26lt;textarea name="userinput"%26gt;%26lt;/textarea%26gt;)


Post the form with the submit button


Pull the post variable:


$textarea = $_POST['userinput'];





It's going to be difficult to strip the first line though, as users may not always use a period to finish a sentence. In any case, check out http://www.php.net and do a function search for str() to learn about the string functions.
Reply:Trimming the first sentence is a problem as there's no consistent way to demark the end of the first sentenence try using two fields, a text box for the first sentence and the textarea for the rest. Linebreaks are notriously difficult to capture via textareas..


How can I seperate code and design in php(web development)?

I want to separete my php coding from html-design. So that I can outsource my design work. Any way?

How can I seperate code and design in php(web development)?
Use Template Engines.





Either try to find good alternatives of PHP template engines by googling the term "Php template engine"


http://www.google.com/search?q=php+templ...





or download and use smarty from


http://smarty.php.net/

wedding song

How to configure and install apache, php and mysql without using any wamp and xamp pachage?

Please said, a step by step level of how to install and configure these three things, particularly in windows xp.

How to configure and install apache, php and mysql without using any wamp and xamp pachage?
This doesn't have the SQL install instruction's but trust me that is really, REALLY, easy Just install a GUI for SQL like MYSQL admin unless you want to use the command line.





http://wamp.corephp.co.uk/
Reply:Try this website. It's what I used to configure those things also (it is an easy to follow step by step guide:





http://www.expertsrt.com/tutorials/Matt/...





Good luck
Reply:Apache: install to the directory


php: just copy the folder to the desired directory


mysql: after install it should prompt you whether you want to configure it down. You just need to follow the step and finish.





Configuring apache and php


1) In php folder, use php.ini-recommended, copy and rename to php.ini





Add the following line to the end of the file:


doc_root = c:\apache\htdocs





Look for extension_dir, and set to the extension path. Ex: C:\php\ext








3) Under the Apache folder, locate the conf directory and look for httpd.conf





4) Add the following line to the end of the file:





# For PHP 5 do something like this:


LoadModule php5_module "c:/php/php5apache2.dll"


AddType application/x-httpd-php .php





# configure the path to php.ini


PHPIniDir "C:/php"





Note: Remember to substitute your actual path to PHP for the c:/php/


Different apache version uses different ".dll" package.





Read the install.txt in the php folder.


How can i find out where my php site connects to its database, and am i able to connect to that database?

A guy has made me a php site but i cant findout how to connect to its database because i want to setup a uk version of my site and when i change the US site the UK database is also changed. Please help thanx for your interest...

How can i find out where my php site connects to its database, and am i able to connect to that database?
You must have access to SQL server (usually MySQL located on the same machine) and give user permissions to read from it.


How do i update two tables in php: i want to update a table that stores stocks received once an item issued?

i want to decrease the field 'quantity' by the amount issued from the 'issuing page'.e.g. if 8 pens are in store,and i issue 2 and the stocks received table to have 6 in its 'quantity' field. please help me with the php code, i will really be grateful coz am so stuck!!!!!!!!!!!! thanks guys.

How do i update two tables in php: i want to update a table that stores stocks received once an item issued?
Get the values you need and then assign them to variables:





$quantity = %26lt;the quantity%26gt;;


$issued = %26lt;issued amount%26gt;;





$result = $quantity - $issued;





echo $result;





How you find out %26lt;the quantity%26gt; and %26lt;issued amount%26gt; will depend on how your tables are set up? Is a GET, POST, or MySQL?





If you describe your setup a bit better it would help.


Where can I get a free php layout I can tinker with?

I'm trying to make a web page, my knowledge of php is too limited to start from scratch, Is there a free layout with a built in menu, body and title bar I can tinker around with?

Where can I get a free php layout I can tinker with?
PHP is coding that goes inside of HTML/CSS pages. So you aren't looking for a "php layout", but an "html layout".





Take a look at the open source web design site:





http://www.oswd.org/





Another great (!!!) site is CSS Zen Garden:





http://csszengarden.com/








Start with one of these page layouts, and start peppering it with your PHP code (though the better approach is to convert the layout into a template, using something like Smarty (see link below), and use PHP to publish the templates).

stamen

Where can i find the code of a perticuler project or site in php?

iam learning php so i want to see the code of some projects or sites where can i find them?

Where can i find the code of a perticuler project or site in php?
In your browser, click view %26gt; source.
Reply:View Source won't show php codes I believe. I think the best place to find sample codes would be to go on tutorial websites. Google search for php tutorials to find them.
Reply:For free check w3schools.com or else you can check website like http://buyscript.in/ .


How do I hide php script from browsing page source?

I do make a simple php scripts and use the apache as server and mysql as database.... But when I browse on another PC the php programs output then brown then save the page as is in php format... it saves the same scripts as in what I programmed... How can I protect my scripts from browsing by the another pc / clients

How do I hide php script from browsing page source?
It sounds like Apache is not interpreting the PHP scripts as scripts, so that instead of executing the code, it is simply sending the scripts as data to the client. You'll have to change your server options, and unfortunately, you didn't give enough information for me to give you exact instructions.
Reply:Depending on the webserver, you'll need to add a handler for the php extension.





In apache for example you would add:





AddType application/x-httpd-php .php .phtml








Which tells the server to parse any file with a .php extension.
Reply:Yes, if it is seen as a script it won't be sent to the browser as text.


What is the best way to remove spaces from a string in PHP?

I want to keep single spaces, but remove any instances of 2 or more spaces in a row.





I did a lot of searching and I found two examples, but I don't know what the difference is between them and which is better to use:





$string = preg_replace(‘/ss+/’, ‘ ‘, $string);





or





$string = preg_replace('/\s\s+/', ' ', $string);





Thanks!

What is the best way to remove spaces from a string in PHP?
This is really about how to build a proper regexp:





\s means a whitespace character


s means the letter s


+ means match one or more times





so to replace all instances of multiple spaces with a single space, use just /\s+/ and it will do what you want (ok, and replace single instances as well, but it won't hurt).
Reply:preg_replace is a complex function that involves a lot of "replacement rules". To be avoided when you can!


Instead, use just:


$newstr = str_replace ( space, nothing, string );


space : dble quote, space, dble quote


nothing: dble quote, dble quote.


string: $string or dble quote abcd efg h i dble quote


See www.php.net, str_replace function


How do you pass the current url of a page to a PHP script?

Is there a PHP code to take the current url and place it in a HTML script?

How do you pass the current url of a page to a PHP script?
http://discomoose.org/2005/11/02/how-to-...

sim cards

Why are mysql database's able to access data faster than a php drivin database?

I mean they both need to access a physical hard drive right? How does google do it? When my php database gets big it chugs, and it's useless.

Why are mysql database's able to access data faster than a php drivin database?
Are you talking about a mysql database, and a database you wrote using php?





If so, mysql is compiled and specifically optimized to be able to handle large databases.





PHP is intrepreted so it's slower and uses more memory and is in now way designed at all to handle the kind of stuff large databases required.





They use the same hard drive, but one is far more efficient at it then the other.
Reply:mysql is database, php is a server side scripting which u use to access mysql databases ;))


How do you open a web page from another webpage in PHP?

What code do I use to open another web page from the web page the user is currently has open.

How do you open a web page from another webpage in PHP?
Don't know coding but seems do me you would create a link. Most software usually has a command to highlight the area and create link.
Reply:Do you want to output a dynamic link on your site?





%26lt;a href="%26lt;?php print "http://yahoo.com"; ?%26gt;"%26gt;Link%26lt;/a%26gt;





%26lt;a href="%26lt;?php print $myvariablelink ?%26gt;"%26gt;%26lt;?php print $myvariable title ?%26gt;%26lt;/a%26gt;





%26lt;?php print "%26lt;a href=\"$myvariablelink\"%26gt;$myvariabletitl... ?%26gt;





Are you wanting to forward the user to a different page? (Must be sent before any output is printed.)





%26lt;?php


header( "Location: http://yahoo.com" );


exit;


?%26gt;





or (can be executed after output has already been sent to the browser, but requires javascript or a click)





%26lt;?php


print '%26lt;script language="javascript"%26gt;window.location = "http://www.yahoo.com";%26lt;/script%26gt;';


print '%26lt;noscript%26gt;Please click %26lt;a href="http://www.yahoo.com"%26gt;here%26lt;/a%26gt; to move along%26lt;/noscript%26gt;';


?%26gt;





Do you want to read in another web page and output it on your own? (Requires allow_url_fopen to be enabled in the configuration.) Be careful about doing this sort of thing, because if a hundred people hit your page, your server makes one hundred sudden requests to download. If this is the route you're after, look into cacheing/saving the result for a period of time or get fancy and ask the web server if the page has been updated.





%26lt;?php


$url = "http://www.yahoo.com";


$f = fopen( $url, "r" );


if( !$f ) die( "Could not open $url for reading" );


while( !feof( $f ) ) {


$data = fread( $f, 1024 );





// Print it out


print $data;





// Or store it in a variable


$text .= $data;


}


fclose( $f );


?%26gt;





Hope that helps.
Reply:Straight HTML %26lt;a href="http://www.example.com"%26gt;Text%26lt;/a%26gt; would create the link.





If you want to display the page within the page take a look at %26lt;iframe%26gt; or %26lt;?php include(''); ?%26gt;


What php script will allow me to add html directly?

PHP script will allow you to add HTML directly without adding any other line of code to the php?





What code will allow me to just type in html?

What php script will allow me to add html directly?
Acually it is the way arround. HTML4 allows to use php or other scripting languages embedded in it.





For more infos get yourself a few tutorials right here:








Good luck,





Joe





http://www.php.net/manual/en/introductio...
Reply:I dont get your question??








%26lt;?





html code





?%26gt;


or





%26lt;?





echo html code dynamically


?%26gt;


How do i write PHP/MYSQL Code to search on the first value of a database field that is stored as a csv list?

I have a table - Product.





Product.Keywords is a csv list of entries. I want to be able to pull out all of the Product records whose first entry in that field matches the first entry in the field of the Product record I currently have available.





IE keyword of my product is (say) "fish, chips, peas". I want all the products whose first keyword is "fish" but excluding my original product.

How do i write PHP/MYSQL Code to search on the first value of a database field that is stored as a csv list?
LIKE 'fish%'

garden ridge

What is the php code for checking the char length for the first word in a string?

If the first word in a string is longer than about 9 characters, I'd like to truncate it or insert a "- %26lt;br%26gt;". Actually, I may need to do this with any word in a string to make sure it fits into a tight space.

What is the php code for checking the char length for the first word in a string?
If your string is made up of multiple words separated by spaces, then you should find the position of the first space and that will tell you the length of the first word. And if there is no space, then return the length of the string. Here's how:





$firstWordLength = strpos("$string ", " ");





That extra space after $string takes care of the case where $string does not have any spaces.
Reply:strlen(word) will return length of the word.
Reply:Try the following


Replace $strString with your string.


if(strlen(substr($strString,strpos($st... " ")))%26gt;9)


{


/**


* Do this


*/


}


What are the advantages and disadvantages of php over visual basic?

im making a thesis (inventory/information system) and im using php for it. A friend of mine told me that i should use VB instead. because it can run as is unlike php which is only web based.

What are the advantages and disadvantages of php over visual basic?
Really they are for completely different things.





PHP is more designed for web development, but it is easier to port between systems, since it is interpereted. PHP also has native bindings to many database systems, including Oracle, MySQL, PosgreSQL, and others, but not a native connection to MSSQL or SQL Server (to my knowledge).





VB is more designed for applications. However, they only will work in Windows. VB, if I remember right, as a MS product, does have native bindings to MSSQL and SQL Server, I don't know about other databases though.





If you are making a full featured application, I recommend using either Java or a C/C++ language. If it would make more sense to make a web based app, even just an intranet based one, use PHP.
Reply:In your case if you need to use this system on the web and the user need to access at through the web then you should use the PHP , if you do need that so go to VB
Reply:There are database adapters for MSSQL and SQL Server in PHP.





I think using the fact PHP is widely used for web programming as an argument against it, is being really closeminded.





PHP is perfectly capable of being used as a system or application scripting language. It's efficient and quite fast too; and the code is portable across platorms very easily.





Have you considered looking at other languages that share PHP's strengths? I'm thinking about Python. That's a really excellent language, it's as portable as PHP and it's much better than VB.





You probably have a Python interpreter running already, if you'd like to try it.


How do you download and view a .php video file? Do you need a software program?

I can download and view a php video file but when I forward the file to others they say they are unable to open a php.


Any suggestions

How do you download and view a .php video file? Do you need a software program?
php is not a video file format - it is a scripting language that may have been used to code the page in which a video file resides. Try right clicking on the video to get properties and file name/type of that video.
Reply:try renaming the file adding .wmv at the end of the filename. im not sure though. but try it.


How do I tell PHP/MySql where to load my images?

I am new to php/MySql.


I have a mini site almost ready. I want to know how I can load the images I select to a certain table/area on my webpage.





Thanks for any help.

How do I tell PHP/MySql where to load my images?
are the images being chosen dynamically?





If not, its just simple HTML - %26lt;img src="myImg.jpg" /%26gt;





otherwise it is still just simple html, just with a splash of PHP - %26lt;img src="%26lt;?php echo $imgSrc;?%26gt;" /%26gt;





You can include that right in the middle of whatever HTML you use for your page.

flowers for algernon

What is the correct way to edit a database entry in PHP?

I fetch results with PHP by selecting a dates. I have a (lowerlimit) and (upperlimit). Ex.When i select Nov-2006, it displays all entries(journal) for the month of Nov in 2006 in a typical forum format.





I would like to add a %26lt;a href%26gt; tag at the top right of each result that comes back that would do the following. The a-href would direct the user to a different page say 'editentry.php?y=2004%26amp;m=12%26amp;d=14 . At the top of editentry.php, id use _GET to fetch that particular entry and enter the results into a form. The form would be identical to the original form that was used to enter the information into it.





So the user would have all those entries fields in plain view. The auto-increment-primary key field and the date field would be viewable but not editable.





Anywho, at the bottom of editentry.php when all the changes are made, there would be a "submit changes" button and a "delete entry" button.





What would the mysql command be to


a)resubmit


b)delete





tyvm

What is the correct way to edit a database entry in PHP?
Let's assume you have a table with four columns: The uniqueid field, a datetime field called mydate, a text field called myname and a text field called mytext.





From your menu page, you would simply list off the records in a table. A column on the left would be the edit link column, and a column at the right would be the delete column.





%26lt;?


'your connection info


$rs = mysql_query("SELECT * FROM mytable");





if(mysql_num_rows( $rs ) == 0) {


echo "No records";


}


else {


echo "%26lt;table%26gt;";


echo "%26lt;tr%26gt; %26lt;th%26gt;Edit%26lt;/th%26gt; %26lt;th%26gt;My Name%26lt;/th%26gt; %26lt;th%26gt;My Date%26lt;/th%26gt; %26lt;th%26gt;My Text%26lt;/th%26gt; %26lt;th%26gt;Delete%26lt;/th%26gt; %26lt;/tr%26gt;";


while($row = mysql_fetch_array($rs)) {


echo "%26lt;tr%26gt;";


echo "%26lt;td%26gt; %26lt;a href=\"edit.php?id=$row[uniqueid]\"%26gt; Edit%26lt;/a%26gt; %26lt;/td%26gt;";


echo "%26lt;td%26gt; $row[myname] %26lt;/td%26gt;";


echo "%26lt;td%26gt;" . date( 'F j Y g:i a', $row['mydate']) . "%26lt;/td%26gt;";


echo "%26lt;td%26gt; $row[mytext] %26lt;/td%26gt;";


echo "%26lt;td%26gt;%26lt;a href=\"delete.php?id=$row[uniqueid]\"%26gt; Delete%26lt;/a%26gt;%26lt;/td%26gt;";


echo "%26lt;/tr%26gt;";


}


echo "%26lt;/table%26gt;";


}


?%26gt;





This code calls on two pages: edit.php or delete.php. It uses the uniqueid column to know which record to edit.





Let's do delete.php first, because it's quick and dirty. All we'll do is run a SQL command to delete the record and kick the user back to the list page (which we'll call list.php). We don't need any HTML; just connect to the DB and let PHP do the work.





%26lt;?


'your connection script





if(!isset($_GET['id'])) {


header('Location: list.php');


}


else {


$sql = "DELETE FROM mytable WHERE uniqueid = $_GET[id]";


$rs = mysql_query($sql);


header('Location: list.php');


}


?%26gt;





Edit.php is a bit more complicated. We need to both get the current record, so we have something to edit, and update the record. We first check for page postback; if it is set, we go ahead and update the record. Then, we get a recordset corresponding to the same ID, and populate the form fields with the data:





%26lt;?


'your connection info





if(!isset($_GET['id'])) {


header('Location: list.php');


}





if(isset($_POST['submit'])) {


$sql = "UPDATE mytable SET myname = '$_POST[myname]', mydate = $_POST[mydate], mytext = '$_POST[mytext]' WHERE uniqueid = $_GET[id]";


$rs = mysql_query($sql);


}


$sql = "SELECT * FROM mytable WHERE uniqueid = $_GET[id]";


$rs = mysql_query($sql);


$row = mysql_fetch_array($rs);


?%26gt;


%26lt;html%26gt;


%26lt;head%26gt;%26lt;/head%26gt;


%26lt;body%26gt;


%26lt;form method="post"%26gt;


Record ID: %26lt;? echo $row['uniqueid']; ?%26gt;



My Name: %26lt;input type="text" id="myname" value="%26lt;? echo $row['myname']; ?%26gt;" /%26gt;



My Date: %26lt;input type="text" id="mydate" value="%26lt;? echo $row['mydate']; ?%26gt;" /%26gt;



My Text: %26lt;input type="text" id="mytext" value="%26lt;? echo $row['mytext']; ?%26gt;" /%26gt;



%26lt;input type="submit" id="submit" value="submit" /%26gt;


%26lt;/form%26gt;


%26lt;/body%26gt;


%26lt;/html%26gt;





Note that this code is not very secure and does not trap for errors. It's just illustrative. It works but it's not ready for prime time.
Reply:http://www.dougv.com/blog/2006... Report It

Reply:I am assuming that you are passing the row id of the item they are editing to your editentry.php and putting it into a hidden form field or embedding it directly into a form "action" URL (the address where your form is to be submitted to make changes... this could be submitting back to editentry.php or to another page it is up to you.)





So now they have hit either the update or delete button and it reloads the page with the row id and the new values that have changed. So simply all you would then do is issue an SQL update or delete according.





%26lt;?php





$action = $_POST['action'];


$id = $_POST['id'];





if (($action != null) %26amp;%26amp; ($id %26gt; 0)) {





if ($action == 'update') {


$sql = "Update table set column = $newfield, column2='$newfield2' where id = $id";


}





if ($action == 'delete') {


$sql = "Delete from table where id = $id";


}





mysql_query($sql);


}





?%26gt;





I just threw that out to give you a rough feel of the flow. That is how you would go about it. Again make sure to check your values for reasonableness / correct info before inserting into dynamic queries like this (to prevent SQL injection attacks).





Hope you get the idea out of that quick scribble. Good luck!


Where can I find an advanced PHP tutorial that builds a complete and real system?

I would like to see a PHP tutorial that builds a complete web application such as a portal or CMS without using a framework (preferably with PHP 5 but not a must).

Where can I find an advanced PHP tutorial that builds a complete and real system?
I doubt you'll be able to find one. It would take much much more effort in writing a tutorial then actually building the application, while building the actual application is much more (potentially) profitable.





And anyway, this is not a very effective way of learning, IMHO. What you should do instead is, learn the basic, create small sites / applications, then gradually expand them to bigger ones.





Once you get enough knowledge of the language, it doesn't really matter what type and what size of application you are building, you'll be able to do it, as long as you can afford the required time and effort.





Of course along the way you may find problems that you can't solve, but being such a popular language, you'll be able to easily get help from other PHP programmers.





So my advice:


- first learn enough the basic of the language


- then start implementing yourself, starting from small applications


- ask for help when you come across specific problems. The more problems you get, the more you learn.
Reply:You're asking for a lot with that one! I recommend a book called Advanced PHP by George Schlossnagle. It'll run you through all the various concepts and theories of approaching such a big system else you'll find yourself in over your head before you know it without a pre-established framework, such as the Zend Framework which comes highly recommended from me.





Adam @ http://www.talkphp.com/
Reply:I strongly recomend you getting a book





this one in particular





http://search.barnesandnoble.com/booksea...





it teachs you , focusing on finishing a whole system project





cheers


How do you find remote file system directory paths with php?

I need to find out what a websites absolute path is on a remote file server. Is there a php script that will accomplish this?

How do you find remote file system directory paths with php?
You can use SERVER variables for this. The link below has a list of all of these. The ones you can try are DOCUMENT_ROOT and SCRIPT_FILENAME





http://us3.php.net/reserved.variables


Do you know a site where i cold find php price lists for personal care products?

(e.g. soap, feminine wash) i tried sm hypermarket's site. but it just wont work. please.thanks.

Do you know a site where i cold find php price lists for personal care products?
i hope this website would be of help to you ---





http://www.filipinolinks.com/Entertainme...
Reply:look up on googles, there are lots of web site you can look for

business cards

Does someone knows where can I find the php code of a blog?

I want to post my own blog, but not to program all I would like to know if there's somewhere the php code.

Does someone knows where can I find the php code of a blog?
You can use blogger.com, and instead of setting up the blog on their site, you can choose to have the files stored on your own site when you setup the account.





http://www.blogger.com
Reply:·A blog is an online diary where people share their thoughts and daily activities. Due to the easy availability of online publishing tools, even an average internet user can start a blog.





Blogger,


LiveJournal,


Xanga,


Typepad





these are some free blog hosts with template and design tools , more details available at-





http://www.pcworkathome.in/blog.html
Reply:there are many open source Blog tools try wordpress for instance


PHP how do you limit the number of characters displayed from a result?

I'm making a search form for my site. It searches a column named 'description'. I was wondering if on the search results page you can limit the number of characters for that field of results. Kinda like on other search engines it will give you a description of what items it found with a "..." after so many characters. How do you do this?

PHP how do you limit the number of characters displayed from a result?
%26lt;?php


if(strlen($myDescription) %26gt; 50) {


$showDescription = substr($myDescription,1,50) . "...";


} else {


$showDescription = $myDescription;


}


echo $showDescription;


?%26gt;





enjoy!
Reply:Use the substr() function:





http://www.php.net/substr





For example, to trim a string $str to 50 characters, you can do:





substr($str, 0, 50);
Reply:Is this more a MySQL question? You mention column, I take it you mean a column in a table.





If so the the key is to use SELECT Blah WHERE input LIKE





See Link below for more detail

birthday cards

What is the best connection management design in PHP for mysql?

I am trying to find out the correct most efficient way to deal with mysql connections in PHP. My goal is to make sure I do not run out of connections. I have read that using persistent connections is a way to run out of connections if you have too many users. If opening and closing connections is not time intensive, will that be a better way to manage them?





Example:


$conn = mysql_connect(...);


mysql_select_db(..., $conn);


...


$info = mysql_query($query, $connection);


...


/* do a bunch of stuff to render the results to the screen */


...


mysql_close($conn);








If there is a lot of work to render to the screen, is it a better deal to save the query results off to another variable, free the resource memory and then close the connection before ever rendering to the screen?





Code examples would help, and documentation about how you know it is the best way is also preferred.





Thanks.

What is the best connection management design in PHP for mysql?
Here are some resources... I tend to the use the ezmysql/wordpress style with cache. I have yet to run into any performance issues or an overloaded mysql instance.


How to view images from mysql database using PHP?

I've been studying PHP for the past month and I am having trouble retrieving images from my database to my page... do you have any codes for this?

How to view images from mysql database using PHP?
Check this article out it may help you with your issue





http://www.onlamp.com/pub/a/onlamp/2002/...





Generally you don't store images in a database.It's a bad practice since images are not search able files and it causes a ton of overhead issues. You store file link URLs in a database based on a hash. Their are many differing thoughts on which method is best though relating to images and databases.


What is needed to make a php forum on website?

I need hosting for this domain name and want a PHP forum. What is needed to make a php forum on website? My SQL, PHP, PHPmyadmin and PHBB2 . Answer me. Also give me websites that offer featured forum in $1 - $5 monthly price of hosting.My website is http://www.stanaca.com .

What is needed to make a php forum on website?
I am really in love with MyBB. I have seen some very good sites running on MyBB forum software which is a free one.





Ex: http://www.nameslot.com
Reply:To run phpBB2, you need MySQL, PHP, and some webspace.


I want to find someone to install php script on my server?

The problem is when i trying to install the script,


Internal Server Error message appear, i dont know what should i do?

I want to find someone to install php script on my server?
download this http://www.wampserver.com/en/download.ph... It will install PHP, MySQL and Apache all together.
Reply:contact me through the rentacoder.com





bets regards


pgal
Reply:ask MR.Anand
Reply:First of all, show us the exact error message that is being displayed as a result of th error. Make sure you have PHP installed correctly and that your server knows where php is. Check your configuration files.

sepal

How to make a calendar in php?

I have tried to make it and nothing has worked. This is for a blog site. I would like it so, you can click the date to show the blog of that day.

How to make a calendar in php?
There are many solutions





http://evolt.org/node/60673





is fairly simple.





Though perhaps





http://keithdevens.com/software/php_cale...





is more appropriate.


How would I use a checkbox and submit button in html or php to make the text following bold and timestamped?

I want someone to be able to mark off a task and have it timestamped and remain un-editable.

How would I use a checkbox and submit button in html or php to make the text following bold and timestamped?
That is actually pretty complicated.


Basically, give the checkbox a value like value='box1checked' and name it something like name='checkbox1'


Then, have the submit button reload the page.


The $_POST['checkbox1'] will have the value 'box1checked' or it could be an empty variable.


Now, within your html, embed the following:


%26lt;?php if ($_POST['checkbox1'] == 'box1checked') echo html to highlight text. ?%26gt;


Hey, if you can't figure this out, send me an EMail and I will whip an example up for you when I get home tonight.





***Your gonna need to implement MySQL to save any permanent data. that is a whole'nother story.
Reply:%26lt;?


if(isset($_POST['submit_form']) {


$time = time();


}





echo "text - %26lt;b%26gt;$time%26lt;/b%26gt;";


?%26gt;





Didn't catch your update. If you want to save this information you'll need a database and need to do a query as such.





%26lt;?


if(isset($_POST['submit_form']) {


$time = time();


$u = mysql_query("UPDATE table SET time='$time' WHERE task_id='".$_GET['id']."'") or die("error! ".mysql_error());


}


?%26gt;
Reply:do you want this to happen automatically on the page, or have an update in the database?





If you want it to happen in the page itself, without going back, updating the db, and requesting a new page you need to use javascript like:


%26lt;input type = "checkbox" onclick = "document. getElementById( 'mySpan' ). style+= 'font-weight: bold';"%26gt; %26lt;span id="myspan"%26gt;text to bold later%26lt;/span%26gt;





If you want the back end to control it, just use php to set a timestamp in the db related to that task (depends on how you have the database set up) and if that field is filled on a request surround the copy with a %26lt;strong%26gt; tag.





To disable a text field in html just include 'disabled = "disabled"' in the %26lt;input%26gt; tag.





You can make it do both, or just turn the act of clicking the checkbox into a submit by adding onclick = "this.form.submit()" to the checkbox input tag. It will then go back to the back end, updated the db, and request the page like I described.


Any programmers that can edit php format files on phpbb3 forums?

I need a programmer to add a feature tomy forum based site. I require a wizard type mod on the new topic feature.


I am willing to pay someone for their service.

Any programmers that can edit php format files on phpbb3 forums?
I am an advanced programmer who would be more then happy to help.





Contact me via the email feature of Yahoo and I will get right back to you.
Reply:surely you have to try


http://experthelps.com/


How do I write a PHP expression that tests whether an element of an array is defined?

If I have an array like so:





$array[0]=item1


$array[1]=item2


$array[2]=item3


$array[3]=item3





The elements 0 through 3 are defined. But array[4] is not defined. How do I write an expression that tests whether or not array[$i] is defined for($i=0; $i%26lt;=count($array); $i+=1)?

How do I write a PHP expression that tests whether an element of an array is defined?
Try this link.





http://us.php.net/manual/en/function.arr...

printable cards

How to configure Apache with PHP on WinXP Home?

I have Apache 2.2 installed and working, and I downloaded the installer for the latest version of PHP. However, the installation process doesn't have a configuration file setup for the Apache server. I've tried many web tutorials claiming to have a fix for that problem, but most of them are not for the latest version of Apache. Can anyone give me the step-by-step for this?

How to configure Apache with PHP on WinXP Home?
Read this URL:





http://www.php.net/manual/en/install.win...





What I do notice is that if you start the Apache server via the Windows services, it will not be picking up the php.ini file correctly. I have to start it manually via command prompt. I install cygwin to emulate UNIX shell on Windows and start Apache that way.
Reply:Not me. Sorry, I'm most technology dumb. (bad at grammar too)
Reply:This is not quite the answer you were looking for, but I'm putting it up anyway just in case you're interested.





The newest Ubuntu Linux (6.06) is available in a preconfigured server version, with Apache, MySQL, and PHP installed automatically as part of the OS install process. I'm pretty sure you can set it up dual-boot with WinXP. It's a free download at www.ubuntu.com.


Using the same variables between php and visual basic and serveral webpages?

Where can I find documentation on using the same variables between webpages and php and visual basic.

Using the same variables between php and visual basic and serveral webpages?
You can't share session variables between PHP and ASP.NET (I assume you mean ASP.NET when you speak of "Visual Basic").





Sessions in both PHP and ASP.NET are instantiated at the application level; since they are different applications, you can't share the values between the two.





You could, in theory, save the session key from PHP and attempt to retrieve it with ASP.NET and vice-versa. However, you'll likely find that there is significant corruption of the variables between the two, especially as you attempt to "hand them off" repeatedly.





It's far wiser to use a stated (written) method of storing variables. You can do it a number of ways:





1. Pass variables between pages via GET (querystring) or POST (submitted form).





2. Save the information in a cookie and get it that way. ASP and PHP can read cookies set by one another provided the cookies are in the same domain (for that matter, JavaScript can also read cookies set by PHP and ASP.NET in the same domain).





3. Save the variables to a database, XML or flat file and read them back in for each page.
Reply:Short of a third-party session-sharing solution, the only way is to use a common data store (like a database) and querystring variables, or cookies.





[If any term is unfamiliar, just look it up on Google]





To share data across PHP or VB pages, you should use Session.





To share a variable from a PHP page to a VB page, you need to pass a key. Let's say you have a User object in PHP. Give that a unique ID, like a GUID. Store the User object and the GUID in a database that PHP and VB can access, then redirect to the VB page like so:





page.asp?uid=3F2504E0-4F89-11D3-9A0C-0...





Then in the VB script, use that key to look up the user object in the database and restore it.
Reply:That's the answer. A session variable can be an array. So you could hold 50 things on an object and pass it into it without anyone knowing what your passing.





Another way is to pass each variable at the top of the page, but if any of it is sensitive like a user id the session id is the way to go.





Thirdly, use a Database. PHP and databases are great.





I threw 2 ways to help you learn below.


I need Help with a php script on my traffic exchange website?

I have a traffic exchange script written in php. Right now the members cannot add the credits they earn to the sites they're advertising and also I need to be able to search the site better in the admin area.





If you need more details, let me know.

I need Help with a php script on my traffic exchange website?
I would check out http://pixelspotlight.com/
Reply:I can't answer your main question. But the answer to your additional question "is anybody out there?" is "Yes, but no one has a clue what you're talking about."





Your question is very vague. What is the URL of your site? Where did you get the script? How would you intend for the members to "add the credits"? When searching the "admin area", are you querying a database?


How do you read data from an Excel spreadsheet using PHP?

I need to write some code that will open an excel spreadsheet and read the data stored in the spreadsheet. It's okay to know the type of data stored in the spreadsheet in advance, but not the specific data. I would like to be able to do this without saving the spreadsheet as a tab or comma delimited file first. I know that Microsoft uses a proprietary format to save its spreadsheets, but is there any way to read this format and reliably extract the data from it?

How do you read data from an Excel spreadsheet using PHP?
Yes, if you know the format. It's horrible and hard to get at.





Failing that you're going to need a library which you can hook into PHP. This will require some php hacking skills.





Or, you can try:


http://www.badblue.com/helpphpo.htm





Good luck.

love song lyrics

Friday, July 31, 2009

Is there a line of code I can add to a php guestbook to add image verification?

I am getting hit hardcore by spambots and loooove the format of my guestbook - the only problem is there is no image verification option. Can I add this myself?





The guestbook is Advanced Guestbook 2.3.1


Powered by PHP %26amp; MySQL - I know I can edit the code, im just not sure if its possible to include a feature like this.

Is there a line of code I can add to a php guestbook to add image verification?
Unless there's a premade modification out there, you'll have to add it in manually and it's usually more than a single line of code.





Here's a tutorial on how to make one


http://www.visualbuilder.com/viewpages.p...


And here's a pre made one, but you'll need to add it manually to your guestbook


http://www.cocoavillagepublishing.com/de...


How to store an uploaded file to a variable in PHP?

Is there a way to store a file to a variable rather than copying or moving it to a specified location in the server?

How to store an uploaded file to a variable in PHP?
Yes, you can use the file_get_contents() function.





Example where the field name for the uploaded file is "source":





%26lt;?php


$filename = $_FILES['source']['tmp_name'];


$text = file_get_contents($filename);





echo "This is the contents: $text";


?%26gt;


What is a good platform for writing complex web apps in php?

looking for a platform for handling business objects as well as application flow so people would not have to hard code each page transition and each business logic step in php.





What do people recommend?

What is a good platform for writing complex web apps in php?
You can use of of the many php MVC Framework. One of the most used one is phpMVC.





Quoted from their website "php.MVC implements the Model-View-Controller (MVC) design pattern, and encourages application design based on the Model 2 paradigm. This design model allows the Web page or other contents (View) to be mostly separated from the internal application code (Controller/Model), making it easier for designers and programmers to focus on their respective areas of expertise.





The framework provides a single entry point Controller. The Controller is responsible for allocating HTTP requests to the appropriate Action handler (Model) based on configuration mappings.





The Model contains the business logic for the application. The Controller then forwards the request to the appropriate View component, which is usually implemented using a combination of HTML with PHP tags in the form of templates. The resulting contents are returned to the client browser, or via another protocol such as SMTP.





php.MVC is a PHP port of Jakarta Struts. It currently supports many features of Struts, including declarative application configuration via the XML digester. For example, mappings from the various Action business logic components to appropriate results pages can be specified declaratively in the XML configuration file. "
Reply:Please consider that a "Good Platform" would take into account the environement that the application will be run in, goals for the application, and who is going to maintain the application.





I have successfully used Blueshoes, and Seagull in several contract projects. Blueshoes is pretty complex and has a learning curve, but is extremely useful framework, it also has some licensing restrictions that keep it in the corporate arena.





Seagull is actively developed and completely free. Seagull has TONS of documentation and a very active community.





Hope this helps.


What are the available characters in a url to get specific fields from yahoo! finance via a php page?

I want to be able to create a web page that allows a user to select fields, then create a quote from yahoo! finance using the fields the user selected. What are the field/keyword values that are available.





Please give me another useless answer like "it should be listed under help", or "look on the developer page".

What are the available characters in a url to get specific fields from yahoo! finance via a php page?
Hi,





Here's one approach that might work. I don't know if you already know about Finance Badges. They're documented at:


http://finance.yahoo.com/badges





These require IFRAME. That requirement is documented at:


http://help.yahoo.com/help/us/fin/badges...





If you don't have IFRAME support, this is probably a deadend. If you do, you can use the Finance Badge Wizard to generate static HTML code like this:





%26lt;!-- Start of Yahoo! Finance code --%26gt;


%26lt;iframe allowtransparency="true" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" src="http://api.finance.yahoo.com/instru... width="200px" height="338px"%26gt;%26lt;/iframe%26gt;


%26lt;!-- End of Yahoo! Finance code --%26gt;





This asks for quotes for Oracle (ORCL) and Pfizer (PFE). I supposed you could let your user select other stocks (up to 10), and substitute their ticker symbols where "ORCL,PFE" occurs in the above code.





(It turns out the link in the above text is live. If you click on it, you get a page with the quotes for ORCL %26amp; PFE.)





The tricky part is getting the code to "execute" with the new values your user chose. I wouldn't know how to do that.





There may be other Yahoo Finance APIs that I don't know about. Have you looked at Yahoo Widgets? They're at:


http://widgets.yahoo.com/


You don't want a widget, because a widget runs on the client side. But there are some stock quote widgets that retrieve data from Yahoo. You might be able to use whatever API they use.





Hope one or the other of these helps.





Added note: besides the technical problem, there's a legal aspect to this question. Basically Yahoo doesn't allow you to just retrieve data from their web site and display it at yours, without giving them any credit. That's one reason the Finance Badges, which do appear at your web site, say "Yahoo Finance" at the top and have a link to Copyright info at the bottom. I think the Finance Badges are the only Yahoo-approved way of displaying quotes from Yahoo at your web site.

greeting cards

How does one add a variable and a number in PHP?

I'm creating a verification script in PHP, to check if $var is set to "1". I figured using addition would be the easiest way to do so, so I tried this...





if ($var + 1) = 2){


print "The variable is set to 1.";


exit;


}





I must have an error in syntax or something, because I get an "unexpected '='" error when exeuting the script.





How do I fix up that code?

How does one add a variable and a number in PHP?
You need to use == which is the equal to comparison operator. A single = is an assignment.





$A=1 // Sets a to 1


$A==1 // Is $A equal to 1?The answer will be true or false.





More specifically:





if ($var + 1) == 2){


print "The variable is set to 1.";


exit;


}


Can someone please help me make a short and quick PHP code?

I am not really good at PHP, but I have 1 code that works:





if ($operation =="multiply")


{


$product =$firstnumber * $secondnumber;


echo ($firstnumber." * ".$secondnumber." = ".$product);





Now I want to make one that squares instead of multiply, so can someone help me build one?





Thank you in advance!

Can someone please help me make a short and quick PHP code?
I agree with the last poster, that's the quickest way to do it...but given that you only want to square...








if ($operation=="square")





{


$result=$number*$number;








echo $result;








}
Reply:if ($operation =="sqrt")


{


$product =sqrt $firstnumber;


echo (" The square root of ".$firstnumber." = ".$product);





This might work, IDK??!
Reply:Use the pow math function:





%26lt;?php


echo pow(4,2) . "
";


echo pow(6,2) . "
";


echo pow(-6,2) . "
";


echo pow(-6,-2) . "
";


echo pow(-6,5.5);


?%26gt;


Do you know any server, where I can create php sites and I can use mysql database?

I would like to use telnet or ssh session to administer my mysql database and develop my php sites with vi editor.

Do you know any server, where I can create php sites and I can use mysql database?
Hi


For information about free php hosting, visit the following url


http://www.0php.com/free_PHP_hosting.php


Regards
Reply:Thousands of hosts allow this, but you won't find any for free. If I had to recommend one, I would recommend GoDaddy.com. Great features, great speed, low cost.


Where to learn about designing my own role playing game; in the format of PHP?

I'd like to design my own role playing game; using PHP. The game would to include athletes competing against other atheletes. Kinda like a war game but intead this would be in the format of sports.





I know some basics of PHP. Basically, I am looking for a PHP role playing script that is easy to read and made additions.

Where to learn about designing my own role playing game; in the format of PHP?
Well, I can't help you in finding an existing script that you can modify, but PHP is a perfectly acceptable language for developing a text-based, static-image RPG. If you were to develop the basic outline of the game in simple pseudocode, I'm sure you wouldn't have any trouble finding someone willing to convert it into working PHP code for you on forums around the Web (or if you don't mind paying, on sites such as RentACoder.com). PHP isn't that difficult a language anyway, so you could probably do it yourself by just learning the basics.





For the record, the official PHP site is php.net (someone mentioned .org) - and you can't just go asking them to help you with your projects or do the work for you :)
Reply:erm u could ask some experts on php.org or email them i guess. i dont no much php tho
Reply:You're better off creating some sort of Java (not Javascript) app.

flower arranging

How do i connect to SQL server with PHP?

My pages run 100% ok on linux, but i need to use an SQL database and retain my PHP. This will probably run on a windows server. Someone give me the connection script for this.

How do i connect to SQL server with PHP?
If you have to connect to database in server you can use this script:


$connection=mssql_connect ($host, $username, $password);


But if you have to connect to the local host:


you should download Zip Package From this site(depends on php version):


http://www.php.net/downloads.php


and copy php_mssql.dll file to winnt\system32


and you should configure php.ini file by adding extension=php_mssql.dll
Reply:here's the code:





mysql_connect("hostname",


"username","password");





the username and password are optional, i think.





use this to connect to the database, i assume you already know this:





mysql_select_db("dbname");
Reply:what kind of SQL? if you meant MSSQL, here's how...





$conn=mssql_connect ($servername, $username, $password);
Reply:%26lt;?php


$conn = mysql_connect("localhost","USERNAME","PA...


mysql_select_db('DATABASE NAME') or die(mysql_error());


?%26gt;


sry are you talking about this ?
Reply:you might see the answer here:


www.w3schools.com


How to get a screenshot of youtube video thumbnail and put it on your website using php?

i want to make a video gallery on my website like this (http://slideshowpro.net/examples/), but instead called out the videos i've listed from youtube.





how to get a screenshot of youtube video thumbnail and put it on your website using php without having users to save the thumbnail from youtube and upload it to my server?

How to get a screenshot of youtube video thumbnail and put it on your website using php?
You can use the youtube api or standard rss feeds of youtube.


It provided all data that can be shared on your web site...


Rss feeds have xml format including


title


description


thumbnails


duration


rating


etc...


that can be displayed on web page...


You can learn about youtube api from


http://code.google.com


What are the ten best sites built in PHP ?

PHP has taken off as a development platform, what really important products have been built with it ?

What are the ten best sites built in PHP ?
php is BLAH- all the sites look the exact same. Pick any site done with php- and there's your "best site". x1
Reply:Well I'm not sure about the 'best', but here are a few big sites using PHP:





Facebook


Wikipedia (actually, all MediaWiki sites)


WordPress








And other big uses (though not necessarily websites):





phpBB


phpMyAdmin


Coppermine Photo Gallery
Reply:Ah, we can see that the previous answerer is obviously a professional. PHP has absolutely nothing to do with the look or feel of a site.





I don't know about a straight top 10 list - that is pretty subjective. A really good example of a major platform that runs on PHP is Facebook - one of the most visited websites on the internet and a very resource-intensive system.


How can I know about open soucre php software script?

I want to get some simple software source code what are designed by php.

How can I know about open soucre php software script?
phpclasses.org is a great location for small code snippets.
Reply:Try this website: http://www.mysqlphpcode.com/ . This is a pretty good code.

flower arrangement

How can we learn dimensions of the client area of Internet Explorer with PHP, JavaScript or HTML?

I need to know the height and width of the window to make some calculations. But, how can I learn these dimensions???

How can we learn dimensions of the client area of Internet Explorer with PHP, JavaScript or HTML?
You can get the width and height of the window using javascript





in Netscape Navigator:


window.innerWidth, window.innerHeight





in Microsoft Internet Explorer:


document.body.offsetWidth, document.body.offsetHeight
Reply:Here is a better approach to get the window dimensions with Javascript:





var myWidth = 0, myHeight = 0;


if( typeof( window.innerWidth ) == 'number' ) {


//Non-IE


myWidth = window.innerWidth;


myHeight = window.innerHeight;


} else if( document.documentElement %26amp;%26amp; ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {


//IE 6+ in 'standards compliant mode'


myWidth = document.documentElement.clientWidth;


myHeight = document.documentElement.clientHeight;


} else if( document.body %26amp;%26amp; ( document.body.clientWidth || document.body.clientHeight ) ) {


//IE 4 compatible


myWidth = document.body.clientWidth;


myHeight = document.body.clientHeight;


}


window.alert( 'Width = ' + myWidth );


window.alert( 'Height = ' + myHeight );


How do you call a php file to be executed within an html file?

Let's say the document i'm working on is index.html and I want to reference wally.php within the html document. Php code is as follows:





%26lt;?


echo "Hello Wally";


?%26gt;





Need the html code to reference this php script so it is executed within the html document.

How do you call a php file to be executed within an html file?
you can place the code directly into the body of the html OR you can create a separate php file - like hello.php, then include it in your html wherever you want to use it like this


%26lt;?


include("hello.php")


?%26gt;





here's a link to a good tutorial on the include function in php:


http://www.tizag.com/phpT/include.php
Reply:you shoul use the tag :"form" like this:


in your index.html, write this code:


%26lt;form method="GET" action="wally.php"%26gt;%26lt;/form%26gt;


or this one


%26lt;form method="POST" action="wally.php"%26gt;%26lt;/form%26gt;
Reply:The way to execute PHP on a .html page is to modify your .htaccess file. This file may be hidden, so depending upon your FTP program you may have to modify some settings to see it. Then you just need to add this line for .html:


AddType application/x-httpd-php .html


How do you determine the number of rows in a mySQL table with PHP?

I want to determine the number of rows in a mySQL table and store it in a variable. Could someone please help me with the syntax?

How do you determine the number of rows in a mySQL table with PHP?
Just use the query "select count(*) as total from tablename" and it will return a result set where the field is called "total" and contains the number of rows from the table.





Edit: You could also use mysql_num_rows(result). I have provided the link for it below.





Enjoy!


How can I emulate a php enviroment?

Im trying to learn PHP. I found a freesource PHP website and have downloaded it. I need to know how I could simulate the PHP enviroment so I can veiw the site as if it were accually on the web and use it to see if my tinkering and editing accually works properly.

How can I emulate a php enviroment?
There are a number of programs that can install a php environment on your Windows machine.


I just installed a product called XAMPP and it is pretty painless and works well for testing your scripts in a local environment.


http://www.apachefriends.org/en/xampp.ht...


Just follow the directions and you should be good to go.
Reply:What you need to do is actually install a server such as apache. You can do this fairly easily. Instructions are on the Apache website.





You may also want the MySql database server if your scripts will need a database. It is free too and available for most platforms.





You can then store your web pages and scripts in the apache html directory ad view them as if they are on an actual server.
Reply:We are currently using easyPHP, which is also quite good:


http://www.easyphp.org/?lang=en
Reply:For this you will need a web-server which can run *.php files. You can use Apache(window+linux), or IIS(Windows only). You will have to configure PHP on both of these.


If you don't want to configure PHP manually, then just download XAMPP from (http://www.apachefriends.org) and install it on your pc. It is pre-configured PHP, Apache, MySQL. Just download+install and u can use this.

eurovision song contest

How do I create user accounts for mySQL using php?

I need to add user accounts to mySQL using php.





I have to following code but am unsure how to execute it:


GRANT ALL PRIVILEGES ON *.* TO 'testuser'@'localhost' IDENTIFIED BY 'testpass' WITH GRANT OPTION





When I run this through phpmyadmin I get:


Access denied for user 'craig'@'localhost' (using password: YES)





'craig' is not a mySQL user account, it is my web host login


Is that why I get the error?





How do I run this from php?


Can I execute it with mysql_query()? or is there something else?

How do I create user accounts for mySQL using php?
Hello,





That is because your webhost company does not allow you to Add a new user since your current user 'craig' does not have enough priveleges.





Basically, many shared webhosting companies are like that. They usually have a web admin panel such as CPanel or anything similar, that you add MySQL users there! Then you can login using that.





So lets repeat:


I assume you havn't created a Database User yet using your webhosting service. (go on their administration page, and check MySQL section and create user from there)





That is not the reason why your getting that error. You already logged in PHPMyAdmin :) so you do have a MySQL user which is active. I assume.





So technically speaking, you have to use their tool to create users, and that current user that your using has no permission to create a new user.





Good Luck


How to create a form in PHP to download reports from external source?

I have a list of reports that I would like to be able to pull from a form dropdown and use PHP to generate a url to download this report.





This is the base url:





http://website/reports/report.aspx?ItemP... NAME}Tab%26amp;Export=true"%26gt;





I would like to fill in REPORT NAME from the dropdown box and print the link on the page.

How to create a form in PHP to download reports from external source?
Hmm...So the reports themselves are located at an external source, and you'd just like to print a link to that report....with a variable "report name"?





%26lt;?php





$base_url="http://www.website.com/repo...





$report=$_POST['report_name']; //From Select Box





//We concenate the value of $report to the rest of our URL





$list_url=$base_url.$report;





//Print URL





echo $list_url;





?%26gt;





%26lt;form name="form" method="post" action="#"%26gt;





%26lt;select name="report_name"%26gt;


%26lt;option value="report1.htm"%26gt;Report1%26lt;/option%26gt;


%26lt;option value="report2.htm"%26gt;Report2%26lt;/option%26gt;


%26lt;/select%26gt;


%26lt;/form%26gt;





/////////////////////


In the code above, you just set the value of your "option" tags


to whatever you'd like the variable part of the URL to be...when the PHP script parses your report_name POST variable, it will append that to the end of your base URL and print the result.








?%26gt;


Is it possible to use php to pass variables to MS Word?

I'm creating an online exam website. When a student passes a test, I'd like to have their information entered automatically into a Word file. I don't think this is possible, but I could be wrong.

Is it possible to use php to pass variables to MS Word?
This might help:


http://web.informbank.com/articles/techn...
Reply:Probably the easiest way for you to do this from a php-based site is to save the word document as rich text format (RTF) and then use a regular expression to substitute the name in. If the user has word installed on their PC and the browser downloads an RTF document the document will open in word and then the user can save it in .doc format, as long as you set the mime-type correctly.


How do i let people upload to one of my websites with a php script?

Ok here is what i need i need them to be able to upload something


with a php script and i need the script to index them with an optional picture and comments


oh in case you want to know its http://www.simcitysocieties.us/

How do i let people upload to one of my websites with a php script?
Before you do this, please read:





http://www.dougv.com/blog/2007/06/10/the...





That said, the PHP manual explains file uploading:





http://us2.php.net/features.file-upload
Reply:Uploading is done with a form input:





%26lt;input type=file name=uploadfile%26gt;





Your PHP will have to process this file and it's pretty involved because you have to check a lot of things for validation so I'm going to give you this link and you can choose a good free script.





This link has several scripts - pick a free one and follow its instructions:





http://php.resourceindex.com/Complete_Sc...

wedding song

How can I run a PHP function asynchronously?

Every one of my pages starts with a common php file. What I would like to do is within the common file, call a function/class which does "stuff", but in the background. So I would like to "initiate" the call, but then just move on with my script so the user doesn't wait for the function/class to finish its execution.





There's no output from this function/class it just performs its activity with session/environment variables, etc.





Thanks.

How can I run a PHP function asynchronously?
You will run up against the PHP 30 second timeout which will kill your script. PHP has no explicit thread support. You could do it by getting tricky, depending on what exactly you need to do.





You might consider callings something external and pass it all the info you want processed (via a pipe or file). You can program the task in any language the server supports.





Here is a 'threads' search on the php.net website. Might be enough...


What are the websites that i can use to help me learn php programming ?

what are the websites that i can use to help me learn php programming ?

What are the websites that i can use to help me learn php programming ?
http://www.w3schools.com/php/default.asp


http://www.learnphpfree.com/


http://www.php-learn-it.com/


http://www.phpfreaks.com/





it teach php





http://www.php.net/ for all kind of documentary





http://www.easyphp.org/ ( you download it on your PC you will have php installed with mysql and phpmyadmin with Apache server)





http://www.opensourcecms.com/ ( you can find CMS for free as well)


Is it possible to use PHP or HTML to open and create a MS Word template that has been pre-created? How?

I am building a website where the user who enters the site will have the ability to fill out a form online. I would like the user to have the ability to download this form directly into a MS Word template that I create to use as the standard form. The website is written using PHP and MY SQL, so is it possible for the user once they have finished the form to click on a button "download to word" and then the information they fill out is automatically put in a Word template to be saved as a word doc on their computer? If this is possible can you tell me how? thank you!

Is it possible to use PHP or HTML to open and create a MS Word template that has been pre-created? How?
It might be possible. Check this out:





http://www.phpbuilder.com/columns/yunus2...
Reply:There doesn't seem to be anything in the php manual about manipulating Word documents/templates.





However, you can create a pdf, and that would be available to Apple users and users without Word (like me).





I've never done this myself, but there's lots of functions in the php manual, which you can get here:


http://www.php.net/download-docs.php
Reply:This is totally the wrong approach. Build a web page as the form, then use the post information from the form to populate the mysql data. You can then build another web page including their data and display it for them to print or save as they wish.


Is there any software that I can use to build a PHP-MYSQL database without knowing programming?

Hopefully it will be a free solution. I dont have a big budget to work with, or time to go learn programming now.





Please help!

Is there any software that I can use to build a PHP-MYSQL database without knowing programming?
Try Macromedia DreamWeaver.


it's good.

stamen