Call stored procedure (firebird database) with php PDO [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
I have some stored procedures on a firebird database.
Now I want to call them with PHP.
SP have a suspend code and a return value and the SP need some input parameters..
Can someone help me...

Firebird doesn't have CALL syntax. How to call the SP depends on whether it is selectable (has a SUSPEND statement in it's body) or not. To call selectable SP you use SELECT statement:
select outParam1, outParam2 from mySP(:inParam1, :inParam2)
The selectable SP returns resultset which can be treated as one resulting from an "ordianary" select statement.
To call non-selectable SP you use EXECUTE PROCEDURE:
EXECUTE PROCEDURE mySP(:inParam1, :inParam2) RETURNING_VALUES(:out1, :out2)

Related

Possible to INSERT INTO from an IF statement [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Just wondering if it's possible to run a INSERT INTO sql command through an if statement?
I've got a few test groups that contain test members and I want to add the group id to a db table if the group_id equals 3. I'm unsure how the INSERT INTO sql would be written.
I'm currently passing the group_id number into a variable called $groupIDResult.
The only code I have currently got is:
if ($groupIDResult[0] == 3) {}
Just wondering if it's possible to run a INSERT INTO sql command
through an if statement?
Yes. An if statement is just a condition that checks criteria you set such as whether $groupIDResult[0] is equal to 3. So just do this and all is good:
if ($groupIDResult[0] == 3) {
// INSERT INTO query & related PHP logic to run that query goes here.
}
But you state:
I'm unsure how the INSERT INTO sql would be written.
So what is the real question? Is it about a SQL query or an if condition? Because you are on the right track but it’s unclear why you are having problems.
The insert statement would go in your curly braces and would be of the form
INSERT INTO table_name(column_name) VALUES(your_value)
Consult the PHP manual or the manuals for any framework you're using for specific syntax.
W3Schools.com also has some intro to SQL material you may find useful.

Postgresql pagination way [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm using postgresql database. I want to do an pagination for my articles, but i have no idea how to do it. I havent found a solution for postgresql (found some for mysql).
This is my query.
$user->getUsers(); - I call method, which is doing query..
function getUsers()
{
$this->querySelect("SELECT vk_id, eu_name, eu_data, eu_society, eu_want_team, eu_notes, eu_main_profession, eu_avatar FROM users");
}
I have read, that query should contain LIMIT, but it just only limit the results quantity. Can anybody tell me how to do that pagination please?
Will be very thankful..
If you really want Postgresql to do this, you're looking for OFFSET and LIMIT combined.
LIMIT means no more than that many rows will be returned.
OFFSET says to skip that many rows before beginning to return rows.
Also, you have to have an ORDER BY clause on your query for this to work.
You'll have to keep track of the page size and which page you are on.
Here is a relevant documentation page (Postgresql 8.4)
http://www.postgresql.org/docs/8.4/static/queries-limit.html

Convert an unknown format of database query into MySQL query [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I got it from MaxMind
And this is how the data looks like:
Country,City,AccentCity,Region,Population,Latitude,Longitude
ad,aixas,Aixàs,06,,42.4833333,1.4666667
ad,aixirivali,Aixirivali,06,,42.4666667,1.5
ad,aixirivall,Aixirivall,06,,42.4666667,1.5
ad,aixirvall,Aixirvall,06,,42.4666667,1.5
ad,aixovall,Aixovall,06,,42.4666667,1.4833333
ad,andorra,Andorra,07,,42.5,1.5166667
I want to convert the structure of this unknown type data into MySQL query language so that I can insert it into my MySQL database. Is it possible?
The data is about 145 MB!! I can paste the whole data code if required.
Alternative required solution: What should I do to insert it in my database?
that looks like a regular CSV to me, and PHPMyAdmin is capable of handling such format in the import menu
The problem I see there is that you've got a large file to upload and most php configurations won't allow you such big upload. Why not try it with, say, the first 1000 lines of your file?

Use this php code wih WHERE [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Can I use this php code wih WHERE? SELECT SUM(buzz) as buzz FROM $table I want to calculate sumation of some spesific rows.
If you want specifically in PHP then this might help you
SELECT SUM(buzz) as buzz FROM $table WHERE $where
No, you can't use PHP code in an SQL where condition. Databases typically don't include a PHP interpreter.
What you can do is use PHP to generate the where clause that you need.

Writing query results to a text file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am a new user of php.
I have one table in mysql database. I have a form which the users use to query the mysql database. I am testing my html form page on my linux laptop which has APACHE server.
I am able to make a connection to the mysql database and display results in the browser.
I am not sure how to capture the results from the variable which has query results which has several rows of data and be able to write the results to a text file in /var/www/
Thank you
I noticed every time you check if the POST variable is set you use something like
if(isset($POST["submit"])){
Was that a typo in this post or are you forgetting the underscore?
if(isset($_POST["submit"])){
Also try to use mysql_fetch_assoc instead of mysql_fetch_array.
And always prepare the variabes for usage in a query if you do not want to get hacked instantly.

Categories