Hi,
I have the following functions which work on my home server (IIS 5.0,
PHP5.1, MySQL 5) but not on the production server (Linux Apache Zend,
PHP 4.4.1, MySQL 4.1.13). From what I can see, I'm connecting to the
database, but the sql passed to it is not working on the prod server.
Any help would be much appreciated, I'm a newbie from .NET.
It may be difficult to read from the code below, but when I'm inserting
the variables into the sql string, I'm using double quotes then single
quotes as in:
' INSERT INTO ... " ' . $VARIABLE . ' "
Thank you in advance.
Jon
// test.php
include('users4x.php');
$users = new users();
$users->User_InsertNew('Jon', 'byrd', 'j*@nospam.net', 'byrd', '0');
// users4x.php
class users{
function User_InsertNew($UserFirstName, $UserLastName, $UserEmail,
$UserPassword,$ActInact){
global $dbuser, $dbuserpass, $dbserver, $db;
$sql='INSERT INTO `Users`(`UserFirstName`, `UserLastName`,
`UserEmail`, `UserPassword`, `ActInact`)
VALUES("'.$UserFirstName.'","'.$UserLastName.'","' .$UserEmail.'","'.$UserPassword.'","'.$ActInact.'" );';
$connection = mysql_connect($dbserver, $dbuser, $dbuserpass) or die
("Could not connect to server");
$catalog = mysql_select_db($db);
$result = mysql_query($sql);
mysql_close();
}
} 2 1222
After calling the mysql_query function, you can call the mysql_errno
and/or mysql_error to see what errors are returned by the database
server. Personally, I log all errors: storing them in an errorlog table
or (if there is no database connection) sending them by e-mail.
Best regards by*****@rocketmail.com wrote: Hi, I have the following functions which work on my home server (IIS 5.0, PHP5.1, MySQL 5) but not on the production server (Linux Apache Zend, PHP 4.4.1, MySQL 4.1.13). From what I can see, I'm connecting to the database, but the sql passed to it is not working on the prod server. Any help would be much appreciated, I'm a newbie from .NET. It may be difficult to read from the code below, but when I'm inserting the variables into the sql string, I'm using double quotes then single quotes as in:
' INSERT INTO ... " ' . $VARIABLE . ' "
Thank you in advance.
Jon
// test.php include('users4x.php'); $users = new users(); $users->User_InsertNew('Jon', 'byrd', 'j*@nospam.net', 'byrd', '0'); // users4x.php class users{
function User_InsertNew($UserFirstName, $UserLastName, $UserEmail, $UserPassword,$ActInact){ global $dbuser, $dbuserpass, $dbserver, $db; $sql='INSERT INTO `Users`(`UserFirstName`, `UserLastName`, `UserEmail`, `UserPassword`, `ActInact`) VALUES("'.$UserFirstName.'","'.$UserLastName.'","' .$UserEmail.'","'.$UserPassword.'","'.$ActInact.'" );'; $connection = mysql_connect($dbserver, $dbuser, $dbuserpass) or die ("Could not connect to server"); $catalog = mysql_select_db($db); $result = mysql_query($sql); mysql_close(); }
}
On 30 Dec 2005 12:27:39 -0800, by*****@rocketmail.com wrote: function User_InsertNew($UserFirstName, $UserLastName, $UserEmail, $UserPassword,$ActInact){ global $dbuser, $dbuserpass, $dbserver, $db; $sql='INSERT INTO `Users`(`UserFirstName`, `UserLastName`, `UserEmail`, `UserPassword`, `ActInact`) VALUES("'.$UserFirstName.'","'.$UserLastName.'"," '.$UserEmail.'","'.$UserPassword.'","'.$ActInact.' ");'; $connection = mysql_connect($dbserver, $dbuser, $dbuserpass) or die ("Could not connect to server");
mysql_error() would add more useful information to the error message.
$catalog = mysql_select_db($db);
Check that this succeeds, similar to the mysql_connect call.
$result = mysql_query($sql);
Check that this succeeds; it's most likely this is where the error is thrown,
but you're ignoring it at the moment.
mysql_close(); }
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: R.G. Vervoort |
last post by:
I am using a javafunction (onclick in select) in which i am calling a
function in php (thats why i send this to both php and javascript
newsgroups).
in the onclick i call the function...
|
by: Randell D. |
last post by:
Folks,
I'm sure this can be done legally, and not thru tricks of the trade - I
hope someone can help.
I'm writing a 'tool' (a function) which can be used generically in any
of my projects. ...
|
by: Hohn Upshew |
last post by:
I have a function for rating the clients depending on their quantity
which works
perfectly. My only problem is that my second function called GetSize is
not recognized, and i need it in order to...
|
by: Raphael Bauduin |
last post by:
Hi,
I'm looking at the logging of a database we'll put in production soon.
I've seen some posts on this list about history tables, like mentioned in...
|
by: António Marques |
last post by:
Hi!
I don't think I've ever been here, so I assume I'm addressing a bunch of
nice people. Can you help me? I don't think there's a solution, but who
knows.
The thing is, picture a large...
|
by: Rahul K |
last post by:
Hi
I am working on Visual Studio on Windows. I have a function which
return the list of all the IP Addresses of a machine:
vector<char *getAllLocalIPAddress()
{
char localHostName;
struct...
|
by: pbmods |
last post by:
AN INTRODUCTION TO FUNCTION OBJECTS
LEVEL: INTERMEDIATE
PREREQS: OBJECTS
You've seen it before. You're setting up an XMLHttpRequest call, and you need to execute a function when it returns, so...
|
by: abendstund |
last post by:
Hi,
I have the following code and trouble with ambiguity due to operator
overloading..
The code is also at http://paste.nn-d.de/441
snip>>
|
by: H9XLrv5oXVNvHiUI |
last post by:
Hi, I have a question about injecting friend functions within template
classes. My question is specific to gcc (version 3.4.5) used in
combination with mingw because this code (or at least code...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
| | |