-1
votes
1answer
26 views

Cannot redeclare a function previously declared [duplicate]

After I have instaled in my site one script, I have an error: Fatal error: Cannot redeclare ae_detect_ie() (previously declared in /home/xdesign/public_html/Powerful/config.php:24) in ...
-3
votes
0answers
50 views

Is my PHP function efficient? Can I make it query the database faster? [closed]

I'm designing a browser-based game, and need to access 6 resources, along with funds from my MySQL database. I dread using the same code over and over again, so I just made a function in an external ...
0
votes
1answer
36 views

PHP - Populating Display Input Data with MySQL Data from Table

I am trying to populate results with a description from my MySQL database table interest_type My private function is private function Get_Interests_Types_From_DB() { $sql = "SELECT ...
0
votes
5answers
47 views

Filter page_id in content display class

I have built a class to display content from database. I want to filter it by page_id now, so I can link content to the right page_id. So i began trying to make it work with $_GET but so far it only ...
0
votes
2answers
40 views

PHP - Calling Private Function within the Class Displaying MySQL Data

I have a class Club{} that has several public functions and private functions. The three private functions I have are used to get data from my database. Here is the following code: private function ...
0
votes
0answers
11 views

MySQL Collation error: function vs table

I have a trigger (using user defined functions) on a table. The Database default collation is utf8_general. To my mind, this means that all triggers, functions and tables should operate using this ...
2
votes
3answers
84 views

looping through mysql table data

I have a mysql table 'table1' with data id mailid currentstatus assignedto assignedtime logtime 4338 14928 assigned user1 4/15/2013 13:44 4/15/2013 13:44 4352 ...
0
votes
3answers
59 views

how to create a function to be used on a html link

hi i have a datatable which will fetch data from my database and will show it in my table but with the datatable i am creating two action links one is for edit and the other is for delete and i have ...
1
vote
1answer
49 views

Title Case values in SQL database column?

I had a previous question where given a query to change all UPPERCASE values to lowercase ones, within a column in my database table. That works fine. I am now look as to whether or not it's ...
-1
votes
4answers
59 views

Call php function on a link [closed]

I have the following code but why does the function execute without pressing the link or meeting the if statement. if($_SESSION['log'] == true) { echo "<a href="'. function() ...
0
votes
1answer
29 views

mysql function, how to refer to table field datatype

in MYSQL i have a myfield column in mytable table which has let's say a varchar(8) data type CREATE TABLE mytable ( id INT NOT NULL, myfield VARCHAR( 8 )) in a function or procedure ...
1
vote
1answer
49 views

MySQL Function - Error Code: 1415 Not allowed to return a result set from a function

I am not trying to return a result set and I have no idea what I'm doing wrong here. MySQL 5.5 delimiter $$ CREATE FUNCTION CheckAccount( i_username varchar(50) ) RETURNS integer BEGIN ...
2
votes
3answers
56 views

MySQL: If I use a function in SQL query more than one time will it get re-calculated every time?

in MySQL, given the following query: select column1 , column2 , my_function1(column3) as f1 , my_function2(column4) as f2 , my_function3 (my_function1(column3), my_function2(column4)) as f3 where ...
0
votes
2answers
27 views

Verification for delete post function?

I have a simple function to delete a row from a mysql database. function delete_post($post_id){ global $dbh; $stmt = $dbh->prepare("DELETE FROM mjbox_posts WHERE post_id = ?"); ...
0
votes
1answer
67 views

Mysql function remove words with less than 3 characters

I have a problem. In my database i have certain stored procedures that perform a search on keywords i have. In my GUI (in asp.net) i have a function that takes care of my problem, but i need the same ...
1
vote
1answer
39 views

User Data from a table, in relation to another table?

Okay, so I'd like to create a function that takes the data of a table, where the username from the first table users is the same as the owner from the second table pets. I want to be able to recall ...
-1
votes
0answers
28 views

char_length() vs. length() for one-byte characters [duplicate]

If I know a column contains only one-byte characters, then char_length() and length() give the same result. Is there any reason to use one over the other? (Is one, say, faster than the other?)
3
votes
4answers
59 views

Age Groups stats with PHP and MYSQL

I want to display users stats on my website, returning the percentage of age groups like : -13 years : $percent % 13-15 years : $percent % 15-20 years : $percent % 23+ : $percent % In my mysql ...
1
vote
2answers
47 views

Error Code: 1305 MySql, Function does not Exists

i have a problem. I created a functions in MySql which return a String (varchar data type) here's the syntax DELIMITER $$ USE `inv_sbmanis`$$ DROP FUNCTION IF EXISTS `SafetyStockChecker`$$ CREATE ...
-1
votes
0answers
61 views

Error in sql with left join? [closed]

I am getting an error in my localhost. I am only wondering about the SQL, and yes, I will be updating to mysqli soon. I only included the rest of the function to show you the variables. function ...
0
votes
2answers
37 views

mysql fetch array returns false in function but not in the document

i am creating a CMS and have php creating a page. i have a while loop like this while($row = mysql_fetch_array($results)) { echo "some html code" . $row['name']; its shortend but hopefully you get ...
-6
votes
0answers
28 views

I need to use id to display name,age,sex in another form php [closed]

I have two table is Usertable table with userid,name,sex,age is paymenttable with userid,name,sex,age,amount Question is once I enter data in usertabe i need when I am in payment table ...
0
votes
2answers
34 views

What is the issue with this function, that shows the most recent post made by a specific user?

I created a function, and would like to know why it isn't working. This is the code: function new_post() { $session_user_id = $_SESSION['user_id']; $user_data = user_data($session_user_id, ...
-3
votes
3answers
68 views

“Notice: Undefined variable: db” when using PDO [closed]

On my quest to learn PDO, I wrote this code: $sql = 'SELECT * FROM category ORDER BY order_cat DESC'; foreach ($db->query($sql) as $row) { echo "<input type='radio' name='category' ...
0
votes
2answers
31 views

What is the issue with this function?

I created a function to recall the amount of posts in a certain category, in a forum. Here is the code for the function: function num_posts_evedisc() { $sql3 = "SELECT COUNT(category) FROM ...
-5
votes
0answers
36 views

mysql_result() expects parameter 1 to be resource, boolean given in C:\wamp\www\PHP learn [duplicate]

Here is my code, I can't find the error: function user_exists($user_name) { $user_name = sanitize ($user_name); return (mysql_result(mysql_query("SELECT COUNT (`id`) FROM `user_info` WHERE ...
0
votes
1answer
23 views

Mysql function that repalce .com/**** ignore with .com

is there a function in mysql that replace say my attribute is "URL" if I use replace would be REPLACE(URL,".com/index" , ".com") but I want to be able to replace anything else after .com -> ...
1
vote
2answers
41 views

direct parameters VS. saved values in variables

Should this function: function get_article_info(){ $id = $_GET['id']; $data = array(); $q = "SELECT * FROM articles WHERE article_id = $id"; $qry = mysql_query($q); ...
0
votes
2answers
42 views

A syntax error when create MySQL function [closed]

CREATE FUNCTION count(name varchar(20)) RETURNS integer BEGIN DECLARE d_count integer; select count(*) into d_count from ins ...
0
votes
1answer
35 views

PDO::FETCH_ASSOC not fetching everything

I have this function: function get_following($user_id) { global $conn; $stmt = $conn->prepare("SELECT * FROM following WHERE `follower_id`=:user"); $stmt->bindParam(':user', $user_id, ...
0
votes
4answers
85 views

Are SQL functions should be Uppercase or lowercase?

I am new in SQL and I was wondering what is the right way to write the functions because I know the norm for statements like SELECT is Uppercase, but what is the norm for functions? Because I seen ...
-1
votes
2answers
51 views

SQL auto update function

Say I've these 2 entities with n attributes- Cost Total ------------ ------------ cost_value total_cost ...
0
votes
2answers
39 views

String to function

I have the following Script: #!/bin/bash function MySQLQuery() { echo $1 #mysql -u root -p << EOF #$1 #EOF } MySQLQuery "SELECT * FROM kunden;" But the Output ...
0
votes
2answers
40 views

Add function won't work on database

Hello everyone I'm studying php + html this semester and I got stuck on this code. Everything works (list + delete from db) but adding for some reason won't add to the db even though it does validate ...
-1
votes
4answers
65 views

Really annoying error in mysql code

I am currently getting the error: Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\Project\core\functions\image.php on line 23 I have tried the ...
0
votes
2answers
84 views

Adding serial number to each record inserted in a MySQL table

My need is very simple. How to add a serial number or id(probably an auto_increment value I guess) for each row being inserted in a MySQL table? To be more specific, I've a CSV file from which I ...
0
votes
6answers
71 views

mysql select * or desired parameters in php function

I have a function which selects the * values from a particular table, I need to configure that if I pass * in parameter then it selects all or the selected parameters. My function is as follows: ...
1
vote
2answers
34 views

Why does my SQL script stops?

I have a question regarding PHP/MYSQL. I have a function which gets a list of colors in a MYSQL table and renders them into numerous HTML tables. Idea is that most of the will be hidden unless the ...
2
votes
2answers
90 views

MySQL create function fails

This CREATE FUNCTION getTagID(tag VARCHAR(100)) RETURNS BIGINT BEGIN DECLARE tagID BIGINT; SET tagID = (SELECT id FROM tags WHERE text = tag); IF tagID IS NULL THEN (INSERT ...
0
votes
1answer
21 views

Mysql Function returning same value

I am in need of mysql function but gives same value every time this mysql function gives me same value every time i.e. S_Start_ToBeStarted (Value of 1st If) -- colorA DELIMITER $$ DROP FUNCTION IF ...
0
votes
1answer
38 views

Running a user defined function in a SELECT statement - MySQL

I have a simple table called unzip. It has three columns as follows -: id INT UNSIGNED NOT NULL AUTO_INCREMENT, share_src VARCHAR(30) NULL, creator INT UNSIGNED NOT NULL. I also have a function ...
1
vote
1answer
48 views

Make a query from a function

At the moment I have written a function to check if a order is completely paid. In the fuction, a second function is used to determine the total order price. In the first function the total order ...
0
votes
2answers
66 views

check datetime in sql before execute a function

Ok I got information in the Mysql database table with a datetime colomn. I got also a php function to excecute and fill this table with an entry. What I want is to check the date in the column. If it ...
0
votes
1answer
75 views

SQL Syntax error near variable in IF statement

I'm new in MySQL and I'm getting: SQL syntax error near 'IsTrue=1 THEN' of the IF statement The MySQL function is like : DELIMITER $$ CREATE DEFINER=`root`@`localhost` FUNCTION `GetABCD`(Var1 ...
-5
votes
1answer
57 views

how can i increase the speed of my C++ calculation [closed]

i've wrote this code to calculate 3 formulas like: Lc=Lcb-Lca where Lcb and Lca equals to 7915,7*Log10(Tan(X1/2+45)) / G=Y2-Y1 / V=G/Lc ->there is also some intermediate formulas which helps me to put ...
1
vote
2answers
27 views

Returns 5th object and soon and make this as a long integer

I want to return the 5th character or in a id number. Ex. I have id number PID-15, I want to return the query after the '-' so in this example 15 then make this a a integer or long integer. How can I ...
0
votes
1answer
68 views

While loop using only mysql query language

I have some trigger to save call records as blob into database. I want to add some extra function that will execute each time with trigger and will help to keep database in some size limits: function ...
0
votes
2answers
59 views

Combining PHP hosted on a web server and jQuery to submit a form using a POST function?

I've created a PHP function which is hosted on a web server. The code here is designed to allow the user to create a user account which requires their forename, surname, email and password. I can use ...
1
vote
1answer
53 views

Need MySQL idiom for checking whether string contains any of a set of characters

I need to run the following MySQL query: SELECT id, name FROM mytable WHERE NOT CONTAINS_ANY(name, ';.<>#$!'); except that there doesn't seem to be anything like CONTAINS_ANY (taking two ...
0
votes
2answers
84 views

Why is this php function causing a sever 500 error?

I'm trying to implement these two functions in a separate file functions.php and call it in index.php function is_field($column, $table, $requested) { $is_field_query = "SELECT ".$column." FROM ...

1 2 3 4 5 12
15 30 50 per page