I've made a function to fetch all results as an array of result-
arrays. Getting the result arrays is easy, via mysql_fetch_arr ay, and
function itself is quite simple, as follows:
function db_query($db, $query)
{
$result = mysql_query($qu ery, $db);
$res_array = array();
if ($result) //it is a search
{
while($data = mysql_fetch_arr ay($result,MYSQ L_ASSOC))
array_push($res _array,$data);
}
return $res_array;
}
But there's a slight problem: when the query in question is an INSERT,
UPDATE or DELETE query, PHP will show me a warning saying:
Warning: mysql_fetch_arr ay(): supplied argument is not a valid MySQL
result resource in /home/grad/ccomp/06/guedesav/public_html/PbBlog/inc/
db.php on line 28
(line 28 is "while($dat a = mysql_fetch_arr ay($result,MYSQ L_ASSOC))")
and havingthis warning on the HTML output leads to be impossible to
use header() to, for instance, go back to the post removal page. Is
there any way to know prior to fetching if my result is of and INSERT/
UPDATE/DELETE instead of a SELECT query?
Nov 21 '07
21 3706
Jerry Stuckle schrieb:
In general, it's also a bad idea to have error_display enabled in a production system. It can show other things about your system when there are problems - things you don't necessarily want known (i.e. contents of SQL statements). But it's necessary for development.
yes it depends in my files on then content of $testmode TRUE/FALSE in a
config file and will be submitted with session variable or post forms
otherwise I am using the PHP default (think it is set to #40)
>But this error is included in the proof function from those selected data before updating the data.
??? I don't understand this part.
But this error *handling* is included in the proof function from those
selected data before updating the data.
select -update
Knut
Knut Krueger wrote:
Jerry Stuckle schrieb:
>In general, it's also a bad idea to have error_display enabled in a production system. It can show other things about your system when there are problems - things you don't necessarily want known (i.e. contents of SQL statements). But it's necessary for development.
yes it depends in my files on then content of $testmode TRUE/FALSE in a
config file and will be submitted with session variable or post forms
otherwise I am using the PHP default (think it is set to #40)
>>But this error is included in the proof function from those selected data before updating the data. ??? I don't understand this part.
But this error *handling* is included in the proof function from those
selected data before updating the data.
select -update
Knut
But if the error occurs once every 10 years because a user incorrectly
deleted a required table with PhPMyAdmin, that's their problem. I'd let
the message go ahead and be displayed.
I don't try to protect against user stupidity like that.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== === This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Reply via newsgroup |
last post by:
Folks,
When performing an update in mysql (using PHP), can I find out how many
records were matched?
mysql_affected_rows() won't work... and I have the following problem
that I thought I could resolve with a simple function:
Example:
I have 50records - I want to update a selection of the recods - some,
|
by: Gordon |
last post by:
I have 2 tables t and t1. In this case, t1 is a copy of t. I want to
delete rows from t1 based on criteria on the t table and a relationship
between t ad t1 (in this case the id column). In the results below, I
would think that the delete should have deleted row 1 {1 5 me) and not
row 3 (1 5 they) when I run this statement
delete t1 from t, t1 where t.id = t1.id and t.id=1 and t.name = 'me';
Any ideas on why row 2 is deleted?
|
by: Lenz Grimmer |
last post by:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
MySQL 4.0.14, a new version of the popular Open Source/Free Software
Database, has been released. It is now available in source and binary form
for a number of platforms from our download pages at
http://www.mysql.com/downloads/ and mirror sites.
|
by: Ka |
last post by:
I install a mysql server in default installation with latin charset, but
I want to use GBK(a chinese charset), so that I can store and
search chinese words directly.
so, I download, unpack and then rewrite the mysql.spec and then recompile
the
package mysql-3.23.56-1.80.src.rpm.
first, this file contains some files:
# rpm2cpio mysql-3.23.56-1.80.src.rpm |cpio -t
|
by: I.P. |
last post by:
Hi, it's my story.
I have two 4.0.14 mysql server on one machine with win XP Professional
polish version.
First acts as master: on port 3300
Second acts as slave: on port 3301
below my configuration:
| |
by: I.P. |
last post by:
No one has replied to my post.
----- Original Message -----
From: "I.P." <jancio_wodnik@wp.pl>
To: <mysql@lists.mysql.com>
Sent: Monday, August 18, 2003 1:01 PM
Subject: mysql 4.0.14 + replication + windows XP PROF
Hi, it's my story.
|
by: miker2 |
last post by:
HI,
I'm having trouble writing to a MySql db using python and the MySQLdb
module. Here is the code:
import MySQLdb
base = MySQLdb.connect(host="localhost", user="blah", passwd="blah",
db="test_py")
cursor = base.cursor()
cursor.execute("INSERT INTO table (field) VALUES (int)")
|
by: Ike |
last post by:
Recently, I began using a different MySQL verver (i.e. different machine as
well as different version#, going from 4.12a to 4.1.9 max).
The following query used to work:
select firstname, lastname, from associates where username like 'nancianne'
but now fails with:
"You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'from associates
|
by: PowerLifter1450 |
last post by:
I've been having a very rough time installinig mySQL on Linux. I have
been following the instructions form here:
http://www.hostlibrary.com/installing_apache_mysql_php_on_linux
Everytime I get to #./configure it goes through all of the preparing
tables and starting mysqlServer and daemon, but than immediaetly says
"mysql ended" -- I try to do #make right after anyway, but I get the
error "No targets specified and no makefile found" -- Any...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |