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