Ad block is installed and active. Please support us by disabling it.
HomeSunday, December 17, 2017, 04:24:34
1

MySQL Basic Functions

Tuesday, February 10, 15, 15:28:21, 3 Yaers Ago Via wain, Hits: 3918
MySQL Basic Functions - select, delete, update..
1. Create a Connection to a MySQL Database.
Code:
<?php
$dbhost = 'localhost';
$dbusername = 'root';
$dbpassword = 'mypassword';
$dbname = 'mydbname';
$conn=mysql_connect($dbhost, $dbusername, $dbpassword);
if(!$conn) :
die('Could not connect: ' . mysql_error());
endif;
$db=mysql_select_db($dbname, $conn);
if(!$db) :
die ('Cant connect to database : ' . mysql_error());
endif;
?>


2. Select Database
Code:
<?php
$result = mysql_query("SELECT text FROM textbase")
or die(mysql_error());
while($link=mysql_fetch_array($result))
{
echo $link[text];
}
?>


3. Delete From Database
Code:
<?php
$result = mysql_query("DELETE FROM textbase WHERE textid = 4 ")
or die(mysql_error());
?>


4. Update Database
Code:
<?php
$result = mysql_query("UPDATE textbase SET textno='1'
WHERE textno='0' ")
or die(mysql_error());
?>


Sign In

Sponsor

Related

Adodb Recordcount Example

RecordCount returns the number of rows in the record set.

Upload Image With PHP

[Example3] Tutorial - How to upload image in php.

PHPBB3 Shoutbox

Vesion: 1.1. Released: 08/08/10, Licence GNU, Price: Free

Meta Tags Generator 1.1. PHP Script

This script will allow your visitors to create meta tags online.

PHP Forms

FREE PHP forms

Contact Us 2.0. with HTML Page and Pop Up Frame

This is the same Contact Us 2.0. that is in this forum, But I have added more options to this script and a html page with a very nice pop Up frame that DONT get block by any pop Up software. Many websites use this type of script to bypass the blocking…

PHP $_POST Function

Collect values from a form sent with method post

PHP Trim

trim() Strip whitespace (or other characters) from the beginning and end of a string.

Site Recommendation

This script will allow your visitors to recommend your site to their friends.

PHP form with file upload

Advanced Contact Form with email and form field validation. It allows your visitors to send you an email directly from your website.
About Author

wain

Date Registered: Sun, Feb 8, 15
Last Time Online: Thu, Jun 15, 17
So far has created 115 entries.
wain
This author has not yet filled in any details.