mysql

nvl() function in php file

Hi I'm just looking through a php file and have come across the following code: switch (nvl($mode)) { case "add" : print_add_category_form(nvl($id, 0)); break; case "edit" : print_edit_category_form($id); break; } What does the nvl() function do?? ...

Can't get PHP to work with mySQL on Vista 64

I'm running Vista 64 box, and attempting to setup Joomla using IIS7 (I like Joomla, I want to have some asp.net components on my web site, so that's why I want to use IIS7 and not Apache). It's my first time installing both php and mysql, so it's very possible that I'm doing something obviously wrong... though I think I tried enough diag...

How can I save sessions into mysql?

I need help regarding saving sessions into mysql. Right now I am using php normal sessions for my login system. Here is my code: auth.php <?php session_start(); include('db.inc.php'); $email=mysql_real_escape_string($_POST['email']); $pwd=mysql_real_escape_string($_POST['pwd']); $sql="Select member_id,email,password,nama,type from u...

How to design DB for question-answer (MySql)

I need to design a DB for a forum. I am separating the root post from it's sub-posts for various reasons. I need the text the user enters to be optimally search-able, also from performance point of view. My question, should I separate each table (root-posts and sub-posts) into two tables: root-posts_meta (hold data such as id,creatio...

Convert static files into MySQL entries

I am converting about 4000 text files that contain HTML into MySQL database entries. Seems like an easy way to do this would be to add a couple lines to the HTML to make them appear as XML files, then XSLT the XML into MySQL INSERT statements. (Building a CSV would also work, but less optimal IMHO). I've tried doing this but am having li...

Why are there so many PHP sites that only provide for MySQL as a database?

I've dabbled with MySQL and personally, I find it vastly inferior to better RDBMSs like Postgres; while I admit it's come a long way and improved, even the latest version to my knowledge does not even support CHECK constraints to verify data integrity (it allows the keyword but doesn't do anything with it). As someone who is looking at ...

Calling mysql.exe from Java

I am calling mysql.exe from Java to load a database. Because the process just hangs, I need to create a command file and pass in the username and password. Example contents of command.bat: mysql --user="%1" --password="%2" mydatabase < myscript.sql The problem is that I cannot see the output of the mysql command to see if there were...

How to get the last field in a Mysql database with PHP ?

Hi I have mysql database and I want to get the last ID from field in a table . example : - id Value 1 david 2 jone 3 chris I want a function return 3 if this table exist . ...

Grails/Hibernate Database crashes under load: Unable to connect (even when pooling)

I have an application in Grails. I use Hibernate to access the database (per standard grails rules) I use MySql and the site works and is stable (for 6 months). I am doing load testing, and recently discovered that the database rejects connections when under load. Using MySQL Server 5, I can see threads connected hovering around 20. Th...

How to properly index a linking table for many-to-many connection in MySQL?

Lets say I have a simple many-to-many table between tables "table1" and "table2" that consists from two int fields: "table1-id" and "table2-id". How should I index this linking table? I used to just make a composite primary index (table1-id,table2-id), but I read that this index might not work if you change order of the fields in the qu...

import csv or sql thru phpmyadmin and skip PK?

Is it possible to have phpmyadmin or other tool to import a csv or sql backup into an existing DB and skip the primary key or is this a manual, table by table process of inserting with queries and manually removing the primary key? ...

Select item, and select name of parent

Quickie: Table structure: id | name | parent_id I want to run a query for ID's, but also return that item's parent_id and the name of that id as well. To better explain SELECT id, name FROM sections ...then for each ID, return the ID and name of its parent using the "parent_id" column. I'm trying to get this into an array: [0] ...

Using MySQL Connector/NET with VS2008 Crystal Reports Basic

I'm having difficulty getting crystal report to load data from a MySQL DB. I am using the Connector/NET and have a DataSet in the project which can access the data just fine. I am able to set the report data source to a DataTable from the DataSet. Crystal reports seems to know all about the column information, as I can create fields etc....

PHP: Problem in a SQL statement when using a String Parameter

$befal = mysql_query("SELECT * FROM users WHERE username = $_GET[username]"); $rad = mysql_fetch_assoc($befal); Equals Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\profile.php on line 4 I have a user called Admin in the field username and it still dont work. profile.php?user=Admin... Thi...

Optimize SQL-query

I have following query: Select diary_id, (select count(*) from `comments` as c where c.d_id = d.diary_id) as diary_comments From `diaries` as d It takes very many time (near 0.119415 in my case). How I could solve this problem? I see only one way: doing additional query for comment number for each row from my main que...

How to get a date from MySql database to C# DateTime object?

I have a MySql database with a certain feild that contains a date. How can I convert it to a C# DateTime object? And how do I convert a C# DateTime object so I can insert it to the database? ...

Scaling Drupal

I am working on a Drupal based site and notice there are a lot of seperate CSS and js files. Wading though some of the code I can also see quite a few cases where many queries are used too. What techniques have you tried to improve the performance of Drupal and what modules (if any) do you use to improve the performance of Drupal 'out o...

mysql select from n last rows

I have a table with index (autoincrement) and integer value. The table is millions of rows long. How can I search if a certain number appear in the last n rows of the table most efficiently? ...

Selecting unique entries from a column

I have this table ID | Category | Subcategory | 1 | Books | Comic | 2 | Books | Fiction | 3 | Cars | New | 4 | Books | Non- fiction | 4 | Cars | Second h...

another mysql minus question...

Hi community, I'm trying to achieve the following: SELECT id, name FROM t_profiles MINUS (SELECT p.id, p.name FROM t_profiles AS p LEFT JOIN t_skills AS s ON p.id = s.id_employee WHERE s.lvl>0 and s.id_task=1) Is there an easy way to do this in MySQL? ...