Ad block is installed and active. Please support us by disabling it.
HomeTuesday, February 20, 2018, 01:36:19
1

MySQL Basic Functions

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

Timed Redirect JavaScript

Timed redirect javaScript/PHP example

PHP DateTimeZone

PHP representation of time zone

HTML Button Generator

This script will allow your visitors to create HTML Buttons online. To use the "html button generator" script completely free , the "powered by" link at the bottom of the pages must stay intact.

Convert pdf to image - mpdf

Convert pdf file to jpg with php and mpdf

Preg_Match - PHP Email Validation

Validate email with preg_match in php

Random MySQL Query

Random MySQL query, requirement(s): PHP Server, MySQL

Creating a CAPTCHA with PHP with imagecreate

This tutorial will show you how to create a form with Captcha, Requirement(s): PHP Server, GD Graphics Library

PHP/MySQL Bookmarklet - PHP Tutorial

PHP/MySQL bookmarklet, bookmark current page, PHP/MySQL tutorial.

PHP Write to File

PHP Write to File :: PHP Tutorial, requirement(s): PHP server
About Author

wain

Date Registered: Sun, Feb 8, 15
Last Time Online: Mon, Jan 29, 18
So far has created 115 entries.
wain
This author has not yet filled in any details.