HomeMonday, June 26, 2017, 10:20:34
1

MySQL Basic Functions

Tuesday, February 10, 15, 15:28:21, 2 Yaers Ago Via wain, Hits: 2935
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

Link Base L.1.1.

This script allows you to manage your links using a MySQL database. It features easy install, user submission, and an admin panel to add, edit and remove categories and links. The script is easy to customize to suit your needs.

Sending HTML Email With Images - PHP Tutorial

Sending HTML Email With Images - Upload Image with PHP - Creating Dynamic Webpages Using PHP and MySQL - Select, Delete, Update..

Show / Hide Div with CSS

CSS Display and Visibility:The visibility property specifies whether or not an element is visible.

Bookmark Current Page - PHP Tutorial

Bookmark current page with PHP example.

PHP Redirect

Header (location) redirect must be processed before any output to the browser.

Jquery PHP Contact Form

This script allows your visitors to send you an email directly from your website.

PHP Trim

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

Inserting form data in MySql table

Inserting form data in MySql table with PHP

FeedBack Form with Captcha

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.