Search Posts

Month: October 2017

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near’check (id

while creating a table i’m getting following error create table check( id int(9) auto_increment, test_case varchar(20), file_name varchar(200), coverage int(5), primary key(test_case,file_name)); As i’m getting following error ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘check( id int(9) auto_increment,test_case varchar(20),file_name varchar(200),cov’ at line 1 please let me know what to do. Source: Stackoverflow

Tornado handler DB connection not fetching recent inserts

I’ve been grappling with a strange error in creating an RPC model using Tornado. Originally, I was passing some data to a Tornado handler and having the data processed in the IO loop while the results were added to a Amazon RDS database. The handler would then redirect to another one for display with a URL parameter, and everything worked fine. I then tried passing the same data to a worker process through RabbitMQ, and […]

How to save sub attribute in 3rd table in laravel

I want to save my sub-attribute data in 3rd table but i got Call to undefined method AppProduct::mores() error. Logic: Getting product_id + getting submore_id save it to more_product table. The issue: The issue is that I don’t want to get more_id but instead I want to get submore_id. hierarchy More = CPU Submore = Core i7 Product_id = 67 Result will be like: Normally i should save attribute id and that would be easy […]

how can i use exists database(mysql) in django?

my server already had a database, using PHP web server. but I will change it into the Django web server. It had a model that has to migrate If I want to use Django then do I have to remove exists database? 1. The database table column is all same both PHP and Django so I think if Django connect to database without migrate then it can use exists database but I don’t know how.. […]

How to display columns of two table in one query

I am trying to display two table in one query For example one table name is for Sell Items and another one for Purchase Items And I dont have any value where i can use JOIN table name purchase has following attribute supplier,driver,contact,truck_no,loading,packet,date AND Sell has following attributes name,driver,contact,truck_no,loading,packet,date Now i want to display both the table in transaction history GROUP BY date. Can you help me how i can achieve this in mysql.Thanks in […]

Update With Inner Join Running Too Slow

Can somebody help optimizing the query below. The tr_marketshare table contains just 84000 records and query is taking 6 minutes and 19 seconds to execute. UPDATE tr_marketshare INNER JOIN (SELECT YEAR, MONTH, Door, Category, Category_Sales,Country FROM tr_marketshare WHERE Brand=’Gucci’ AND Account=’Wojooh’ AND Category=’MU’)MS ON tr_marketshare.Door=MS.Door AND tr_marketshare.Year = MS.Year AND tr_marketshare.Month = MS.Month AND tr_marketshare.Account=’Wojooh’ AND tr_marketshare.Country = MS.Country AND tr_marketshare.Category = ‘MU’ AND tr_marketshare.Brand <> ‘Gucci’ SET tr_marketshare.Category_Sales = MS.Category_Sales; The schema information is […]

Using an sql file select ata then insert in mysql

I want to insert data from sql file into my mysql database. I know I can use source to insert directly but in this scenario I cant use source because the database columns are not the same. Also I need to sort the data and save into 3 other tables. Basically I need to put specific data from a sql file into 3 other table. MY solution was to use select then insert. But I […]

Weird error on mysql_stmt_execute

I have a weird error when trying to execute mysql_stmt_execute. The flow goes: I get the list of the tables in my database I am connecting. (catalog, schema and name) For every table I’m getting the list of foreign keys, fields and indexes. Everything goes good until I hit the table named performance_schema.events_stages_summary_by_account_by_event_name. I get the error: Identifier name “events_stages_summary_by_account_by_event_name” is too long. The weird thing is that the name is not an identifier – […]

how to print sub tasks with its task list in laravel 5.2

I have project management tool in laravel 5.2 and this application have project create and one project have tasks and each task have sub tasks. currently I am displaying projects and its tasks as well. Now I need display sub tasks witch related to each project and task. project->task->subtasks this is my task displacing method tasks/index.blade.php @foreach ($project->tasks as $task) {{ $task->task_name }} @endforeach this is displaing in the projects/show.blade.php <h5><b>Tasks List</b></h5> @if($project) @include(‘tasks.index’) @endif […]

I am using $_POST without filtering and PDO for inputting data on MYSQL DB, Is my code still vulnerable to SQL injection?

Here is something that I am doing, – code – $insert_content = “INSERT INTO POSTS(content) VALUES ( ? )”; $stmtinsert = $pdoinsert2->prepare($insert_content); $stmtinsert->bindParam(1,$content); $inserthere = $stmtinsert->execute(); if($inserthere){ echo “Your content has been posted!”; } ?> I was previously doing, $content = htmlentities($_POST[‘c’]); but it did not store foreign languages like Korean, Chinese, Nepali in proper form. In order to show the foreign languages, I had to switch to No Filtering. Is there any way to […]

Next Page »