mysql

Searching using mySql together with PHP

I'm busy developing an application where users can search within multiple table, now I'm not sure if I'm doing it the correct way. My sample code looks as follows SELECT s.name, s.surname, s.id_nr, s.student_nr, s.createdate, s.enddate FROM Student AS s, Student_Results AS sr WHERE sr.innovation =...

mysql stored procedure with parameters problem

I had created following procedure. DELIMITER ;; DROP PROCEDURE IF EXISTS getAllPortfoliosDemo;; CREATE PROCEDURE getAllPortfoliosDemo( IN keyid INT(10)) BEGIN DECLARE whereString char(100); IF (keyid > 0 ) THEN SET whereString = CONCAT( ' WHERE pkid = ', keyid ); ELSE SET whereS...

Mysql Replication Restore

Hi, How can I start one slave and tell him to stop updating in one date and time? Like "update slave until Friday 9:00"? Is possible? Thanks in advance? Regards, Pedro ...

Help with SQL Query

Hi , I am trying to call all results which start with a letter, for example purposes it needs to be the letter 'A' My SQL Query is below could you please explain what I need to add. $sqlTest="SELECT * FROM tbl_usersTest"; I am still having some errors. My whole code is $sqlTest= "SELECT * FROM tbl_usersTest WHERE name LIKE 'A%';...

how can i run an sql file with multipile create commands using php without manually parsing the sql file ?

Hello I'm building a web application using PHP5.3 and Zend Framework 1.9.4. i have an sql file that creates and populates the relevant tables. is there a way to install this sql file using PHP or even some component of Zend Framework ? for now i just search for the mysql client binary and install using it. ...

Need help on how to convert PHP code from object to procedural?

I was hoping someone can help me convert this piece of code from object form to procedural form. So I can have a sense of what to do for when I try to convert the larger piece of code that is all in object form that this snippet came from. I'm a brand new beginner. $sql = "SELECT id, label, link_url, parent_id FROM dyn_menu ORDER BY ...

Web Application with Sample "guest" data

Hello, we are currently working on a new web application using Java and MySql. We would like to implement a "guest" login feature. The idea is simple: anyone can login as a guest user and get access to a small pre-defined dataset which they can then interact with as if they were fully paid up clients. This feature should have these att...

Hibernate: Connect to MySQL without Username or Password

I am developing a hibernate application that connects to a MySQL database. The customers would like to only specify a connection string, ie: jdbc:mysql://username:passwd@server:port/db_name However, Hibernate will not connect using just this string. It also wants the username and password connection properties set. Is there any way ...

PHP Fatal error Help

I get the following error. Fatal error: Cannot increment/decrement overloaded objects nor string offsets Here is the code. $mysqli = new mysqli("localhost", "root", "", "sitename"); $dbc = mysqli_query($mysqli,"SELECT id, label, link_url, parent_id FROM dyn_menu ORDER BY parent_id, id ASC"); if (!$dbc) { // There was an error...do ...

mysql order varchar field as integer

I have a varchar field in my table and I want to sort it. But I need to handle this field as integer. Meaning if sort as text the order is "19,2,20" but I want to get the right order "2,19,20". Can anyone help me? ...

Mysql Restore from binlogs

Hi, How can we make one database restore date to date, like "sunday to wednesday" but from one binlog file? Thanks, Pedro ...

Counting rows in mysql

I have a mysql problem, my query looks as follows but not complete SELECT s.name, s.surname FROM students as s, practical as p, days_attend as d WHERE s.sid = p.sid AND s.sid = d.sid The scenario is the user may enter in a form to search how many days the student has been absent, eg if he enters 5 it will b...

mySql unknown column

I have the following query SELECT s.name, s.surname, s.id_nr, s.student_nr, s.createdate, s.enddate, (SELECT count(*) FROM Student_Attendance WHERE absent = 1) AS count_absent FROM Student AS s, Student_Contact AS sc, Student_Payment AS p, Student_Courses AS scou...

MySql Federated SSL

I have both databases running with SSL, and I've tested to make sure I can connect to either server using SSL via the mysql client. The question now is when I connect to the local, federated server using SSL, does the stream remain encrypted when the federated table connects to the remote table in order to pull the data? Is there a w...

MySql bulk load command line tool

Does MySql have a bulk load command line tool like bcp for SQLServer and sqlldr for Oracle? I know there's a SQL command LOAD INFILE or similar but I sometimes need to bulk load a file that is on a different box to the MySQL database. ...

How is input to the MySQL function md5 handled?

I'm having problems understanding how input to the md5 function in MySQL 4.1.22 is handled. Basically I'm not able to recreate the md5sum of a specific value combination for comparison. I guess it has something to do with the format of the input data. I have set up a table with two columns of type double(direction and elevation) + a thi...

MySQL and PHP display problem?

I can't get the following code to display items from the database where the parent_id is equal to the id. Here is the code below. // Query member data from the database and ready it for display $mysqli = new mysqli("localhost", "root", "", "sitename"); $dbc = mysqli_query($mysqli,"SELECT * FROM categories WHERE id=parent_id"); if (!$d...

MySQL - REGEXP in a WHERE statement?

I have a table with a field called 'user_car'. It consists of a cat'd underscore separated value (user's id _ car's id) user_car rating ----------------------------- 11_56748 4 13_23939 2 1_56748 1 2001_56748 5 163_23939 1 I need to get the average rating for any "car". In my ex...

PHP - How to update data to MySQL when click a radio button

Example to save gender <form action="save.php?id=<?=$id?>" method="post"> <p><label><input name="gender" type="radio" value="male" <?php if($gender=='male'){?>checked="checked"<? }?> /> Male</label></p> <p><label><input name="gender" type="radio" value="female" <?php if($gender=='female'){?>checked="checked"<? }?> /> Female</lab...

MySQL using calculated return values to calculate other values

This may be difficult to explain, so bare with me. Let's say I have a select Statement with the following: SUM(st.tafPoints/200) as totalFriendReferrals, SUM(CASE WHEN st.gender = "m" THEN st.tafPoints/200 ELSE 0 END) as maleFriendReferrals, SUM(CASE WHEN st.gender = "f" THEN st.tafPoints/200 ELSE 0 END) as femaleFriendReferrals I ne...