mysql

How to prevent PHP files from being downloaded? And what are some ways someone can download them?

How do i prevent php files from being downloaded "illegally" like through the browser. And what are some ways someone can use to download the php files? ...

how to create a Storm table with no primary key?

I'm trying to use Storm to create an ORM to an existing MySQL db. I'm trying to create a table Class for one of the tables but I'm getting this error: storm.exceptions.ClassInfoError: <class 'statsstorm.Aggframe'> has no primary key information This table has no primary key, or any combination of columns that produce a unique row. It...

Combine multiple rows into one space separated string

So I have 5 rows like this userid, col -------------- 1, a 1, b 2, c 2, d 3, e How would I do query so it will look like this userid, combined 1, a b 2, c d 3, e ...

Need help with mysql query.

So I am trying to do a somewhat complex query and am having trouble. I have structured it like this as it seems to be the most logical: SELECT (intake.id, s_matters.id, s_calls.cid, s_events.id) AS id, (intake.name, s_matters.casename, s_calls.name, s_events.subject) AS title FROM intake, s_matters, s_calls, s_events WHERE tit...

Php Cookie Authentication + htacess on old website upgrade

I'm updating my dad's old website. 99% complete. He has an online learning course that was done using frames and 1500+ images/pages. I created a cookie based login script that uses mysql to track users and the validity of the cookie. On each "protected" page my script appears, the cookie is rewritten with a special "code" and the code is...

SQL database usage in commercial projects

I am planning to start a commercial web project (like e.g. facebook) which requires a database. I've read through all the licenses and FAQ's of MySQL, PostgreSQL and HSQLDB but I am still not certain if I need to purchase a license (commercial type) or have to publish the source code of my web project (open source license) since I am no...

mysql: Order By relevance when using prepared statements?

I am creating a site search feature for my e-shop and am using the following code to order my query: ORDER BY((case when name RLIKE $wholeword then 3 else 0 end) + (case when name RLIKE $partialword then 1 else 0)) DESC This selects both complete and partial matches from the database and orders them giving complete matches priority ove...

Recursive MySQL query?

I have a set of data that's organized hierarchically that should be able to grow to an arbitrary size. I need to retrieve the entire tree, but I can't figure out how to do it with just SQL. My current solution is to create a temporary table and use a recursive function to successively query branches of the tree and then store the result ...

Return value of stored functions in MyDAC

I am working with Devart's MyDac and MySQL Server 5.0.41. Here is a section from the documentation on executing stored procedures with TMyConnection.ExecProc: Note: Stored functions unlike stored procedures return result values that are obtained internally through the RESULT parameter. You will no longer have to provide anonymous va...

Weird Select Result

Hi All, I have a table with an ID field of INT Type. I am doing some data validation and noticed that SELECT * from mytable where id=94 and SELECT * from mytable where id='94' works perfectly, but if I use SELECT * from mytable where id='94dssdfdfgsdfg2' it gave me the same result! How is this possible? ...

query multiple updates

how do I do multiple updates within same query. Lets say I have this query UPDATE table1 SET Order = 1 WHERE ID = 1234 But I want to change some more orders where IDs are 2345 and 2837 and 8399 how would I do that within same mysql query. Please notice that Order may be different than 1 for those. as order field is unique. ...

Mysql select statement

I need a proper way to write a simple WHERE, AND, OR statement. This one doesn't work: SELECT `content` FROM `bx_wall_events` WHERE `type` = 'wall_common_text' OR `type` = 'wall_common_fb' OR `type`= 'wall_common_tw' AND `owner_id`='{$iId}' ORDER BY `date` DESC LIMIT 1 ...

Table data handling - optimum usage

Hi, I have a table with 8 millions records in mysql. I want to keep last one week data and delete the rest, i can take a dump and recreate the table in another schema. I am struggling to get the queries right, please share your views and best approaches to do this.Best way to delete so that it will not affect other tables in the produc...

Merge two MySQL tables

Hi, I have two tables: data and comments data: ------------------- id | name | email | pics: ------------------- msg_id | pic | The data is assosiated by id and msg_id. How I can merge this two tables into final one? Edit: some rows in data don't have associated a pic, and i need to keep them. ...

Truncate with condition

Hi, truncate ->this resets the entire table, is there a way via truncate to reset particular records/check conditions. For ex: i want to reset all the data and keep last 30 days inside the table. Thanks. ...

parts of HTML static, others dynamic - PHP or HTML - best way to lookup database

I am creating a website for products. I am wondering: is it better to use a single dynamic page using PHP, or generate an HTML page for every product, updating the pages from a php template file in a cron job? Most of the material on the page (eg. basic product information) will not change over time , but other parts of the page will be ...

is there any simple php/mysql shopping cart

Hi, I need to use some sopping cart for selling "Scripts" online. Is there any simple and clean php/mysql shopping cart integrated with paypal that can be used free. Feature that I require is, a link will be dynamically generated for certain days and sent it to the user who paid so that they can instantly download the script as soon as...

Emailing a comment to an email address stored in a table

Hello, In a comment system, I am using variables called $comment and $submittor. I am using a MySQL table called "login" that contains fields called "username" and "email." The field "email" is an email address. I would like to send an email with $comment in it to the "email" where "username" = "$submittor." Here is what I have so f...

How to SQL SUM on With Statement?

Query: ;WITH SuperSelect AS ( SELECT DISTINCT DropshipPackinglist.CaseNumber AS 'CASE NO.', DropshipPackinglist.Quantity AS 'QTY' FROM DropshipPackinglist JOIN HuaweiDescription ON DropshipPackinglist.ItemNumber = HuaweiDescription.ItemNumber WHERE (DropshipPackinglist.BatchCode ='0003721008190AHWA01KG')) SELE...

PHP Array question?

Hi, Hope you are fine. My question : In MYSQL i have a table with this type of field Field Name: TAGS Value : xavier,celine,marise,leon,john,cathy,polux,maurice In PHP i do this $xwords = array(); function array_rpush(&$arr, $item) { $arr = array_pad($arr, -(count($arr) + 1), $item); } $tags = requete("SELECT tags FROM tbl_tag...