alter database name
hi everyone will u please tell me how to alter database name from test to test1. thanks in advance ...
hi everyone will u please tell me how to alter database name from test to test1. thanks in advance ...
Hi, I have this big function that gets a lot of different data and insert it into multiple tables.. Not all the data is always available so not all the SQL INSERT queries are successful. I need to check which SQL INSERT query was fully successful and which wasn't to the do something with this data (like inserting into a log table or simi...
Hello, I have a case where I want to use the results of a prepared statement more than once in a nested loop. The outer loop processes the results of another query, and the inner loop is the results of the prepared statement query. So the code would be something like this (just "pseudoish" to demonstrate the concept): // not showing th...
Hello all. I am new to mysql and php, but am attempting to make my own cms to help make managing my websites easier. Can someone explain the mysqli's close() function. 1)Is it nesseccary? 2)What exactly does it do? 3)I heard that after php runs its script that it closes the connection, is that true? 4)Lastly, is there a security issue w...
I have a table with lets say 2 columns. id number, and value. Value is a string (var char). Lets say i have a number x, and a list of numbers a1, a2, a3, a4, a5..... where x is not in the list. All of these numbers correspond to a unique row in the table. I want to know if the string value for x in the table is contained in one of the s...
Just started using mysqli. If I'm working with small data sets on small websites (traffic-wise), do I really need to use these all the time? $result->close(); $mysqli->close(); also, for someone doing custom php & mysql work, without a framework, is mysqli the general preferred way of interacting with mysql? ...
Possible Duplicate: Do I have to use mysql_real_escape_string if I bind parameters? I have a quick MySQLi security related question... For example, take a look at this code (gets input from the user, checks it against the database to see if the username/password combination exist): $input['user'] = htmlentities($_POST['usern...
in object oriented php mysqli I am trying to request a username, and return if it matches a row, without actually returning any user data. How would I write this?...so far I have... $sql = "SELECT NULL FROM database WHERE usernick=?"; $stmt = $link->prepare($sql) $stmt->bind_param('s', $snr); $stmt->execute(); After this step I need...
What I am looking for currently is a simple, basic, login credentials sanitation script. I understand that I make a function to do so and I have one...but all it does right now is strip tags... am I doomed to use replace? or is there a way i can just remove all special characters and spaces and limit it to only letters and numbers...th...
I have a situation where a dynamic query is being generated that could select anywhere from 1 to over 300 different columns across multiple tables. It currently works fine just doing a query, however the issue I'm running into in using a prepared statement is that I do not know how to handle the fact that I don't know how many columns I ...
Any reason why the following code won't work? $dbconnection = db::getInstance(); //this is a singleton db class $stmt = $dbconnection->prepare("SELECT `id` from `table` where `username`=?"); $stmt->bind_param("s", $username); $stmt->execute(); $stmt->bind_result($uid); $stmt->fetch(); echo $uid; The same connection method is used e...
Hi All. I'm new to php. So, please forgive me if this seems like a dumb question. Say i have a MySQL insert statement insert into table (a,b) values (1,2),(3,4),(5,6). table 'table' has a auto increment field called 'id'. how can I retrieve all the ids created by the insert statement above? It will be great if i get an example that u...
Is it possible to specify that MySQLi sends any errors and warnings to the PHP default 'error_log' directive? I can't seem to find any error options for the class specification, and I don't wish to handle errors manually like so: if ($result = $mysqli->query("...")) { } else handle $mysqli->error; ...
Whenever I try to create a mysqli object, as in; $mysqli = new mysqli(host, user, pass, database); ...the page just loads for around a minute, then stops, showing all the content of the page up until that line. info() says that MySQLi (and MySQL if that matters) are enabled, and I can access the MySQL CLI. I'm also working on a local...
I have a problem with my database class. I have a method that takes one prepared statement and any number of parameters, binds them to the statement, executes the statement and formats the result into a multidimentional array. Everthing works fine until I try to include an email adress in one of the parameters. The email contains an @ ch...
I'm experimenting with transactions for the first time in mySQL. I am wondering if it is safe to use mysqli_multi_query for this purpose. That is, can I assume that if any of the SQL statements fails, everything will be rolled back? $query = " START TRANSACTION; (a bunch of SQL statements) COMMIT; "; ...
This may be a completely dumb question, but I've seen a couple examples declaring the variables AFTER putting them in bind_param: http://devzone.zend.com/article/686 I've never seen this done before and all my programming knowledge says I should define them before hand. Is this a valid/preferred way? ...
I know its supposed to improve performance and clean strings, but lets say there are no variables? Might just be a SELECT COUNT( `column` ) AS count FROM `table` Should that be prepared? Is there any case that a SELECT statement should not be prepared? ...
I found the following code on php.net. I'm trying to write a wrapper for the MySQLi library to make things incredibly simple. If this is going to slow down performance, I'll skip it and find another way, if this works, then I'll do that. I have a single query function, if someone passes in more than one variable, I assume the function h...
I know OO is the "way to go" but I'm thinking procedural might be easier to use in the wrapper I'm making. Any difference in performance between MySQLi Object Oriented vs Procedural? ...