<?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
Showing posts with label Access method of MySql used in PHP. Show all posts
Showing posts with label Access method of MySql used in PHP. Show all posts
Thursday, April 9, 2009
Access method of MySql used in PHP
Subscribe to:
Posts (Atom)
How to solve mysql ERROR 1118 (42000) Row size too large
I had this issue with MYSQL 5.7 . The following worked althoug...
-
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 ...
-
SQLSTATE[HY000]: General error MySQL: 1364 Field 'coloum' doesn't have a default value, how to solveWith the root access of the mysql, do the following changes select @@ GLOBAL . sql_mode In my case, I get the following: ONLY_FULL_...
-
I had this issue with MYSQL 5.7 . The following worked althoug...