|
|
|
fbsql_insert_id search codefetch
Get the id generated from the previous INSERT operation
mysql_insert_id search codefetch
Get the ID generated from the previous INSERT operation
mysqli_insert_id search codefetch
Returns the auto generated id used in the last query
sqlite_last_insert_rowid search codefetch
Returns the rowid of the most recently inserted row
mysqli_stmt_affected_rows search codefetch
Returns the total number of rows changed, deleted, or inserted by the last executed statement
|
| Most relevant API matches shown. View All. |
![]() |
|
|
1590595521/ch30/listing30-1.php (48 lines)
1 <?php
2 // Create a new server connection
3 $mysqli = new mysqli("127.0.0.1", "siteuser", "secret", "company");
4
5 // Create the query and corresponding placeholders
6 $query = "INSERT INTO product SET rowID=NULL, productID=?,
7 name=?, price=?, description=?";
8
Additional matches viewable in cache of 1590595521/ch30/listing30-1.php. |
![]() |
|
|
FdnPHPforDW8/site_check/ch08/quote_insert.php (76 lines)
2 <?php
3 function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
4 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 break;
18 case "date":
19 $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
20 break;
21 case "defined":
22 $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
23 break;
24 }
25 return $theValue;
26 }
27
28 $editFormAction = $_SERVER['PHP_SELF'];
29 if (isset($_SERVER['QUERY_STRING'])) {
30 $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
31 }
32
33 if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
34 $insertSQL = sprintf("INSERT INTO quotations (first_name, family_name, quotation) VALUES (%s, %s, %s)",
35 GetSQLValueString($_POST['first_name'], "text"),
36 GetSQLValueString($_POST['family_name'], "text"),
Additional matches viewable in cache of FdnPHPforDW8/site_check/ch08/quote_insert.php. FdnPHPforDW8/site_check/ch09/author_insert_01.php (68 lines)
2 <?php
3 function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
4 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 break;
18 case "date":
19 $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
20 break;
21 case "defined":
22 $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
23 break;
24 }
25 return $theValue;
26 }
27
28 $editFormAction = $_SERVER['PHP_SELF'];
29 if (isset($_SERVER['QUERY_STRING'])) {
30 $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
31 }
32
33 if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "insertAuthor")) {
34 $insertSQL = sprintf("INSERT INTO authors (first_name, family_name) VALUES (%s, %s)",
35 GetSQLValueString($_POST['first_name'], "text"),
36 GetSQLValueString($_POST['family_name'], "text"));
Additional matches viewable in cache of FdnPHPforDW8/site_check/ch09/author_insert_01.php. FdnPHPforDW8/site_check/ch09/quote_insert_2tab_04.php (99 lines)
2 <?php
3 function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
4 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 break;
18 case "date":
19 $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
20 break;
21 case "defined":
22 $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
23 break;
24 }
25 return $theValue;
26 }
27
28 $editFormAction = $_SERVER['PHP_SELF'];
29 if (isset($_SERVER['QUERY_STRING'])) {
30 $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
31 }
32
33 if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "insertQuote")) {
34 $insertSQL = sprintf("INSERT INTO quotations (author_id, quotation) VALUES (%s, %s)",
35 GetSQLValueString($_POST['author_id'], "int"),
36 GetSQLValueString($_POST['quotation'], "text"));
Additional matches viewable in cache of FdnPHPforDW8/site_check/ch09/quote_insert_2tab_04.php. FdnPHPforDW8/site_check/ch11/blog_insert_01.php (89 lines)
2 <?php
3 function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
4 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 break;
18 case "date":
19 $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
20 break;
21 case "defined":
22 $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
23 break;
24 }
25 return $theValue;
26 }
27
28 $editFormAction = $_SERVER['PHP_SELF'];
29 if (isset($_SERVER['QUERY_STRING'])) {
30 $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
31 }
32
33 if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
34 $insertSQL = sprintf("INSERT INTO blog (title, article, image, caption, created) VALUES (%s, %s, %s, %s, %s)",
35 GetSQLValueString($_POST['title'], "text"),
36 GetSQLValueString($_POST['article'], "text"),
Additional matches viewable in cache of FdnPHPforDW8/site_check/ch11/blog_insert_01.php. FdnPHPforDW8/site_check/ch11/blog_insert_02.php (123 lines)
2 <?php
3 function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
4 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 break;
18 case "date":
19 $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
20 break;
21 case "defined":
22 $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
23 break;
24 }
25 return $theValue;
26 }
27
28 $editFormAction = $_SERVER['PHP_SELF'];
29 if (isset($_SERVER['QUERY_STRING'])) {
30 $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
31 }
32
33 if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
34 $insertSQL = sprintf("INSERT INTO blog (title, article, image, caption, created) VALUES (%s, %s, %s, %s, %s)",
35 GetSQLValueString($_POST['title'], "text"),
36 GetSQLValueString($_POST['article'], "text"),
Additional matches viewable in cache of FdnPHPforDW8/site_check/ch11/blog_insert_02.php. |
![]() |
|
|
phphacks/gooddb/addauthor.php (10 lines)
2 require_once("DB.php");
3
4 $dsn = 'mysql://root:password@localhost/books';
5 $db =& DB::Connect( $dsn, array() );
6 if (PEAR::isError($db)) { die($db->getMessage()); }
7
8 $sth = $db->prepare( "INSERT INTO author VALUES ( null, ? )" );
9 $db->execute( $sth, array( $_POST['name'] ) );
10 ?>
|
![]() |
|
|
chapter 16/setup.php (258 lines)
7 /******* Access Levels Table *****************************************/
8 $sql = <<<EOS
9 CREATE TABLE forum_access_levels (
10 access_lvl tinyint(4) NOT NULL auto_increment,
11 access_name varchar(50) NOT NULL default '',
12 PRIMARY KEY (access_lvl)
13 )
14 EOS;
15 $result = mysql_query($sql);
16 switch(mysql_errno()) {
17 case 1050:
18 break;
19
20 case 0:
21 $sql = "INSERT IGNORE INTO forum_access_levels " .
22 "VALUES (1,'User')";
23 $result = mysql_query($sql)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 27 $result = mysql_query($sql)
28 or die(mysql_error());
29 $sql = "INSERT IGNORE INTO forum_access_levels " .
30 "VALUES (3,'Administrator')";
31 $result = mysql_query($sql)
32 or die(mysql_error());
33 break;
34
35 default:
36 die(mysql_error());
37 break;
38 }
39 $a_tables[] = "forum_access_levels";
40
41 /******* Admin Table *************************************************/
42 $sql = <<<EOS
43 CREATE TABLE forum_admin (
44 id int(11) NOT NULL auto_increment,
45 title varchar(100) NOT NULL default '',
46 value varchar(255) NOT NULL default '',
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 55
56 case 0:
57 $sql = "INSERT INTO forum_admin " .
58 "VALUES (NULL, 'Board Title', " .
59 "'Comic Book Appreciation Forums', 'title')";
60 $result = mysql_query($sql)
61 or die(mysql_error());
62 $sql = "INSERT INTO forum_admin " .
63 "VALUES (NULL, 'Board Description', " .
64 "'The place to discuss your favorite " .
65 "comic books, movies, and more!', 'description')";
66 $result = mysql_query($sql)
67 or die(mysql_error());
68 $sql = "INSERT INTO forum_admin " .
69 "VALUES (NULL,'Admin Email', '$adminemail', 'admin_email')";
70 $result = mysql_query($sql)
71 or die(mysql_error());
72 $sql = "INSERT INTO forum_admin " .
73 "VALUES (NULL, 'Copyright', ".
74 "'©2003 CBA Inc. All rights reserved.', 'copyright')";
75 $result = mysql_query($sql)
76 or die(mysql_error());
77 $sql = "INSERT INTO forum_admin " .
78 "VALUES (NULL, 'Board Titlebar', 'CBA Forums', 'titlebar')";
79 $result = mysql_query($sql)
80 or die(mysql_error());
81 $sql = "INSERT INTO forum_admin " .
82 "VALUES (NULL, 'Pagination Limit', '10', 'pageLimit')";
83 $result = mysql_query($sql)
84 or die(mysql_error());
85 $sql = "INSERT INTO forum_admin " .
86 "VALUES (NULL, 'Pagination Range', '7', 'pageRange')";
87 $result = mysql_query($sql)
88 or die(mysql_error());
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 124
125 case 0:
126 $sql = "INSERT INTO forum_forum VALUES (NULL, 'New Forum', " .
127 "'This is the initial forum created when installing the " .
128 "database. Change the name and the description after " .
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 142 CREATE TABLE forum_postcount (
143 user_id int(11) NOT NULL default '0',
144 count int(9) NOT NULL default '0',
145 PRIMARY KEY (user_id)
146 )
147 EOS;
148 $result = mysql_query($sql);
149 switch(mysql_errno()) {
150 case 1050:
151 break;
152
153 case 0:
154 $sql = "INSERT INTO forum_postcount VALUES (1,1)";
155 $result = mysql_query($sql)
156 or die(mysql_error());
Additional matches viewable in cache of chapter 16/setup.php. chapter 10/char_transact.php (173 lines)
7
8 $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS)
9 or die('Could not connect to MySQL database. ' . mysql_error());
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 or die(mysql_error());
18
19 $sql = "INSERT INTO char_lair (id, zip_id, lair_addr) " .
20 "VALUES (NULL, '$zip', '$address')";
21 $result = mysql_query($sql)
22 or die(mysql_error());
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 25 }
26
27 $sql = "INSERT INTO char_main (id,lair_id,alias,real_name,align) " .
28 "VALUES (NULL, '$lairid', '$alias', '$name', '$align')";
29 $result = mysql_query($sql)
30 or die(mysql_error());
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 157 case "Add Power":
158 if ($newpower != '') {
159 $sql = "INSERT IGNORE INTO char_power (id, power) " .
160 "VALUES (NULL, '$newpower')";
161 $result = mysql_query($sql)
162 or die(mysql_error());
Additional matches viewable in cache of chapter 10/char_transact.php. chapter 13/cmstables.php (81 lines)
3
4 $sql = <<<EOS
5 CREATE TABLE IF NOT EXISTS cms_access_levels (
6 access_lvl tinyint(4) NOT NULL auto_increment,
7 access_name varchar(50) NOT NULL default '',
8 PRIMARY KEY (access_lvl)
9 )
10 EOS;
11 $result = mysql_query($sql)
12 or die(mysql_error());
13
14 $sql = "INSERT IGNORE INTO cms_access_levels " .
15 "VALUES (1,'User'), " .
16 "(2,'Moderator'), " .
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 68 $adminname = "Admin";
69
70 $sql = "INSERT IGNORE INTO cms_users " .
71 "VALUES (NULL, '$adminemail', '$adminpass', '$adminname', 3)";
72 $result = mysql_query($sql)
73 or die(mysql_error());
Additional matches viewable in cache of chapter 13/cmstables.php. chapter 16/transact-admin.php (113 lines)
11 and isset($_POST['forumdesc'])
12 and $_POST['forumdesc'] != "") {
13 $sql = "INSERT IGNORE INTO forum_forum " .
14 "VALUES (NULL, '" .
15 htmlspecialchars($_POST['forumname'], ENT_QUOTES) .
16 "', '" .
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 66
67 case "Add New":
68 $sql = "INSERT INTO forum_bbcode " .
69 "VALUES (NULL,'" .
70 htmlentities($_POST['bbcode-tnew'],ENT_QUOTES) . "','" .
71 htmlentities($_POST['bbcode-rnew'],ENT_QUOTES) . "')";
Additional matches viewable in cache of chapter 16/transact-admin.php. chapter 16/transact-post.php (83 lines)
10 and isset($_POST['body'])
11 and isset($_SESSION['user_id'])) {
12 $sql = "INSERT INTO forum_posts VALUES (" .
13 "NULL," . $_POST['topic_id'] .
14 "," . $_POST['forum_id'] .
15 "," . $_SESSION['user_id'] .
Additional matches viewable in cache of chapter 16/transact-post.php. |
![]() |
|
|
ProPHP5CodeSeparations/ch11/class.pgsqlLoggerBackend.php (134 lines)
4
5 class pgsqlLoggerBackend extends LoggerBackend {
6
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 113 $module = "'" . pg_escape_string($module) . "'";
114 } else {
115 $module = 'NULL';
116 }
117
118 $arFields = array();
119 $arFields[$this->messageField] = "'" . $msg . "'";
120 $arFields[$this->logLevelField] = $logLevel;
121 $arFields[$this->timestampField] = "'". strftime('%x %X', time()) . "'";
122 $arFields[$this->moduleField] = $module;
123
124 $sql = 'INSERT INTO ' . $this->table;
125 $sql .= ' (' . join(', ', array_keys($arFields)) . ')';
126 $sql .= ' VALUES (' . join(', ', array_values($arFields)) . ')';
Additional matches viewable in cache of ProPHP5CodeSeparations/ch11/class.pgsqlLoggerBackend.php. ProPHP5CodeSeparations/ch08/new_class.Database.php (155 lines)
8
9 function __construct($dsn = null) {
10 global $conn;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 86 }
87
88 $result = $this->conn->query($sql);
89
90 if(DB::isError($result)) {
91 throw new Exception($result->getMessage(), $result->getCode());
92 }
93
94 //return the number of rows affected
95 return $this->conn->affectedRows();
96 }
97 function insert($tableName, $arValues) {
98 $id = null;
99
100 $sFieldList = join(', ', array_keys($arValues));
Additional matches viewable in cache of ProPHP5CodeSeparations/ch08/new_class.Database.php. |
![]() |
|
|
06/examples/mysqli_blob1.php (22 lines)
1 <?php
2
3 $conn = mysqli_connect("localhost", "test", "", "test");
4
5 $conn->query("CREATE TABLE files (id INTEGER PRIMARY KEY AUTO_INCREMENT, ".
6 "data BLOB)");
7 $stmt = $conn->prepare("INSERT INTO files VALUES(NULL, ?)");
8 $stmt->bind_param("s", $data);
9 $file = "test.jpg";
06/mysqli_blob1.php (22 lines)
1 <?php
2
3 $conn = mysqli_connect("localhost", "test", "", "test");
4
5 $conn->query("CREATE TABLE files (id INTEGER PRIMARY KEY AUTO_INCREMENT, ".
6 "data BLOB)");
7 $stmt = $conn->prepare("INSERT INTO files VALUES(NULL, ?)");
8 $stmt->bind_param("s", $data);
9 $file = "test.jpg";
|
![]() |
|
|
chapter12/listing12-10.php (36 lines)
13
14 /* Connect to the MySQL server and select database. */
15 mysql_connect("localhost", "authenticator", "secret");
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 22 } else {
23 try {
24 $query = "INSERT INTO user SET rowID=NULL, name='$_POST[name]', email='$_POST[email]', username='$_POST[username]', pswd=MD5('$_POST[pswd]')";
25 $result = mysql_query($query);
26 if (! $result) {
27 throw new Exception("Registration problems were encountered!");
Additional matches viewable in cache of chapter12/listing12-10.php. |
![]() |
|
|
wda/ch08/example.8-2.php (40 lines)
9 {
10 if (!($connection = @ mysql_connect("localhost", "fred", "shhh")))
11 die("Could not connect to database");
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 19
20 // Insert the new phonebook entry
21 $query = "INSERT INTO phonebook VALUES
22 (NULL, '{$surname}', '{$firstname}', '{$phone}')";
23
24 if (!(@mysql_query ($query, $connection)))
25 showerror();
26
Additional matches viewable in cache of wda/ch08/example.8-2.php. wda/ch08/example.8-4.php (32 lines)
8 {
9 if (!($connection = @ mysql_connect("localhost", "fred", "shhh")))
10 die("Could not connect to database");
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 18
19 // Insert the new phonebook entry
20 $query = "INSERT INTO phonebook VALUES
21 (NULL, '{$surname}', '{$firstname}', '{$phone}')";
22
23 if (@mysql_query ($query, $connection))
24 {
25 header("Location: example.8-5.php?status=T&" .
Additional matches viewable in cache of wda/ch08/example.8-4.php. wda/ch08/example.8-9.php (57 lines)
12
13 if (!($connection = @ mysql_connect("localhost", "fred", "shhh")))
14 die("Could not connect to database");
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 44
45 // Insert the new phonebook entry
46 $query = "INSERT INTO phonebook VALUES
47 (NULL, '{$surname}', '{$firstname}', '{$phone}')";
48
49 if (!(@ mysql_query ($query, $connection)))
50 showerror();
51
Additional matches viewable in cache of wda/ch08/example.8-9.php. wda/ch10/example.10-4.php (73 lines)
3
4 if (!($connection = @ mysql_pconnect("localhost", "fred", "shhh")))
5 die("Could not connect to database");
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 57
58 // Insert the new phonebook entry
59 $query = "INSERT INTO phonebook VALUES
60 (NULL, '{$surname}', '{$firstname}', '{$phone}')";
61
62 if (!(@ mysql_query ($query, $connection)))
63 showerror();
64
Additional matches viewable in cache of wda/ch10/example.10-4.php. wda/appf/mysql_sessions.inc (189 lines)
20 // The database connection
21 $connection = NULL;
22
23 // The global variable that holds the table name
24 $session_table = NULL;
25
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 41
42 if (!($connection = @ mysql_connect($hostName, $username, $password)))
43 showerror();
44
45 if (!mysql_select_db($database_name, $connection))
46 showerror();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 71 // Execute the query
72 if (!($result = @ mysql_query($search_query, $connection)))
73 showerror();
74
75 if(mysql_num_rows($result) == 0)
76 // No session found - return an empty string
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 80 // Found a session - return the serialized string
81 $row = mysql_fetch_array($result);
82 return $row["session_variable"];
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 99 // Execute the query
100 if (!($result = @ mysql_query($search_query, $connection)))
101 showerror();
102
103 if(mysql_num_rows($result) == 0)
104 {
105 // No session found, insert a new one
106 $insert_query = "INSERT INTO {$session_table}
107 (session_id, session_variable, last_accessed)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 109
110 if (!mysql_query($insert_query, $connection))
111 showerror();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 120
121 if (!mysql_query($update_query, $connection))
122 showerror();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 148
149 if (!($result = @ mysql_query($delete_query, $connection)))
150 showerror();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174
175 if (!($result = @ mysql_query($delete_query, $connection)))
176 showerror();
|
![]() |
|
|
LearningPHP5Code/AppendixC/answer-7-4.php (133 lines)
2
3 CREATE TABLE customers (
4 customer_id INT UNSIGNED NOT NULL,
5 customer_name VARCHAR(255),
6 phone VARCHAR(15),
7 favorite_dish_id INT UNSIGNED
8 )
9
10 The form that inserts a new customer:
11 <?php
12 require 'DB.php';
13 require 'formhelpers.php';
14
15 // Connect to the database
16 $db = DB::connect('mysql://hunter:w)mp3s@db.example.com/restaurant');
17 if (DB::isError($db)) { die ("Can't connect: " . $db->getMessage()); }
18
Additional matches viewable in cache of LearningPHP5Code/AppendixC/answer-7-4.php. |
![]() |
|
|
corephp/23-6.php (161 lines)
22 //connect to database
23 if(!($dbLink = mysql_connect("localhost", "httpd", "")))
24 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 28 //select database, then test for failure
29 if(!($dbResult = mysql_query("USE test", $dbLink)))
30 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 37 "NOW()";
38 if(!($dbResult = mysql_query($Query, $dbLink)))
39 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 44 //check session
45 $mySession = NULL;
46 if(isset($_REQUEST['sid']))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 51 "WHERE ID='" . addslashes($_REQUEST['sid']) . "' ";
52 if(!($dbResult = mysql_query($Query, $dbLink)))
53 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 55 print("Couldn't query session table!<br>\n");
56 print("MySQL Reports: " . mysql_error() . "<br>\n");
57 }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 59 //if we have a row, then the match succeeded
60 if($dbRow = mysql_fetch_assoc($dbResult))
61 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 80
81 //insert session to database
82 $Query = "INSERT INTO session " .
83 "(ID, SessionData, LastAction) " .
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 87 "NOW()) ";
88 if(!($dbResult = mysql_query($Query, $dbLink)))
89 {
90 //can't execute query
91 print("Couldn't insert into session table!<br>\n");
92 print("MySQL Reports: " . mysql_error() . "<br>\n");
93 exit();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 105 "WHERE ID = '" . addslashes($_REQUEST['sid']) . "' ";
106 if(!($dbResult = mysql_query($Query, $dbLink)))
107 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 116 {
117 $mySession['Invoice'] = 'NULL';
118 }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 151 "WHERE ID='" . addslashes($_REQUEST['sid']) . "' ";
152 if(!($dbResult = mysql_query($Query, $dbLink)))
153 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 155 print("Couldn't update session table!<br>\n");
156 print("MySQL Reports: " . mysql_error() . "<br>\n");
157 exit();
|
![]() |
|
|
tunein/html/ccform.php (331 lines)
68 $d_query = "DELETE FROM orders WHERE session_id='$s_id'";
69 $d_result = mysql_query($d_query);
70
71 $o_query = "INSERT INTO orders (session_id,shipping_type_id,order_total,order_datetime) ";
72 $o_query .= "VALUES ('$s_id','$ship_type','$order_total',NOW())";
73 $o_result = mysql_query($o_query);
74
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 79
80 $i_result = mysql_query($i_query);
81
82 while($i_row = mysql_fetch_assoc($i_result))
83 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 101 $u_query = "UPDATE $table SET $change WHERE $id = $i_code";
102 $u_result = mysql_query($u_query)
103 or email("admin@tunein.site","Inventory DB Error","Inventory was not updated for order $s_id.");
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 111 $a_query = "SELECT c.cart_id,c.quantity,pg.product_group_title,f.format_description,pc.product_code_price ";
112 $a_query .= "* CASE WHEN ISNULL(s.special_percentage) OR s.start_date>CURDATE() OR s.end_date<CURDATE() ";
113 $a_query .= "THEN 1 ELSE (100-s.special_percentage)*.01 END AS price FROM product_codes pc ";
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 118 $a_query .= "WHERE c.session_id='$s_id' AND c.item_type_id=1";
119 $a_result = mysql_query($a_query);
120
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 122
123 if(mysql_num_rows($a_result) > 0)
124 {
125 while($a_row = mysql_fetch_assoc($a_result))
126 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 148 $t_query = "SELECT c.cart_id,c.quantity,e.event_name,e.event_datetime,e.event_price ";
149 $t_query .= "* CASE WHEN ISNULL(s.special_percentage) OR s.start_date>CURDATE() OR s.end_date<CURDATE() ";
150 $t_query .= "THEN 1 ELSE (100-s.special_percentage)*.01 END AS price,v.venue_city,st.state_code ";
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 155 $t_query .= "WHERE c.session_id='$s_id' AND c.item_type_id=2";
156 $t_result = mysql_query($t_query);
157
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 159
160 if(mysql_num_rows($t_result) > 0)
161 {
162 while($t_row = mysql_fetch_assoc($t_result))
163 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 192 $s_query .= "WHERE shipping_type_id = $ship_type";
193 $s_result = mysql_query($s_query);
194 $s_description = mysql_result($s_result,0);
195
tunein/html/checkout.php (435 lines)
4 $i_query = "SELECT COUNT(*) FROM carts WHERE session_id='$s_id'";
5 $i_result = mysql_query($i_query);
6 $i_count = $i_result == NULL ? 0 : mysql_result($i_result,0);
7
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 55 {
56 $i_query = "INSERT INTO customers (customer_session_id,customer_email,";
57 $i_query .= "customer_first_name,customer_last_name,customer_street_1,";
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 82
83 $i_result = mysql_query($i_query)
84 or die("<p>There was a problem in completing the order process.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 179 $s_query = "SELECT state_id,state_code FROM states ORDER BY state_code";
180 $s_result = mysql_query($s_query);
181 while($s_row = mysql_fetch_assoc($s_result))
182 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 238 $s_query .= "shipping_types WHERE shipping_type_id=$ship_type";
239 $s_result = mysql_query($s_query);
240 $s_row = mysql_fetch_assoc($s_result);
241 $ship_name = $s_row["shipping_type_description"];
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 253 $c_query .= "AND c.item_type_id=1 AND p.format_id=$i";
254 $c_result = mysql_query($c_query)
255 or die("Server Error: Please <a href=\"$HTTP_REFERER\">try again</a>.");
256
257 $c_count[] = $c_result == NULL ? 0 : mysql_result($c_result,0);
258 }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 262 $c_query .= "AND c.item_type_id=2";
263 $c_result = mysql_query($c_query);
264
265 $c_count[] = $c_result == NULL ? 0 : mysql_result($c_result,0);
266
267 $s_query = "SELECT SUM(c.quantity * CASE WHEN ISNULL(s.special_percentage) ";
268 $s_query .= "OR s.start_date>CURDATE() OR s.end_date<CURDATE() THEN p.product_code_price ";
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 274
275 $s_result = mysql_query($s_query);
276 $s_albums = mysql_result($s_result,0);
277
278 $s_query = "SELECT SUM(c.quantity * CASE WHEN ISNULL(s.special_percentage) ";
279 $s_query .= "OR s.start_date>CURDATE() OR s.end_date<CURDATE() THEN e.event_price ";
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 285
286 $s_result = mysql_query($s_query);
287 $s_tickets = mysql_result($s_result,0);
288
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 391 $s_query .= "shipping_per_ticket FROM shipping_types ORDER BY shipping_type_id";
392 $s_result = mysql_query($s_query);
393 while($s_row = mysql_fetch_assoc($s_result))
394 {
|
![]() |
|
|
DVD Life/_lib/_classes/class.newsletter.php (872 lines)
164
165 // build SQL query
166 $sql = "SELECT
167 newsletter_id
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 175 // Check and capture returned exceptions if present
176 if (DB::isError($rsTmp = $this->_oConn->query($sql))) {
177
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 264 // newsletters from being sent while the current one is sending.
265 $sql = "UPDATE
266 ".PREFIX."_newsletters
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 273 // Check and capture returned exceptions if present
274 if (DB::isError($rsTmp = $this->_oConn->query($sql))) {
275
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 326 // the number of recipients.
327 $sql = "UPDATE
328 ".PREFIX."_newsletters
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 336 // Check and capture returned exceptions if present
337 if (DB::isError($rsTmp = $this->_oConn->query($sql))) {
338
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 359
360 // Build the SQL query
361 $sql = "SELECT
362 newsletter_id
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 369 newsletter_send < NOW() AND
370 ISNULL(newsletter_sent)
371 ORDER BY
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 375 // Check and capture returned exceptions if present
376 if (DB::isError($rsTmp = $this->_oConn->query($sql))) {
377
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405
406 // Build the SQL query
407 $sql = "SELECT
408 account.account_email
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 418 // Check and capture returned exceptions if present
419 if (DB::isError($rsTmp = $this->_oConn->query($sql))) {
420
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 445
446 // Build the SQL query
447 $sql = "SELECT
448 admin_user_id,
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 466 // Check and capture returned exceptions if present
467 if (DB::isError($rsTmp = $this->_oConn->query($sql))) {
468
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 540 * @access public
541 * @param $sSort the sql "order by" attribute(s)
542 * @param $iPage the sql "limit" cursor position
543 * @return array messages data
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 546
547 // Build the SQL query
548 $sql = "SELECT
549 newsletter_id,
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 570 // Check and capture returned exceptions if present
571 if (DB::isError($rsTmp = $this->_oConn->query($sql))) {
572
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 642
643 // Build the SQL query
644 $sql = "SELECT
645 count(newsletter_id)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 652 // first returned array and then free the result set.
653 $iCnt = $this->_oConn->getOne($sql);
654
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 659
660 // INSERT METHODS :::::::::::::::::::::::::::::::::::::::::::::::::::::::::
661
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 664 *
665 * @return integer inserted newsletter id
666 * @access public
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 669
670 // Build the SQL query
671 $sql = "INSERT INTO ".PREFIX."_newsletters (
672 admin_user_id,
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 689 // Check and capture returned exceptions if present
690 if (DB::isError($rsTmp = $this->_oConn->query($sql))) {
691
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 695
696 // Get the id of the record that we just inserted
697 $sql = "SELECT LAST_INSERT_ID()";
698 $iMsgId = $this->_oConn->getOne($sql);
699 $return = $iMsgId;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 701
702 // return an id for the inserted record or false
703 return $return;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 711 *
712 * @return integer inserted newsletter id
713 * @access public
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 719
720 $sql = "UPDATE
721 ".PREFIX."_newsletters
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 733 // Check and capture returned exceptions if present
734 if (DB::isError($rsTmp = $this->_oConn->query($sql))) {
735
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 762
763 // Build the SQL query
764 $sql = "UPDATE
765 ".PREFIX."_newsletters
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 773 // Check and capture returned exceptions if present
774 if (DB::isError($rsTmp = $this->_oConn->query($sql))) {
775
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 810
811 // Build the SQL query
812 $sql = "UPDATE
813 ".PREFIX."_newsletters
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 821 // Check and capture returned exceptions if present
822 if (DB::isError($rsTmp = $this->_oConn->query($sql))) {
823
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 848
849 // Build the SQL query
850 $sql = "UPDATE
851 ".PREFIX."_newsletters
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 858 // Check and capture returned exceptions if present
859 if (DB::isError($rsTmp = $this->_oConn->query($sql))) {
860
|
![]() |
|
|
ch-5,6,7/Ch07/adodb/drivers/adodb-mysql.inc.php (536 lines)
8
9 MySQL code that does not support transactions. Use mysqlt if you need transactions.
10 Requires mysql client. Works on Windows and Unix.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 61 // Reference on Last_Insert_ID on the recommended way to simulate sequences
62 var $_genIDSQL = "update %s set id=LAST_INSERT_ID(id+1);";
63 var $_genSeqSQL = "create table %s (id int not null)";
64 var $_genSeq2SQL = "insert into %s values (%s)";
65 var $_dropSeqSQL = "drop table %s";
66
Additional matches viewable in cache of ch-5,6,7/Ch07/adodb/drivers/adodb-mysql.inc.php. ch-5,6,7/Ch07/adodb/tests/test4.php (81 lines)
12 *
13 * Test GetUpdateSQL and GetInsertSQL.
14 */
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 34 $conn->Execute("delete from adoxyz where lastname like 'Smith%'");
35
36 $rs = $conn->Execute($sql); // Execute the query and get the empty recordset
37 $record = array(); // Initialize an array to hold the record data to insert
38
39 // Set the values for the fields in the record
40 $record["firstname"] = "null";
41 $record["lastname"] = "Smith\$@//";
42 $record["created"] = time();
Additional matches viewable in cache of ch-5,6,7/Ch07/adodb/tests/test4.php. ch-5,6,7/Ch07/adodb/adodb-lib.inc.php (425 lines)
69 /*
70 Count the number of records this sql statement will return by using
71 query rewriting techniques...
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 373 $fieldInsertedCount++;
374
375 // Get the name of the fields to insert
376 $fields .= $field->name . ", ";
377
378 $mt = $rs->MetaType($field->type);
379
380 // "mike" <mike@partner2partner.com> patch and "Ryan Bailey" <rebel@windriders.com>
381 //PostgreSQL uses a 't' or 'f' and therefore needs to be processed as a string ('C') type field.
382 if ((substr($zthis->databaseType,0,8) == "postgres") && ($mt == "L")) $mt = "C";
383
384 // Based on the datatype of the field
385 // Format the value properly for the database
386 if (/*is_null($arrFields[$fieldname]) ||*/ $arrFields[$field->name] === 'null')
387 $values .= "null, ";
388 else
Additional matches viewable in cache of ch-5,6,7/Ch07/adodb/adodb-lib.inc.php. ch-5,6,7/Ch07/adodb/drivers/adodb-sqlanywhere.inc.php (166 lines)
12 21.02.2002 - Wade Johnson wade@wadejohnson.de
13 Extended ODBC class for Sybase SQLAnywhere.
14 1) Added support to retrieve the last row insert ID on tables with
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 136 Usage:
137
138 $conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
139 $conn->UpdateBlob('blobtable','blobcol',$blob,'id=1');
140 */
141 function UpdateBlob($table,$column,&$val,$where,$blobtype='BLOB')
142 {
143 $blobVarName = 'hold_blob';
144 $this->create_blobvar($blobVarName);
145 $this->load_blobvar_from_var($blobVarName, $val);
146 $this->Execute("UPDATE $table SET $column=$blobVarName WHERE $where");
147 $this->drop_blobvar($blobVarName);
148 return true;
149 }
150 }; //class
151
152 class ADORecordSet_sqlanywhere extends ADORecordSet_odbc {
153
154 var $databaseType = "sqlanywhere";
Additional matches viewable in cache of ch-5,6,7/Ch07/adodb/drivers/adodb-sqlanywhere.inc.php. ch-5,6,7/Ch07/adodb/drivers/adodb-odbc.inc.php (637 lines)
30 var $_bindInputArray = false;
31 var $curmode = SQL_CUR_USE_DRIVER; // See sqlext.h, SQL_CUR_DEFAULT == SQL_CUR_USE_DRIVER == 2L
32 var $_genSeqSQL = "create table %s (id integer)";
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 441 }
442 } else
443 $stmtid = odbc_exec($this->_connectionID,$sql);
444
445 if ($stmtid) {
446 if (@odbc_num_fields($stmtid) == 0) {
447 $this->_lastAffectedRows = odbc_num_rows($stmtid);
448 $stmtid = true;
449 } else {
450 odbc_binmode($stmtid,$this->binmode);
451 odbc_longreadlen($stmtid,$this->maxblobsize);
452 }
453 }
454 $this->_errorMsg = $php_errormsg;
455 return $stmtid;
456 }
457
458 /*
459 Insert a null into the blob field of the table first.
460 Then use UpdateBlob to store the blob.
461
Additional matches viewable in cache of ch-5,6,7/Ch07/adodb/drivers/adodb-odbc.inc.php. |
![]() |
|
|
training/index.php (195 lines)
2 <?php
3 function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
4 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 break;
18 case "date":
19 $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
20 break;
21 case "defined":
22 $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
23 break;
24 }
25 return $theValue;
26 }
27
28 $editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
29 if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
30 $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
31 }
32
33 $trainingDate = strtotime($HTTP_POST_VARS['txtDate']);
34 if (($trainingDate > 0) && (isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "frmNewTraining")) {
35 $totalTime = (GetSQLValueString($HTTP_POST_VARS['txtHrs'],"int") * 3600) + (GetSQLValueString($HTTP_POST_VARS['txtMins'],"int") * 60) + GetSQLValueString($HTTP_POST_VARS['txtSecs'],"int");
36 if ($HTTP_POST_VARS['selDistance']=='m') {
37 $totalDistance = $HTTP_POST_VARS['txtDistance'];
Additional matches viewable in cache of training/index.php. training/admin.php (368 lines)
2 <?php
3 function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
4 {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8 case "text":
9 $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
10 break;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12 case "int":
13 $theValue = ($theValue != "") ? intval($theValue) : "NULL";
14 break;
15 case "double":
16 $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
17 break;
18 case "date":
19 $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
20 break;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 33 if ((isset($HTTP_GET_VARS['discipline'])) && ($HTTP_GET_VARS['discipline'] != "") && (isset($HTTP_GET_VARS['delete']))) {
34 $deleteSQL = sprintf("DELETE FROM discipline WHERE disc_id=%s",
35 GetSQLValueString($HTTP_GET_VARS['discipline'], "int"));
36
37 mysql_select_db($database_Training, $Training);
38 $Result1 = mysql_query($deleteSQL, $Training) or die(mysql_error());
39
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 49
50 if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "frmNewDiscipline")) {
51 $insertSQL = sprintf("INSERT INTO discipline (disc_name) VALUES (%s)",
52 GetSQLValueString($HTTP_POST_VARS['txtDiscipline'], "text"));
53
54 mysql_select_db($database_Training, $Training);
55 $Result1 = mysql_query($insertSQL, $Training) or die(mysql_error());
56
57 $insertGoTo = "admin.php";
58 if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
59 $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
60 $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
61 }
62 header(sprintf("Location: %s", $insertGoTo));
63 }
64
65 if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "frmNewType")) {
66 $insertSQL = sprintf("INSERT INTO type (type_discipline, type_name) VALUES (%s, %s)",
67 GetSQLValueString($HTTP_POST_VARS['selDiscipline'], "int"),
68 GetSQLValueString($HTTP_POST_VARS['txtType'], "text"));
69
70 mysql_select_db($database_Training, $Training);
71 $Result1 = mysql_query($insertSQL, $Training) or die(mysql_error());
72
73 $insertGoTo = "admin.php";
74 if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
75 $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
76 $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
77 }
78 header(sprintf("Location: %s", $insertGoTo));
79 }
80
81 if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "frmNewRoute")) {
82 $insertSQL = sprintf("INSERT INTO routes (route_type, route_name) VALUES (%s, %s)",
83 GetSQLValueString($HTTP_POST_VARS['selType'], "int"),
84 GetSQLValueString($HTTP_POST_VARS['txtRoute'], "text"));
85
86 mysql_select_db($database_Training, $Training);
87 $Result1 = mysql_query($insertSQL, $Training) or die(mysql_error());
88
89 $insertGoTo = "admin.php";
90 if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
91 $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
92 $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
93 }
94 header(sprintf("Location: %s", $insertGoTo));
95 }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 97 if ((isset($HTTP_GET_VARS['route'])) && ($HTTP_GET_VARS['route'] != "") && (isset($HTTP_GET_VARS['delete']))) {
98 $deleteSQL = sprintf("DELETE FROM routes WHERE route_id=%s",
99 GetSQLValueString($HTTP_GET_VARS['route'], "int"));
100
101 mysql_select_db($database_Training, $Training);
102 $Result1 = mysql_query($deleteSQL, $Training) or die(mysql_error());
103
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 114 if ((isset($HTTP_GET_VARS['type'])) && ($HTTP_GET_VARS['type'] != "") && (isset($HTTP_GET_VARS['delete']))) {
115 $deleteSQL = sprintf("DELETE FROM type WHERE type_id=%s",
116 GetSQLValueString($HTTP_GET_VARS['type'], "int"));
117
118 mysql_select_db($database_Training, $Training);
119 $Result1 = mysql_query($deleteSQL, $Training) or die(mysql_error());
120
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 130
131 mysql_select_db($database_Training, $Training);
132 $query_rstAllDisciplines = "SELECT discipline.disc_id, discipline.disc_name FROM discipline";
133 $rstAllDisciplines = mysql_query($query_rstAllDisciplines, $Training) or die(mysql_error());
134 $row_rstAllDisciplines = mysql_fetch_assoc($rstAllDisciplines);
135 $totalRows_rstAllDisciplines = mysql_num_rows($rstAllDisciplines);
136
137 mysql_select_db($database_Training, $Training);
138 $query_rstAllRoutes = "SELECT `routes`.`route_id`, `routes`.`route_type`, `routes`.`route_name`, `type`.`type_name` FROM `type` INNER JOIN `routes` ON (`type`.`type_id` = `routes`.`route_type`)";
139 $rstAllRoutes = mysql_query($query_rstAllRoutes, $Training) or die(mysql_error());
140 $row_rstAllRoutes = mysql_fetch_assoc($rstAllRoutes);
141 $totalRows_rstAllRoutes = mysql_num_rows($rstAllRoutes);
142
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 209 }
210 mysql_select_db($database_Training, $Training);
211 $query_rstRelatedTypes = sprintf("SELECT type.type_id FROM type WHERE type.type_discipline = %s", $CurrentDiscipline_rstRelatedTypes);
212 $rstRelatedTypes = mysql_query($query_rstRelatedTypes, $Training) or die(mysql_error());
213 $row_rstRelatedTypes = mysql_fetch_assoc($rstRelatedTypes);
214 $totalRows_rstRelatedTypes = mysql_num_rows($rstRelatedTypes);
215
216 mysql_select_db($database_Training, $Training);
217 $query_rstAllTrainingTypes = "SELECT `type`.`type_id`, `type`.`type_discipline`, `type`.`type_name`, `discipline`.`disc_name`, `discipline`.`disc_id` FROM `discipline` INNER JOIN `type` ON (`discipline`.`disc_id` = `type`.`type_discipline`)";
218 $rstAllTrainingTypes = mysql_query($query_rstAllTrainingTypes, $Training) or die(mysql_error());
219 $row_rstAllTrainingTypes = mysql_fetch_assoc($rstAllTrainingTypes);
220 $totalRows_rstAllTrainingTypes = mysql_num_rows($rstAllTrainingTypes);
221
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 227 </tr>
228 <?php } while ($row_rstAllDisciplines = mysql_fetch_assoc($rstAllDisciplines)); ?>
229 </table>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 234 <input type="submit" name="Submit" value="Submit">
235 <input type="hidden" name="MM_insert" value="frmNewDiscipline">
236 </form>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 255 }
256 mysql_select_db($database_Training, $Training);
257 $query_rstRelatedRoutes = sprintf("SELECT routes.route_id FROM routes WHERE route_type = %s", $currentType_rstRelatedRoutes);
258 $rstRelatedRoutes = mysql_query($query_rstRelatedRoutes, $Training) or die(mysql_error());
259 $row_rstRelatedRoutes = mysql_fetch_assoc($rstRelatedRoutes);
260 $totalRows_rstRelatedRoutes = mysql_num_rows($rstRelatedRoutes);
261 ?>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 267 </tr>
268 <?php } while ($row_rstAllTrainingTypes = mysql_fetch_assoc($rstAllTrainingTypes)); ?>
269 </table>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 276 <?php
277 mysql_data_seek($rstAllDisciplines,0);
278 do {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 281 <?php
282 } while ($row_rstAllDisciplines = mysql_fetch_assoc($rstAllDisciplines));
283 $rows = mysql_num_rows($rstAllDisciplines);
284 if($rows > 0) {
285 mysql_data_seek($rstAllDisciplines, 0);
286 $row_rstAllDisciplines = mysql_fetch_assoc($rstAllDisciplines);
287 }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 291 <input type="submit" name="Submit2" value="Submit">
292 <input type="hidden" name="MM_insert" value="frmNewType">
293 </form>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 309 }
310 mysql_select_db($database_Training, $Training);
311 $query_rstRelatedLogs = sprintf("SELECT logging.log_id FROM logging WHERE logging.log_route = %s", $currentRoute_rstRelatedLogs);
312 $rstRelatedLogs = mysql_query($query_rstRelatedLogs, $Training) or die(mysql_error());
313 $row_rstRelatedLogs = mysql_fetch_assoc($rstRelatedLogs);
314 $totalRows_rstRelatedLogs = mysql_num_rows($rstRelatedLogs);
315 ?>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 321 </tr>
322 <?php } while ($row_rstAllRoutes = mysql_fetch_assoc($rstAllRoutes)); ?>
323 </table>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 330 <?php
331 mysql_data_seek($rstAllTrainingTypes, 0);
332 do {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 335 <?php
336 } while ($row_rstAllTrainingTypes = mysql_fetch_assoc($rstAllTrainingTypes));
337 $rows = mysql_num_rows($rstAllTrainingTypes);
338 if($rows > 0) {
339 mysql_data_seek($rstAllTrainingTypes, 0);
340 $row_rstAllTrainingTypes = mysql_fetch_assoc($rstAllTrainingTypes);
341 }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 345 <input type="submit" name="Submit3" value="Submit">
346 <input type="hidden" name="MM_insert" value="frmNewRoute">
347 </form>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 355 <?php
356 mysql_free_result($rstAllDisciplines);
357
358 mysql_free_result($rstRelatedTypes);
359
360 mysql_free_result($rstAllTrainingTypes);
361
362 mysql_free_result($rstRelatedRoutes);
363
364 mysql_free_result($rstAllRoutes);
365
366 mysql_free_result($rstRelatedLogs);
367 ?>
|
![]() |
|
|
PHPBible_2ndEd/ch17/form_check.php (31 lines)
9 include("/home/phpuser/Webvars.inc");
10 mysql_connect($hostname, $db_user, $password) or die("You are not the database user I'm looking for");
11 mysql_select_db("captainslog");
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 23 if($passcheck[0] == $_POST['try_pass']) {
24 // Enter new entry.
25 $query = ("INSERT INTO captainslog (ID, date, entry) VALUES(NULL, '$post_try_date', '$post_try_entry')");
26 $result = mysql_query($query);
27 print("New entry result is $result.");
28 } else {
Additional matches viewable in cache of PHPBible_2ndEd/ch17/form_check.php. PHPBible_2ndEd/ch18/mult_db_connections.php (35 lines)
1 <?php
2 $link1 = mysql_connect('host1', 'me', 'sesame');
3 mysql_select_db('userdb', $link1);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 20 $link3 = mysql_connect('host3', 'I', 'seed');
21 mysql_select_db('salesdb', $link3);
22 $query3 = "INSERT INTO saleslog (ID, date, userID, sku) VALUES (NULL, '$today', '$array1[0]', '$array2[0]')";
23 $result3 = mysql_query($query3, $link3);
24 $insertID = mysql_insert_id($link3);
25 mysql_close($link3);
Additional matches viewable in cache of PHPBible_2ndEd/ch18/mult_db_connections.php. PHPBible_2ndEd/ch21/skills_profile.php (89 lines)
5 // Open connection to the database
6 mysql_connect("localhost", "mysqluser", "sesame") or die("Database error!");
7 mysql_select_db("test");
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 15
16 foreach ($_POST['skills'] as $val) {
17 $query = "INSERT INTO user_skill (ID, user_id, skill_id) VALUES (NULL, $user_id, $val)";
18 $result = mysql_query($query);
19 if (mysql_affected_rows() == 1) {
20 continue;
Additional matches viewable in cache of PHPBible_2ndEd/ch21/skills_profile.php. PHPBible_2ndEd/ch22/db_logentry.php (56 lines)
2 include("/home/htmluser/db_password.inc");
3 mysql_connect($hostname, $user, $password);
4 mysql_select_db("weblogs");
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 22 $date = date('Ymd'); // Remember, date is an integer type
23 $blogtext = $_POST['blogtext'];
24 $query = "INSERT INTO mylog (ID, date, blogtext) VALUES(NULL, $date, '$blogtext')";
25 $result = mysql_query($query);
26 if (mysql_affected_rows() == 1) {
27 header("Location: db_login.php");
Additional matches viewable in cache of PHPBible_2ndEd/ch22/db_logentry.php. PHPBible_2ndEd/ch38/register_funcs.inc (142 lines)
29 OR email = '$email'";
30 $result = mysql_query($query);
31 if ($result && mysql_num_rows($result) > 0) {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 40 $hash = md5($email.$supersecret_hash_padding);
41
42 $query = "INSERT INTO user (user_id, user_name, first_name, last_name, password, email, remote_addr, confirm_hash, is_confirmed, date_created)
43 VALUES (NULL, '$user_name', '$first_name', '$last_name', '$password', '$email', '$user_ip', '$hash', 0, NOW())";
44 $result = mysql_query($query);
45 if (!$result) {
46 $feedback = 'ERROR - Database error';
Additional matches viewable in cache of PHPBible_2ndEd/ch38/register_funcs.inc. |
![]() |
|
|
example.6-1.php (67 lines)
8 The citation should list that the code comes from Hugh E.
9 Williams and David Lane, "Web Database Application with PHP and MySQL"
10 published by O'Reilly & Associates.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 48 die("Could not connect to database");
49
50 if (!mysql_select_db($databaseName, $connection))
51 showerror();
52
53 $insertQuery = "INSERT INTO region VALUES (NULL, " .
54 "\"" . $regionName . "\", " .
55 "\"" . $description . "\", " .
56 "NULL)";
57
58 if ((@ mysql_query ($insertQuery,
59 $connection))
60 && @ mysql_affected_rows() == 1)
Additional matches viewable in cache of example.6-1.php. example.6-2.php (93 lines)
8 The citation should list that the code comes from Hugh E.
9 Williams and David Lane, "Web Database Application with PHP and MySQL"
10 published by O'Reilly & Associates.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 76 $fileContents = NULL;
77
78 $insertQuery = "INSERT INTO region VALUES (NULL, " .
79 "\"" . $regionName . "\", " .
80 "\"" . $description . "\", " .
81 "\"" . $fileContents . "\")";
82
83 if ((@ mysql_query ($insertQuery,
84 $connection))
85 && @ mysql_affected_rows() == 1)
Additional matches viewable in cache of example.6-2.php. example.6-6.php (119 lines)
8 The citation should list that the code comes from Hugh E.
9 Williams and David Lane, "Web Database Application with PHP and MySQL"
10 published by O'Reilly & Associates.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 92 die("Could not connect to database");
93
94 if (!mysql_select_db($databaseName, $connection))
95 showerror();
96
97 // Reassemble the date of birth into database format
98 $dob = " \"$parts[3]-$parts[2]-$parts[1]\"";
99
100 // Create a query to insert the customer
101 $query = "INSERT INTO customer
102 set cust_id = NULL, " .
103 "surname = \"" . $formVars["surname"] . "\", " .
104 "firstname = \"" . $formVars["firstName"] . "\", " .
Additional matches viewable in cache of example.6-6.php. example.6-8.php (137 lines)
8 The citation should list that the code comes from Hugh E.
9 Williams and David Lane, "Web Database Application with PHP and MySQL"
10 published by O'Reilly & Associates.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 115 else
116 // Create a query to insert the customer
117 $query = "INSERT INTO customer
118 set cust_id = NULL, " .
119 "surname = \"" . $formVars["surname"] . "\", " .
120 "firstname = \"" . $formVars["firstName"] . "\", " .
121 "addressline1 = \"" . $formVars["address1"] . "\", " .
122 "city = \"" . $formVars["city"] . "\", " .
123 "email = \"" . $formVars["email"] . "\", " .
124 "birth_date = $dob";
125
126 // Run the query on the customer table
127 if (!(@ mysql_query ($query, $connection)))
128 showerror();
129
Additional matches viewable in cache of example.6-8.php. example.8-4.php (138 lines)
8 The citation should list that the code comes from Hugh E.
9 Williams and David Lane, "Web Database Application with PHP and MySQL"
10 published by O'Reilly & Associates.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 112 else
113 // Create a query to insert the customer
114 $query = "INSERT INTO customer
115 set cust_id = NULL, " .
116 "surname = \"" . $formVars["surname"] . "\", " .
117 "firstname = \"" . $formVars["firstName"] . "\", " .
118 "addressline1 = \"" . $formVars["address1"] . "\", " .
119 "city = \"" . $formVars["city"] . "\", " .
120 "email = \"" . $formVars["email"] . "\", " .
121 "birth_date = $dob";
122
123 // Run the query on the customer table
124 if (!(@ mysql_query ($query, $connection)))
125 showerror();
126
Additional matches viewable in cache of example.8-4.php. |
|
|