Computer Webmaster Gaming Console Graphics Forum

Welcome to the Computer Webmaster Gaming Console Graphics Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > Database
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

Database Database problems or need to ask a question? maybe something to do with sql injections or a database software question. Database topics cover MySQL, PostgreSQL, Oracle, SQL Server or anything else related to databases.

Google
Closed Thread
 
LinkBack Thread Tools Display Modes
Old 07-02-2007, 11:00 AM   #1
Carlton
 
Carlton's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default php insert command failure

I have a mySQL database I am accessing via php using the code
if(!$connection = mysql_pconnect("localhost",DBUSER,DBUSERPW))
{
Fatalerror($connection);
}

then calling
if(!mysql_select_db(DATABASE,$connection)) to select the database.

where DBUSER,DBUSERPW and DATABASE are defined variables

These functions appear to operate correctly.
If I run SELECT queries, using $result=mysql_query($query,$connection);
I get the correct data returned from the database.

However, running INSERT queries fail.
mysql_errno($connection) and mysql_error() both return empty strings,
giving no indication of the cause of the error.

I have checked the insert query syntax by cutting and pasting into mySQL
at the command line.

mysql -h returns
mysql Ver 14.7 Distrib 4.1.12, for mandriva-linux-gnu (i586) using
readline 5.0
..... cut ....
auto-rehash TRUE
character-sets-dir (No default value)
default-character-set latin1
compress FALSE
database (No default value)
delimiter ;
vertical FALSE
force FALSE
named-commands FALSE
local-infile FALSE
no-beep FALSE
host (No default value)
html FALSE
xml FALSE
line-numbers TRUE
unbuffered FALSE
column-names TRUE
sigint-ignore FALSE
port 3306
prompt mysql>
quick FALSE
raw FALSE
reconnect TRUE
socket (No default value)
ssl FALSE
ssl-key (No default value)
ssl-cert (No default value)
ssl-ca (No default value)
ssl-capath (No default value)
ssl-cipher (No default value)
table FALSE
debug-info FALSE
user (No default value)
safe-updates FALSE
i-am-a-dummy FALSE
connect_timeout 0
max_allowed_packet 16777216
net_buffer_length 16384
select_limit 1000
max_join_size 1000000
secure-auth FALSE

Does this indicate that my php or mySQL setup is wrong ?
I searched google groups, with no luck.
Thanks in advance
Carlton.

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Advertisements
Old 07-02-2007, 11:00 AM   #2
Jon Slaughter
 
Jon Slaughter's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default php insert command failure


"Carlton" <USENET@adent.demon.co.uk> wrote in message
news:f61a5d$j57$1$8300dec7@news.demon.co.uk...
>I have a mySQL database I am accessing via php using the code
> if(!$connection = mysql_pconnect("localhost",DBUSER,DBUSERPW))
> {
> Fatalerror($connection);
> }
>
> then calling
> if(!mysql_select_db(DATABASE,$connection)) to select the database.
>
> where DBUSER,DBUSERPW and DATABASE are defined variables
>
> These functions appear to operate correctly.
> If I run SELECT queries, using $result=mysql_query($query,$connection);
> I get the correct data returned from the database.
>
> However, running INSERT queries fail.
> mysql_errno($connection) and mysql_error() both return empty strings,
> giving no indication of the cause of the error.
>
> I have checked the insert query syntax by cutting and pasting into mySQL
> at the command line.
>
>


Perhaps you do not have the proper permissions?


 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-02-2007, 11:00 AM   #3
J.O. Aho
 
J.O. Aho's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default php insert command failure

Carlton wrote:
> I have a mySQL database I am accessing via php using the code
> if(!$connection = mysql_pconnect("localhost",DBUSER,DBUSERPW))
> {
> Fatalerror($connection);
> }


If you will have many users using your script, switch to mysql_connect() or
you risk to run out of "connection slots".

> If I run SELECT queries, using $result=mysql_query($query,$connection);
> I get the correct data returned from the database.
> However, running INSERT queries fail.
> mysql_errno($connection) and mysql_error() both return empty strings,
> giving no indication of the cause of the error.


I suggest you echo out the insert query and then try that query manually.
I do suspect, as Jon, that you may not have permissions with the selected
DBUSER to do the inserts you want.


> Does this indicate that my php or mySQL setup is wrong ?


If php had been the problem, then you got an "undefined function" error and if
mysql had been wrongly setup you most likely wouldn't been able to connect to
it. The great benefit of running Linux or BSD is that the default settings
will ensure that things works (no need to hassle with settings like microsoft
users has to get things to work, of course use the official packages from your
distribution).
If you have a low number of "connection slots" and use mysql_pconnect(), it's
known to give troubles, specially if you use more than one database at the
same time (not talking about multiple servers), as mysql_pconnect() will
remember the last database selected and will use that by default.

You know there is alt.php.sql that is for this kind of questions.


--

//Aho
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-02-2007, 11:00 AM   #4
Jerry Stuckle
 
Jerry Stuckle's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default php insert command failure

Carlton wrote:
> I have a mySQL database I am accessing via php using the code
> if(!$connection = mysql_pconnect("localhost",DBUSER,DBUSERPW))
> {
> Fatalerror($connection);
> }
>
> then calling
> if(!mysql_select_db(DATABASE,$connection)) to select the database.
>
> where DBUSER,DBUSERPW and DATABASE are defined variables
>
> These functions appear to operate correctly.
> If I run SELECT queries, using $result=mysql_query($query,$connection);
> I get the correct data returned from the database.
>
> However, running INSERT queries fail.
> mysql_errno($connection) and mysql_error() both return empty strings,
> giving no indication of the cause of the error.
>
> I have checked the insert query syntax by cutting and pasting into mySQL
> at the command line.
>
> mysql -h returns
> mysql Ver 14.7 Distrib 4.1.12, for mandriva-linux-gnu (i586) using
> readline 5.0
> .... cut ....
> auto-rehash TRUE
> character-sets-dir (No default value)
> default-character-set latin1
> compress FALSE
> database (No default value)
> delimiter ;
> vertical FALSE
> force FALSE
> named-commands FALSE
> local-infile FALSE
> no-beep FALSE
> host (No default value)
> html FALSE
> xml FALSE
> line-numbers TRUE
> unbuffered FALSE
> column-names TRUE
> sigint-ignore FALSE
> port 3306
> prompt mysql>
> quick FALSE
> raw FALSE
> reconnect TRUE
> socket (No default value)
> ssl FALSE
> ssl-key (No default value)
> ssl-cert (No default value)
> ssl-ca (No default value)
> ssl-capath (No default value)
> ssl-cipher (No default value)
> table FALSE
> debug-info FALSE
> user (No default value)
> safe-updates FALSE
> i-am-a-dummy FALSE
> connect_timeout 0
> max_allowed_packet 16777216
> net_buffer_length 16384
> select_limit 1000
> max_join_size 1000000
> secure-auth FALSE
>
> Does this indicate that my php or mySQL setup is wrong ?
> I searched google groups, with no luck.
> Thanks in advance
> Carlton.
>


First of all, don't use mysql_pconnect(). It will cause you more
problems than it will solve.

You may not have INSERT privileges. But I would expect mysql_errno to
return a value (I forget exactly which one offhand).

But you haven't shown the actual code you're using, so it's impossible
to tell what the problem might be.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-02-2007, 11:00 AM   #5
Carlton
 
Carlton's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default php insert command failure

Jon Slaughter wrote:
> "Carlton" <USENET@adent.demon.co.uk> wrote in message
> news:f61a5d$j57$1$8300dec7@news.demon.co.uk...
>> I have a mySQL database I am accessing via php using the code
>> if(!$connection = mysql_pconnect("localhost",DBUSER,DBUSERPW))
>> {
>> Fatalerror($connection);
>> }
>>
>> then calling
>> if(!mysql_select_db(DATABASE,$connection)) to select the database.
>>
>> where DBUSER,DBUSERPW and DATABASE are defined variables
>>
>> These functions appear to operate correctly.
>> If I run SELECT queries, using $result=mysql_query($query,$connection);
>> I get the correct data returned from the database.
>>
>> However, running INSERT queries fail.
>> mysql_errno($connection) and mysql_error() both return empty strings,
>> giving no indication of the cause of the error.
>>
>> I have checked the insert query syntax by cutting and pasting into mySQL
>> at the command line.
>>
>>

>
> Perhaps you do not have the proper permissions?
>
>

Running mySQL from the command line, using the same user and password
the INSERT query runs without error. php will then find the inserted
data using the mysql_query function. I would assume this means the user
has suitable permissions.
I will remove the pconnect function as advised.
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Featured Websites
Free Space
Free Space
Free Space Free Space
Closed Thread
Tags: , , ,




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional INSERT evanpeck@gmail.com Database 2 07-02-2007 10:59 AM
unwanted insert delay christopher@dailycrossword.com Database 0 07-01-2007 11:00 PM
PHP rendering failure? tns1 PHP 0 07-01-2007 3:36 PM
no post, no beeps...cpu failure? dryOtto Central Processing Unit (CPU) and Overclocking 2 06-17-2007 9:07 PM
registration failure, live help failure QuiltShopHopper Ebay Technical Questions 0 05-31-2007 12:38 AM


Featured Websites




All times are GMT +1. The time now is 12:23 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98