<?php
/* do a MySQL query */
function do_query ($query, $db_link) {
$result = @mysql_query($query, $db_link);
if (!$result) {
fatal_error("A database query error has occurred!");
} else {
return($result);
}
}
/* get single result value */
function query2result ($query, $db_link) {
$result = do_query($query, $db_link);
$row = @mysql_result($result, 0);
return($row);
}
/* get result in numeric array */
function query2array ($query, $db_link) {
$result = do_query($query, $db_link);
$row = @mysql_fetch_row($result);
return($row);
}
/* get result in associative array */
function query2hash ($query, $db_link) {
$result = do_query($query, $db_link);
$row = @mysql_fetch_array($result);
return($row);
}
/* get row of result */
function result2row ($result) {
$row = @mysql_fetch_row($result);
return($row);
}
/* get row of result in hash */
function result2hash ($result) {
$row = @mysql_fetch_array($result);
return($row);
}
/* find number of rows in query result */
function number_rows ($result) {
$number_rows = @mysql_num_rows($result);
return($number_rows);
}
/* put rows from a column into an array */
function column2array ($query, $db_link) {
$result = do_query($query, $db_link);
while ($row = @mysql_fetch_array($result)) {
$array[] = $row[0];
}
return($array);
}
?>
Secure file download in PHP, Security question PHP, PHP MYSQL Interview Question -Books download - PHP solutions guidelines queries update, phpmysqlquestion
Thursday, April 9, 2009
Access method of MySql used in PHP
Subscribe to:
Post Comments (Atom)
How to solve mysql ERROR 1118 (42000) Row size too large
I had this issue with MYSQL 5.7 . The following worked althoug...
-
PHP has an SSH2 library which provides access to resources (shell, remote exec, tunneling, file transfer) on a remote ma...
-
Which pillar of the AWS Well-Architected Framework recommends maintaining infrastructure as code? Operational Excellence Which of the foll...
-
Introduction to PHP PDO (PHP Data Objects) 1. What is PDO 2. What Databases does PDO support 3. Where do I begin? 4. Connect to ...
No comments:
Post a Comment