I feel like a total n00b for not understanding what I'm doing wrong, but here goes.
I'm writing a simple web form that's storing information in a MySQL database. I'm getting this error:
mysqli_stmt_init() expects parameter 1 to be mysqli, null given in /myfile.php
Here's my code:
$server = 'localhost';
$username = 'myusername';
$pas...
if(isset($_REQUEST['SAVE'])) {
$sql = "SELECT SecName FROM section WHERE SecID='$section'";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$SecName = $row["SecName"];
}
$sql = "SELECT SubjName FROM subject WHERE SubjID='$subject'";
$result = mysql_query($sql);
while ($row = mys...
I have a form with method = post submitting to a form handler file which is writing the post to a DB and then emailing the result to a user.
I have written an insert statement but when the form is being processed I'm getting an error, but not being a DB whiz I'm not really sure what the problem is. Here's the code--
// MYSQL QUERY
$re...
Table layout:
CREATE TABLE t_order (id INT, custId INT, order DATE)
I'm looking for a SQL command to select a maximum of one row per order (the customer who owns the order is identified by a field named custId).
I want to select ONE of the customer's orders (doesn't matter which one, say sorted by id) if there is no order date given...
Almost all of free web hosting server,
you can not use PDO + MySQL.
They lack PDO drivers.
So I am considering to select
pear MDB2,
or DB_DataObject.
Which do you reccomend to me?
Give me your opinions!
...
Summary of answers:
Don't do it. The legal and financial implications will be disastrous. Look for established third party solutions or hire an expert. Never store any sensitive information on a shared server. Research for the most appropriate encryption mechanism.
I am buiding a website for a customer that needs to store his client...
I want to get the number of rows in my MySQL table and store that number in a php variable. This is the code I'm using:
$size = @mysql_query("SELECT COUNT(*) FROM News");
$size ends up being "Resource ID #7." How do I put the number of rows directly into $size?
...
Users would select their date from 3 dropdowns (day, month, year). I will combine them on server-side to make a string like '2008-12-30'. How can I then validate to make sure this date was in the right format/numeric only, etc?
...
How do I backup MySQL users and their privileges?
Anything like mysqldump?
I am looking for something like
mysqldump -d -u root -p MyTable > Schema.sql
...
while inserting date mysql server takes the year and day correctly but the month is defaultly taking januavary into the database.
i am using mysql server version 5.0.22
i am inserting the date though application.
the application was developed by using Springs web mvc frame-work and Hibernate.
...
There’s not standard way to check if a MySQL user exists and based on that drop it. Are there any workarounds for this?
Edit: I need a straight way to run this without throwing up an error
e.g.
DROP USER test@localhost; :
...
Hi, i am trying to create a Ajax live search for my website. I currently can query the database for titles and display them under my search (See Fig 1.0) however i need to make them selectable so that when you do select them, it will set the input value to that title, very much like on wikipdia search Wikipedia Search. The wikipedia exam...
Hello,
I have been trying to convert a php page to mysqli, and have encoutnered some problems. Given the code below, and the way which I have ordered things to work, I would like to know what the better way is using mysqli methods.
Is there an mysqli alternative to mysql_num_rows or is a different method of calculating the number of ...
I'm starting a new project soon and I'd like to try to use some better tools this time around. The last project, I wrote all my Database creation SQL by hand for MySQL. I'm hoping there are some good tools out there for creating, maintaining and modifying database schema in MySQL. My budget is out-of-my-own-pocket, so free (as in beer) w...
I have a mysql table containing the values for 'display' and 'link'.
I'd like to pull these into a php file that displays the 'display' value which hyperlinks to the 'link' value
I have already connected to the database and selected the appropriate rows to display, but I'm at a loss on how to create the php for this..
As you can prob...
I've bee tearing my hair out trying to get MySQL 5 running on CentOS 5 but I've had hardly any luck.
If I leave everything as default, and launch the initial install it works a charm, but if I tell the my.cnf to use a different drive to store the data, I continuously get the "Timeout error occurred trying to start MySQL Daemon." error.
...
I have a small problem. I'm populating a select tag with results from a SQL database. What I would like to have is the last one added as the top entry and the rest sorted alphabetically.
So it would return:
*----------*-------------*
developerID|developerName
*----------*-------------*
| 40 | ZZZ Dev |
| 39 | A Dev ...
I am querying a MySQL database in python and selecting a boolean value -- so the response from MySQL is either the string 'True' or 'False'. I would like to execute further code based on the boolean value from MySQL.
E.g.
data = 'False' # assume this is what was returned by MySQL.
if data:
print 'Success' #really this would be whe...
I would like to compress the results if it reached a certain number of rows.
The client program would then uncompress the result and process.
This a desktop with a client/server architecture, some clients connects through vpn.
When a client connects, it will send data to the server. After the server has done processing, the client wil...
I have the following data structure and data:
CREATE TABLE `parent` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `parent` VALUES(1, 'parent 1');
INSERT INTO `parent` VALUES(2, 'parent 2');
CREATE TABLE `other` (
`id` int(11) NOT NUL...